From ed0a8dd71ad58d16c24d714ab2b9419285d1ffc0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 25 Nov 2013 10:16:07 +0000 Subject: [PATCH] Add a function for instantiating Autoconf *.in files --- corepkgs/Makefile.new | 2 ++ mk/lib.mk | 8 ++++---- mk/templates.mk | 8 ++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 mk/templates.mk diff --git a/corepkgs/Makefile.new b/corepkgs/Makefile.new index d20847825..5b500a679 100644 --- a/corepkgs/Makefile.new +++ b/corepkgs/Makefile.new @@ -1,3 +1,5 @@ corepkgs_FILES = nar.nix buildenv.nix buildenv.pl unpack-channel.nix derivation.nix fetchurl.nix imported-drv-to-derivation.nix $(foreach file,config.nix $(corepkgs_FILES),$(eval $(call install-file-in,$(datadir)/nix/corepkgs,$(d)/$(file)))) + +template_files += $(d)/config.nix diff --git a/mk/lib.mk b/mk/lib.mk index 212336cad..b4a2fb265 100644 --- a/mk/lib.mk +++ b/mk/lib.mk @@ -2,9 +2,7 @@ default: all # Include Autoconf variables. -Makefile.config: Makefile.config.in - ./config.status --file $@ - +template_files += Makefile.config include Makefile.config @@ -33,6 +31,7 @@ include mk/install.mk include mk/libraries.mk include mk/programs.mk include mk/patterns.mk +include mk/templates.mk # Include all sub-Makefiles. @@ -44,9 +43,10 @@ endef $(foreach mf, $(SUBS), $(eval $(call include-sub-makefile, $(mf)))) -# Instantiate libraries and programs. +# Instantiate stuff. $(foreach lib, $(LIBS), $(eval $(call build-library,$(lib)))) $(foreach prog, $(PROGRAMS), $(eval $(call build-program,$(prog)))) +$(foreach template, $(template_files), $(eval $(call instantiate-template,$(template)))) all: $(programs_list) diff --git a/mk/templates.mk b/mk/templates.mk new file mode 100644 index 000000000..3575b6d95 --- /dev/null +++ b/mk/templates.mk @@ -0,0 +1,8 @@ +# Create the file $(1) from $(1).in by running config.status (which +# substitutes all ‘@var@’ variables set by the configure script). +define instantiate-template = + + $(1): $(1).in + ./config.status --file $(1) + +endef