Add ‘make dist’ support

This commit is contained in:
Eelco Dolstra 2013-11-22 16:42:25 +01:00
parent eff6c4b791
commit 62e35cc3a8
3 changed files with 23 additions and 6 deletions

View file

@ -1,4 +1,5 @@
VERSION = @VERSION@ PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
bindir = @bindir@ bindir = @bindir@
datadir = @datadir@ datadir = @datadir@
datarootdir = @datarootdir@ datarootdir = @datarootdir@

View file

@ -16,7 +16,8 @@ libs_list :=
define LIBS_template = define LIBS_template =
_d := $$($(1)_DIR) _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) _libs := $$(foreach lib, $$($(1)_LIBS), $$(lib).a)
_lib := $$(_d)$(1).a _lib := $$(_d)$(1).a
@ -28,8 +29,9 @@ define LIBS_template =
include $$(wildcard $$(_d)/*.dep) include $$(wildcard $$(_d)/*.dep)
clean_list += $$(_d)*.a $$(_d)*.o $$(_d)*.dep
libs_list += $$(_lib) libs_list += $$(_lib)
clean_list += $$(_d)*.a $$(_d)*.o $$(_d)*.dep
dist_files += $$(_srcs)
endef endef
@ -38,7 +40,8 @@ programs_list :=
define PROGRAMS_template = define PROGRAMS_template =
_d := $$($(1)_DIR) _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) _libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_DIR)$$(lib).a)
_prog := $$(_d)$(1) _prog := $$(_d)$(1)
@ -48,11 +51,24 @@ define PROGRAMS_template =
# Propagate CXXFLAGS to the individual object files. # Propagate CXXFLAGS to the individual object files.
$$(foreach obj, $$(_objs), $$(eval $$(obj)_CXXFLAGS=$$($(1)_CXXFLAGS))) $$(foreach obj, $$(_objs), $$(eval $$(obj)_CXXFLAGS=$$($(1)_CXXFLAGS)))
clean_list += $$(_prog) $$(_d)*.o $$(_d)*.dep include $$(wildcard $$(_d)/*.dep)
programs_list += $$(_prog) programs_list += $$(_prog)
clean_list += $$(_prog) $$(_d)*.o $$(_d)*.dep
dist_files += $$(_srcs)
endef 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. # Cleaning stuff.
clean_list := clean_list :=

View file

@ -16,4 +16,4 @@ libstore_CXXFLAGS = \
-DNIX_CONF_DIR=\"$(sysconfdir)/nix\" \ -DNIX_CONF_DIR=\"$(sysconfdir)/nix\" \
-DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \ -DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \
-DNIX_BIN_DIR=\"$(bindir)\" \ -DNIX_BIN_DIR=\"$(bindir)\" \
-DNIX_VERSION=\"$(VERSION)\" -DNIX_VERSION=\"$(PACKAGE_VERSION)\"