Add a function for instantiating Autoconf *.in files

This commit is contained in:
Eelco Dolstra 2013-11-25 10:16:07 +00:00
parent f980755766
commit ed0a8dd71a
3 changed files with 14 additions and 4 deletions

View file

@ -1,3 +1,5 @@
corepkgs_FILES = nar.nix buildenv.nix buildenv.pl unpack-channel.nix derivation.nix fetchurl.nix imported-drv-to-derivation.nix 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)))) $(foreach file,config.nix $(corepkgs_FILES),$(eval $(call install-file-in,$(datadir)/nix/corepkgs,$(d)/$(file))))
template_files += $(d)/config.nix

View file

@ -2,9 +2,7 @@ default: all
# Include Autoconf variables. # Include Autoconf variables.
Makefile.config: Makefile.config.in template_files += Makefile.config
./config.status --file $@
include Makefile.config include Makefile.config
@ -33,6 +31,7 @@ include mk/install.mk
include mk/libraries.mk include mk/libraries.mk
include mk/programs.mk include mk/programs.mk
include mk/patterns.mk include mk/patterns.mk
include mk/templates.mk
# Include all sub-Makefiles. # Include all sub-Makefiles.
@ -44,9 +43,10 @@ endef
$(foreach mf, $(SUBS), $(eval $(call include-sub-makefile, $(mf)))) $(foreach mf, $(SUBS), $(eval $(call include-sub-makefile, $(mf))))
# Instantiate libraries and programs. # Instantiate stuff.
$(foreach lib, $(LIBS), $(eval $(call build-library,$(lib)))) $(foreach lib, $(LIBS), $(eval $(call build-library,$(lib))))
$(foreach prog, $(PROGRAMS), $(eval $(call build-program,$(prog)))) $(foreach prog, $(PROGRAMS), $(eval $(call build-program,$(prog))))
$(foreach template, $(template_files), $(eval $(call instantiate-template,$(template))))
all: $(programs_list) all: $(programs_list)

8
mk/templates.mk Normal file
View file

@ -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