about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-22T15·42+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-22T15·42+0100
commit62e35cc3a893e3bc4ed1fe2a37ba67af9859b4cb (patch)
treedb19bba388dfc3808647d878dc32633bb0e73ecd
parenteff6c4b791ad0a8b9a8499fcbcc2add7154d4dca (diff)
Add ‘make dist’ support
-rw-r--r--Makefile.config.in3
-rw-r--r--Makefile.lib24
-rw-r--r--src/libstore/Makefile.new2
3 files changed, 23 insertions, 6 deletions
diff --git a/Makefile.config.in b/Makefile.config.in
index 3bb8cdda48ba..25e537bcca07 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -1,4 +1,5 @@
-VERSION = @VERSION@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
 bindir = @bindir@
 datadir = @datadir@
 datarootdir = @datarootdir@
diff --git a/Makefile.lib b/Makefile.lib
index 79078c83be35..c7880ff11421 100644
--- a/Makefile.lib
+++ b/Makefile.lib
@@ -16,7 +16,8 @@ libs_list :=
 
 define LIBS_template =
   _d := $$($(1)_DIR)
-  _objs := $$(foreach src, $$($(1)_SOURCES), $$(_d)$$(basename $$(src)).o)
+  _srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)$$(src))
+  _objs := $$(addsuffix .o, $$(basename $$(_srcs)))
   _libs := $$(foreach lib, $$($(1)_LIBS), $$(lib).a)
   _lib := $$(_d)$(1).a
 
@@ -28,8 +29,9 @@ define LIBS_template =
 
   include $$(wildcard $$(_d)/*.dep)
 
-  clean_list += $$(_d)*.a $$(_d)*.o $$(_d)*.dep
   libs_list += $$(_lib)
+  clean_list += $$(_d)*.a $$(_d)*.o $$(_d)*.dep
+  dist_files += $$(_srcs)
 endef
 
 
@@ -38,7 +40,8 @@ programs_list :=
 
 define PROGRAMS_template =
   _d := $$($(1)_DIR)
-  _objs := $$(foreach src, $$($(1)_SOURCES), $$(_d)$$(basename $$(src)).o)
+  _srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)$$(src))
+  _objs := $$(addsuffix .o, $$(basename $$(_srcs)))
   _libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_DIR)$$(lib).a)
   _prog := $$(_d)$(1)
 
@@ -48,11 +51,24 @@ define PROGRAMS_template =
   # Propagate CXXFLAGS to the individual object files.
   $$(foreach obj, $$(_objs), $$(eval $$(obj)_CXXFLAGS=$$($(1)_CXXFLAGS)))
 
-  clean_list += $$(_prog) $$(_d)*.o $$(_d)*.dep
+  include $$(wildcard $$(_d)/*.dep)
+
   programs_list += $$(_prog)
+  clean_list += $$(_prog) $$(_d)*.o $$(_d)*.dep
+  dist_files += $$(_srcs)
 endef
 
 
+# Distributing stuff.
+dist_files :=
+
+dist_name = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+
+dist:
+	@echo $(dist_files)
+	$(QUIET) tar cvfj $(dist_name).tar.bz2 $(dist_files) --transform 's,^,$(dist_name)/,'
+
+
 # Cleaning stuff.
 clean_list :=
 
diff --git a/src/libstore/Makefile.new b/src/libstore/Makefile.new
index 24011c244349..7b08af047e2c 100644
--- a/src/libstore/Makefile.new
+++ b/src/libstore/Makefile.new
@@ -16,4 +16,4 @@ libstore_CXXFLAGS = \
  -DNIX_CONF_DIR=\"$(sysconfdir)/nix\" \
  -DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \
  -DNIX_BIN_DIR=\"$(bindir)\" \
- -DNIX_VERSION=\"$(VERSION)\"
+ -DNIX_VERSION=\"$(PACKAGE_VERSION)\"