From bada6666c70977a058755ccf232e7d67b24adeed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 23 Jul 2014 15:21:29 +0200 Subject: New upstream release --- build-0.3/bootstrap.make | 88 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 66 insertions(+), 22 deletions(-) (limited to 'build-0.3/bootstrap.make') diff --git a/build-0.3/bootstrap.make b/build-0.3/bootstrap.make index c45f952..44eb57e 100644 --- a/build-0.3/bootstrap.make +++ b/build-0.3/bootstrap.make @@ -1,10 +1,7 @@ # file : build/bootstrap.make -# author : Boris Kolpackov -# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC +# copyright : Copyright (c) 2004-2012 Code Synthesis Tools CC # license : GNU GPL v2; see accompanying LICENSE file - - # First time bootstrap.make is read # ifndef %makefile% @@ -61,7 +58,16 @@ export MAKE # also it will be consistent. # -%makefile% := $(abspath $(firstword $(MAKEFILE_LIST))) +# By convention, the makefile name is the second or third last word from +# the end. If it is the third, then the second one should be end with +# bootstrap.make +# +%makefile% := $(subst $(lastword $(MAKEFILE_LIST)),,$(MAKEFILE_LIST)) +ifneq ($(filter %bootstrap.make,$(lastword $(%makefile%))),) +%makefile% := $(subst $(lastword $(%makefile%)),,$(%makefile%)) +endif +%makefile% := $(abspath $(lastword $(%makefile%))) + %makefile_realpath% := $(realpath $(%makefile%)) @@ -91,21 +97,21 @@ $(call include-search-dirs,$1,$(wordlist 2,$(words $2),$2)))) endef # Test if $1 is a 'foreign' makefile, i.e., does not reside in -# src_root, out_root, or bld_root. +# src_root, out_root, or bld_root. Use shadows for src and out +# roots to catch cases where these were reset before inclusion. +# This happens in import stubs. # %frame_exclude% += include-test-foreign define include-test-foreign -$(if $(%foreign%),t,\ -$(if $(filter $(bld_root)/% $(src_root)/% $(out_root)/%,$1),,t)) +$(if $(%foreign%),t,$(if $(filter $(bld_root)/% $(src_root_shadow)/% $(out_root_shadow)/%,$1),,t)) endef - %frame_exclude% += include-body define include-body %interactive% := %makefile% := $(call include-find-makefile,$2) -%makefile_realpath% := $(realpath $(%makefile%)) -%foreign% := $(call include-test-foreign,$(%makefile%)) +%makefile_realpath% := $$(realpath $$(%makefile%)) +%foreign% := $$(call include-test-foreign,$$(%makefile%)) $1 $$(if $$(%makefile%),$$(%makefile%),$2) @@ -154,7 +160,7 @@ define include-once-file-body %interactive% := %makefile% := $2 %makefile_realpath% := $(realpath $2) -%foreign% := $(call include-test-foreign,$(%makefile%)) +%foreign% := $$(call include-test-foreign,$$(%makefile%)) %included_files% += $$(%makefile_realpath%) @@ -185,7 +191,7 @@ define include-once-value-body %interactive% := %makefile% := $2 %makefile_realpath% := $(realpath $2) -%foreign% := $(call include-test-foreign,$(%makefile%)) +%foreign% := $$(call include-test-foreign,$$(%makefile%)) %include_once_$$(%makefile_realpath%)% += $7 @@ -257,7 +263,10 @@ src_base := $(abspath $(dir $(%makefile%))) ifneq ($(src_root),$(src_base)) -ifeq ($(origin out_root),undefined) +# In recursive make invocation, out_root may come from the environment +# in which case we need to override it. +# +ifneq ($(origin out_root),file) out_root := $(abspath $(patsubst \ %$(subst $(src_root)/,,$(src_base)),%,$(CURDIR))) endif @@ -266,7 +275,10 @@ out_base := $(out_root)/$(subst $(src_root)/,,$(src_base)) else -ifeq ($(origin out_root),undefined) +# In recursive make invocation, out_root may come from the environment +# in which case we need to override it. +# +ifneq ($(origin out_root),file) out_root := $(abspath $(CURDIR)) endif @@ -277,15 +289,20 @@ endif scf_root := $(src_root)/build dcf_root := $(out_root)/build +src_root_shadow := $(src_root) +out_root_shadow := $(out_root) + $(out_root)/%: export out_root := $(out_root) $(out_root)/%: export src_root := $(src_root) $(out_root)/%: export scf_root := $(scf_root) $(out_root)/%: export dcf_root := $(dcf_root) $(out_root)/%: export project_name := $(project_name) +# @@ Why do I need out_root here? +# $(out_base)/%: out_root := $(out_root) -$(out_base)/%: out_base := $(out_base) -$(out_base)/%: src_base := $(src_base) +$(out_base)/%: export out_base := $(out_base) +$(out_base)/%: export src_base := $(src_base) ifdef build_debug @@ -324,18 +341,45 @@ ifneq ($(bld_root),$(scf_root)) $(call -include,$(scf_root)/configuration-static.make) endif - # `disfigure' target. # .PHONY: disfigure +.PHONY: $(dcf_root)/.disfigure $(out_root)/.disfigure disfigure:: $(build_absolute_clean_target) +disfigure:: $(dcf_root)/.disfigure +disfigure:: $(out_root)/.disfigure + +ifneq ($(out_root),$(out_base)) +.PHONY: $(out_base)/.disfigure +$(out_root)/.disfigure:: $(out_base)/.disfigure +endif -#@@ Is there a better way? +# Clean up generated makefiles. # -ifeq ($(.DEFAULT_GOAL),disfigure) -.DEFAULT_GOAL := +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.2.3