diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-11-22T16·45+0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-11-22T16·45+0000 |
commit | 754c05ed6c3b88f8180ae8686e030b5b02b23d43 (patch) | |
tree | c7f8238ee141c0564823122c52fed070ea8f2c0b | |
parent | 9a14d5e2f3a0b6ab626b9d22256df8bcc1c585a3 (diff) |
Rename $(here) to $(d) for brevity, and remove trailing slash
-rw-r--r-- | Makefile.lib | 26 | ||||
-rw-r--r-- | Makefile.new | 27 | ||||
-rw-r--r-- | src/boost/format/Makefile.new | 2 | ||||
-rw-r--r-- | src/libexpr/Makefile.new | 10 | ||||
-rw-r--r-- | src/libmain/Makefile.new | 2 | ||||
-rw-r--r-- | src/libstore/Makefile.new | 2 | ||||
-rw-r--r-- | src/libutil/Makefile.new | 9 | ||||
-rw-r--r-- | src/nix-daemon/Makefile.new | 2 | ||||
-rw-r--r-- | src/nix-env/Makefile.new | 2 | ||||
-rw-r--r-- | src/nix-hash/Makefile.new | 2 | ||||
-rw-r--r-- | src/nix-instantiate/Makefile.new | 2 | ||||
-rw-r--r-- | src/nix-store/Makefile.new | 2 |
12 files changed, 49 insertions, 39 deletions
diff --git a/Makefile.lib b/Makefile.lib index b6d31e7ce83b..f2eea7ac81d2 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 diff --git a/Makefile.new b/Makefile.new index ea4096cc1c4b..af2c4cec3c4d 100644 --- a/Makefile.new +++ b/Makefile.new @@ -1,18 +1,15 @@ -default: all - -here = $(dir $(lastword $(MAKEFILE_LIST))) - -include src/boost/format/Makefile.new -include src/libutil/Makefile.new -include src/libstore/Makefile.new -include src/libmain/Makefile.new -include src/libexpr/Makefile.new -include src/nix-hash/Makefile.new -include src/nix-store/Makefile.new -include src/nix-instantiate/Makefile.new -include src/nix-env/Makefile.new -include src/nix-daemon/Makefile.new +SUBS = \ + src/boost/format/Makefile.new \ + src/libutil/Makefile.new \ + src/libstore/Makefile.new \ + src/libmain/Makefile.new \ + src/libexpr/Makefile.new \ + src/nix-hash/Makefile.new \ + src/nix-store/Makefile.new \ + src/nix-instantiate/Makefile.new \ + src/nix-env/Makefile.new \ + src/nix-daemon/Makefile.new include Makefile.lib -CXXFLAGS += -I . -I src -I src/libutil -I src/libstore -I src/libmain -I src/libexpr +CXXFLAGS += -I . -I src -I src/libutil -I src/libstore -I src/libmain -I src/libexpr -O0 diff --git a/src/boost/format/Makefile.new b/src/boost/format/Makefile.new index 28b66bd62d60..bbc90ca76cb5 100644 --- a/src/boost/format/Makefile.new +++ b/src/boost/format/Makefile.new @@ -1,5 +1,5 @@ LIBS += libformat -libformat_DIR := $(here) +libformat_DIR := $(d) libformat_SOURCES = format_implementation.cc free_funcs.cc parsing.cc diff --git a/src/libexpr/Makefile.new b/src/libexpr/Makefile.new index 566436584178..3fd4fc7b2161 100644 --- a/src/libexpr/Makefile.new +++ b/src/libexpr/Makefile.new @@ -1,14 +1,14 @@ LIBS += libexpr -libexpr_DIR := $(here) +libexpr_DIR := $(d) libexpr_SOURCES = \ nixexpr.cc eval.cc primops.cc lexer-tab.cc parser-tab.cc \ get-drvs.cc attr-path.cc value-to-xml.cc value-to-json.cc \ common-opts.cc names.cc -$(here)parser-tab.cc $(here)parser-tab.hh: $(here)parser.y - bison -v -o $(here)parser-tab.cc $< -d +$(d)/parser-tab.cc $(d)/parser-tab.hh: $(d)/parser.y + bison -v -o $(libexpr_DIR)/parser-tab.cc $< -d -$(here)lexer-tab.cc $(here)lexer-tab.hh: $(here)lexer.l - flex --outfile $(here)lexer-tab.cc --header-file=$(here)lexer-tab.hh $< +$(d)/lexer-tab.cc $(d)/lexer-tab.hh: $(d)/lexer.l + flex --outfile $(libexpr_DIR)/lexer-tab.cc --header-file=$(libexpr_DIR)/lexer-tab.hh $< diff --git a/src/libmain/Makefile.new b/src/libmain/Makefile.new index 1f74cea9c9a7..b198d78422b7 100644 --- a/src/libmain/Makefile.new +++ b/src/libmain/Makefile.new @@ -1,6 +1,6 @@ LIBS += libmain -libmain_DIR := $(here) +libmain_DIR := $(d) libmain_SOURCES = shared.cc stack.cc diff --git a/src/libstore/Makefile.new b/src/libstore/Makefile.new index 7b08af047e2c..2eb34b7b4252 100644 --- a/src/libstore/Makefile.new +++ b/src/libstore/Makefile.new @@ -1,6 +1,6 @@ LIBS += libstore -libstore_DIR := $(here) +libstore_DIR := $(d) libstore_SOURCES = \ store-api.cc local-store.cc remote-store.cc derivations.cc build.cc misc.cc \ diff --git a/src/libutil/Makefile.new b/src/libutil/Makefile.new index b90c1c0cab4d..88d43f0aeb62 100644 --- a/src/libutil/Makefile.new +++ b/src/libutil/Makefile.new @@ -1,10 +1,11 @@ LIBS += libutil -libutil_DIR := $(here) +libutil_DIR := $(d) -libutil_SOURCES = util.cc hash.cc serialise.cc archive.cc xml-writer.cc affinity.cc \ - md5.c sha1.c sha256.c +libutil_SOURCES = util.cc hash.cc serialise.cc archive.cc xml-writer.cc affinity.cc -# FIXME: md5.c et al. should only be built when we don't have OpenSSL. +ifneq ($(HAVE_OPENSSL), 1) +libutil_SOURCES += md5.c sha1.c sha256.c +endif libutil_LIBS = src/boost/format/libformat diff --git a/src/nix-daemon/Makefile.new b/src/nix-daemon/Makefile.new index a2d98e790557..2a8a7d92cd26 100644 --- a/src/nix-daemon/Makefile.new +++ b/src/nix-daemon/Makefile.new @@ -1,6 +1,6 @@ PROGRAMS += nix-daemon -nix-daemon_DIR := $(here) +nix-daemon_DIR := $(d) nix-daemon_SOURCES = nix-daemon.cc diff --git a/src/nix-env/Makefile.new b/src/nix-env/Makefile.new index 5c92274f3c61..303af603afa3 100644 --- a/src/nix-env/Makefile.new +++ b/src/nix-env/Makefile.new @@ -1,6 +1,6 @@ PROGRAMS += nix-env -nix-env_DIR := $(here) +nix-env_DIR := $(d) nix-env_SOURCES = nix-env.cc profiles.cc profiles.hh user-env.cc user-env.hh diff --git a/src/nix-hash/Makefile.new b/src/nix-hash/Makefile.new index 87aba716cba4..462cd78d8c26 100644 --- a/src/nix-hash/Makefile.new +++ b/src/nix-hash/Makefile.new @@ -1,6 +1,6 @@ PROGRAMS += nix-hash -nix-hash_DIR := $(here) +nix-hash_DIR := $(d) nix-hash_SOURCES = nix-hash.cc diff --git a/src/nix-instantiate/Makefile.new b/src/nix-instantiate/Makefile.new index 71e40706ae62..9c4cfec287d9 100644 --- a/src/nix-instantiate/Makefile.new +++ b/src/nix-instantiate/Makefile.new @@ -1,6 +1,6 @@ PROGRAMS += nix-instantiate -nix-instantiate_DIR := $(here) +nix-instantiate_DIR := $(d) nix-instantiate_SOURCES = nix-instantiate.cc diff --git a/src/nix-store/Makefile.new b/src/nix-store/Makefile.new index 195d05a2d611..0b31f3a36735 100644 --- a/src/nix-store/Makefile.new +++ b/src/nix-store/Makefile.new @@ -1,6 +1,6 @@ PROGRAMS += nix-store -nix-store_DIR := $(here) +nix-store_DIR := $(d) nix-store_SOURCES = nix-store.cc dotgraph.cc xmlgraph.cc |