diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-11-22 16:45:52 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-11-22 16:45:52 +0000 |
commit | 754c05ed6c3b88f8180ae8686e030b5b02b23d43 (patch) | |
tree | c7f8238ee141c0564823122c52fed070ea8f2c0b /Makefile.lib | |
parent | 9a14d5e2f3a0b6ab626b9d22256df8bcc1c585a3 (diff) |
Rename $(here) to $(d) for brevity, and remove trailing slash
Diffstat (limited to 'Makefile.lib')
-rw-r--r-- | Makefile.lib | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/Makefile.lib b/Makefile.lib index b6d31e7ce..f2eea7ac8 100644 --- a/Makefile.lib +++ b/Makefile.lib @@ -1,3 +1,15 @@ +default: all + + +# Include all sub-Makefiles. +define include_sub_makefile = + d := $$(patsubst %/, %, $$(dir $(1))) + include $(1) +endef + +$(foreach mf, $(SUBS), $(eval $(call include_sub_makefile, $(mf)))) + + # Include Autoconf variables. Makefile.config: Makefile.config.in ./config.status @@ -22,10 +34,10 @@ libs_list := define LIBS_template = _d := $$($(1)_DIR) - _srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)$$(src)) + _srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)/$$(src)) _objs := $$(addsuffix .o, $$(basename $$(_srcs))) _libs := $$(foreach lib, $$($(1)_LIBS), $$(lib).a) - _lib := $$(_d)$(1).a + _lib := $$(_d)/$(1).a $$(_lib): $$(_objs) $(QUIET) ar crs $$@ $$? @@ -36,7 +48,7 @@ define LIBS_template = include $$(wildcard $$(_d)/*.dep) libs_list += $$(_lib) - clean_list += $$(_d)*.a $$(_d)*.o $$(_d)*.dep + clean_list += $$(_d)/*.a $$(_d)/*.o $$(_d)/*.dep dist_files += $$(_srcs) endef @@ -48,10 +60,10 @@ programs_list := define PROGRAMS_template = _d := $$($(1)_DIR) - _srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)$$(src)) + _srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)/$$(src)) _objs := $$(addsuffix .o, $$(basename $$(_srcs))) - _libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_DIR)$$(lib).a) - _prog := $$(_d)$(1) + _libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_DIR)/$$(lib).a) + _prog := $$(_d)/$(1) $$(_prog): $$(_objs) $$(_libs) $(QUIET) g++ -o $$@ $$^ $$($(1)_LDFLAGS) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS)) @@ -62,7 +74,7 @@ define PROGRAMS_template = include $$(wildcard $$(_d)/*.dep) programs_list += $$(_prog) - clean_list += $$(_prog) $$(_d)*.o $$(_d)*.dep + clean_list += $$(_prog) $$(_d)/*.o $$(_d)/*.dep dist_files += $$(_srcs) endef |