about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-22T16·45+0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-22T16·45+0000
commit754c05ed6c3b88f8180ae8686e030b5b02b23d43 (patch)
treec7f8238ee141c0564823122c52fed070ea8f2c0b
parent9a14d5e2f3a0b6ab626b9d22256df8bcc1c585a3 (diff)
Rename $(here) to $(d) for brevity, and remove trailing slash
-rw-r--r--Makefile.lib26
-rw-r--r--Makefile.new27
-rw-r--r--src/boost/format/Makefile.new2
-rw-r--r--src/libexpr/Makefile.new10
-rw-r--r--src/libmain/Makefile.new2
-rw-r--r--src/libstore/Makefile.new2
-rw-r--r--src/libutil/Makefile.new9
-rw-r--r--src/nix-daemon/Makefile.new2
-rw-r--r--src/nix-env/Makefile.new2
-rw-r--r--src/nix-hash/Makefile.new2
-rw-r--r--src/nix-instantiate/Makefile.new2
-rw-r--r--src/nix-store/Makefile.new2
12 files changed, 49 insertions, 39 deletions
diff --git a/Makefile.lib b/Makefile.lib
index b6d31e7ce8..f2eea7ac81 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 ea4096cc1c..af2c4cec3c 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 28b66bd62d..bbc90ca76c 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 5664365841..3fd4fc7b21 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 1f74cea9c9..b198d78422 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 7b08af047e..2eb34b7b42 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 b90c1c0cab..88d43f0aeb 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 a2d98e7905..2a8a7d92cd 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 5c92274f3c..303af603af 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 87aba716cb..462cd78d8c 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 71e40706ae..9c4cfec287 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 195d05a2d6..0b31f3a367 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