From 794a56f1f6d986b04651b4ab7aa04f6e2fbb9972 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 27 Mar 2011 13:39:08 +0200 Subject: Add on-the-fly thunk makefile generation support for out_root != src_root --- build/bootstrap.make | 47 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-) (limited to 'build/bootstrap.make') diff --git a/build/bootstrap.make b/build/bootstrap.make index c9d1e97..f40850f 100644 --- a/build/bootstrap.make +++ b/build/bootstrap.make @@ -61,7 +61,12 @@ export MAKE # also it will be consistent. # -%makefile% := $(abspath $(firstword $(MAKEFILE_LIST))) +# By convention, the makefile name is the third last word from the end. +# +%makefile% := $(subst $(lastword $(MAKEFILE_LIST)),,$(MAKEFILE_LIST)) +%makefile% := $(subst $(lastword $(%makefile%)),,$(%makefile%)) +%makefile% := $(abspath $(lastword $(%makefile%))) + %makefile_realpath% := $(realpath $(%makefile%)) @@ -327,17 +332,45 @@ ifneq ($(bld_root),$(scf_root)) $(call -include,$(scf_root)/configuration-static.make) endif - # `disfigure' target. # .PHONY: disfigure -.PHONY: $(dcf_root)/.disfigure +.PHONY: $(dcf_root)/.disfigure $(out_root)/.disfigure -disfigure:: $(build_absolute_clean_target) $(dcf_root)/.disfigure +disfigure:: $(build_absolute_clean_target) +disfigure:: $(dcf_root)/.disfigure +disfigure:: $(out_root)/.disfigure -ifeq ($(.DEFAULT_GOAL),disfigure) -.DEFAULT_GOAL := +ifneq ($(out_root),$(out_base)) +.PHONY: $(out_base)/.disfigure +$(out_root)/.disfigure:: $(out_base)/.disfigure +endif + +# Clean up generated makefiles. +# +ifndef %foreign% +ifneq ($(out_root),$(src_root)) +$(out_base)/.disfigure:: + $(call message, rm $$1,rm -f $$1,$(out_base)/makefile) +endif endif -# Dynamic configuration. +# Dynamic configuration (interactive check is to make sure we only do +# this once). # +ifdef %interactive% +ifneq ($(out_root),$(src_root)) + +$(call -include,$(dcf_root)/bootstrap-dynamic.make) + +$(dcf_root)/bootstrap-dynamic.make: | $(dcf_root)/. + $(call message,,echo "src_root := $(src_root)" >$@) + +$(dcf_root)/.disfigure:: + $(call message, rm $$1,rm -f $$1,$(dcf_root)/bootstrap-dynamic.make) +endif +endif + +ifeq ($(.DEFAULT_GOAL),disfigure) +.DEFAULT_GOAL := +endif -- cgit v1.1