diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-03-27 13:39:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-03-27 13:39:08 +0200 |
commit | 794a56f1f6d986b04651b4ab7aa04f6e2fbb9972 (patch) | |
tree | 0b0ee748d03da09dbb196e2b31722a26952f7aac /build/bootstrap.make | |
parent | f12616d9bbf7bdd7868e583298ef4120921db5dc (diff) |
Add on-the-fly thunk makefile generation support for out_root != src_root
Diffstat (limited to 'build/bootstrap.make')
-rw-r--r-- | build/bootstrap.make | 47 |
1 files changed, 40 insertions, 7 deletions
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 |