Changeset 2429 for trunk/kBuild


Ignore:
Timestamp:
Nov 16, 2010, 4:20:59 PM (15 years ago)
Author:
bird
Message:

footer.kmk: Workaround for ticket #99. Ref #99.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/footer.kmk

    r2413 r2429  
    986986#
    987987
    988 if1of ($(KMK_FEATURES), kb-exp-tmpl)
    989  $(kb-exp-tmpl 1,$(_ALL_TARGET_TARGETS),$(KBUILD_TARGET),$(KBUILD_TARGET_ARCH),$(KBUILD_TARGET_CPU),$(KBUILD_TYPE))
    990  $(kb-exp-tmpl 1,$(_ALL_HOST_TARGETS),$(KBUILD_HOST),$(KBUILD_HOST_ARCH),$(KBUILD_HOST_CPU),$(KBUILD_TYPE))
    991 
    992 else  # !kb-exp-tmpl
    993 
    994 ## Inherit one template property in a non-accumulative manner.
    995 # @param    $(prop)     Property name
    996 # @param    $(target)   Target name
    997 # @todo fix the precedence order for some properties.
    998 define def_inherit_template_one
    999 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
    1000 ifndef $(target)_$(prop)
    1001 $(target)_$(prop) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
    1002 endif
    1003 endif
    1004 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
    1005 ifndef $(target)_$(prop).$(bld_trg)
    1006 $(target)_$(prop).$(bld_trg) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
    1007 endif
    1008 endif
    1009 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
    1010 ifndef $(target)_$(prop).$(bld_trg).$(bld_trg_arch)
    1011 $(target)_$(prop).$(bld_trg).$(bld_trg_arch) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
    1012 endif
    1013 endif
    1014 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
    1015 ifndef $(target)_$(prop).$(bld_trg_arch)
    1016 $(target)_$(prop).$(bld_trg_arch) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
    1017 endif
    1018 endif
    1019 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
    1020 ifndef $(target)_$(prop).$(bld_trg_cpu)
    1021 $(target)_$(prop).$(bld_trg_cpu) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
    1022 endif
    1023 endif
    1024 endef
    1025 
    1026 ## Inherit one template property in a non-accumulative manner, deferred expansion.
    1027 # @param    1: $(prop)     Property name
    1028 # @param    2: $(target)        Target name
    1029 # @todo fix the precedence order for some properties.
    1030 # @remark this define relies on double evaluation
    1031 define def_inherit_template_one_deferred
    1032 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
    1033 ifndef $(target)_$(prop)
    1034 $(target)_$(prop) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
    1035 endif
    1036 endif
    1037 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
    1038 ifndef $(target)_$(prop).$(bld_trg)
    1039 $(target)_$(prop).$(bld_trg) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
    1040 endif
    1041 endif
    1042 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
    1043 ifndef $(target)_$(prop).$(bld_trg).$(bld_trg_arch)
    1044 $(target)_$(prop).$(bld_trg).$(bld_trg_arch) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
    1045 endif
    1046 endif
    1047 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
    1048 ifndef $(target)_$(prop).$(bld_trg_arch)
    1049 $(target)_$(prop).$(bld_trg_arch) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
    1050 endif
    1051 endif
    1052 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
    1053 ifndef $(target)_$(prop).$(bld_trg_cpu)
    1054 $(target)_$(prop).$(bld_trg_cpu) = $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
    1055 endif
    1056 endif
    1057 endef
    1058 
    1059 ## Inherit one acculumlative template property where the 'most significant' items are at the left end.
    1060 # @param    $(prop)     Property name
    1061 # @param    $(target)   Target name
    1062 define def_inherit_template_one_accumulate_l
    1063 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
    1064  ifeq ($$(flavor $(target)_$(prop)),simple)
    1065  $$(evalcall2 def_simple_2_recursive,$(target)_$(prop))
    1066  endif
    1067 $(target)_$(prop) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
    1068 endif
    1069 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE)
    1070  ifeq ($$(flavor $(target)_$(prop).$(KBUILD_TYPE)),simple)
    1071  $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(KBUILD_TYPE))
    1072  endif
    1073 $(target)_$(prop).$(KBUILD_TYPE) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE))
    1074 endif
    1075 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
    1076  ifeq ($$(flavor $(target)_$(prop).$(bld_trg)),simple)
    1077  $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg))
    1078  endif
    1079 $(target)_$(prop).$(bld_trg) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
    1080 endif
    1081 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
    1082  ifeq ($$(flavor $(target)_$(prop).$(bld_trg).$(bld_trg_arch)),simple)
    1083  $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg).$(bld_trg_arch))
    1084  endif
    1085 $(target)_$(prop).$(bld_trg).$(bld_trg_arch) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
    1086 endif
    1087 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
    1088  ifeq ($$(flavor $(target)_$(prop).$(bld_trg_cpu)),simple)
    1089  $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg_cpu))
    1090  endif
    1091 $(target)_$(prop).$(bld_trg_cpu) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
    1092 endif
    1093 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
    1094  ifeq ($$(flavor $(target)_$(prop).$(bld_trg_arch)),simple)
    1095  $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg_arch))
    1096  endif
    1097 $(target)_$(prop).$(bld_trg_arch) += $$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
    1098 endif
    1099 endef
    1100 
    1101 ## Inherit one acculumlative template property where the 'most significant' items are at the right end.
    1102 # @param    $(prop)     Property name
    1103 # @param    $(target)   Target name
    1104 define def_inherit_template_one_accumulate_r
    1105 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
    1106  ifeq ($$(flavor $(target)_$(prop)),simple)
    1107  $$(evalcall2 def_simple_2_recursive,$(target)_$(prop))
    1108  endif
    1109 $(target)_$(prop) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
    1110 endif
    1111 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE)
    1112  ifeq ($$(flavor $(target)_$(prop).$(KBUILD_TYPE)),simple)
    1113  $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(KBUILD_TYPE))
    1114  endif
    1115 $(target)_$(prop).$(KBUILD_TYPE) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(KBUILD_TYPE))
    1116 endif
    1117 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg)
    1118  ifeq ($$(flavor $(target)_$(prop).$(bld_trg)),simple)
    1119  $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg))
    1120  endif
    1121 $(target)_$(prop).$(bld_trg) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg))
    1122 endif
    1123 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch)
    1124  ifeq ($$(flavor $(target)_$(prop).$(bld_trg).$(bld_trg_arch)),simple)
    1125  $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg).$(bld_trg_arch))
    1126  endif
    1127 $(target)_$(prop).$(bld_trg).$(bld_trg_arch) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg).$(bld_trg_arch))
    1128 endif
    1129 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu)
    1130  ifeq ($$(flavor $(target)_$(prop).$(bld_trg_cpu)),simple)
    1131  $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg_cpu))
    1132  endif
    1133 $(target)_$(prop).$(bld_trg_cpu) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_cpu))
    1134 endif
    1135 ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch)
    1136  ifeq ($$(flavor $(target)_$(prop).$(bld_trg_arch)),simple)
    1137  $$(evalcall2 def_simple_2_recursive,$(target)_$(prop).$(bld_trg_arch))
    1138  endif
    1139 $(target)_$(prop).$(bld_trg_arch) <=$$(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(bld_trg_arch))
    1140 endif
    1141 endef
    1142 
    1143 
    1144 ## Inherit template properties for on target.
    1145 # @param    $(target)    Target name.
    1146 define def_inherit_template
    1147 # sanity check.
    1148 ifdef _$(target)_ALREADY_PROCESSED
    1149  $(error kBuild: The target $(target) appears more than once in the target lists! Please correct the makefile(s))
    1150 endif
    1151 _$(target)_ALREADY_PROCESSED := 1
    1152 
    1153 # Inherit any default template.
    1154 ifdef TEMPLATE
    1155 ifeq ($($(target)_TEMPLATE),)
    1156 $(eval $(target)_TEMPLATE:=$(TEMPLATE))
    1157 endif
    1158 endif
    1159 # Expand the template if specified.
    1160 ifneq ($($(target)_TEMPLATE),)
    1161 $(foreach prop,$(PROPS_SINGLE),$(evalval def_inherit_template_one))
    1162 $(foreach prop,$(PROPS_DEFERRED),$(eval $(def_inherit_template_one_deferred))) # exploits the 2 evaluation, so no value!
    1163 $(foreach prop,$(PROPS_ACCUMULATE_L),$(eval $(def_inherit_template_one_accumulate_l))) # += works fine without value
    1164 $(foreach prop,$(PROPS_ACCUMULATE_R),$(eval $(def_inherit_template_one_accumulate_r))) # use <= (kmk addition)
    1165 endif
    1166 endef
    1167 $(eval-opt-var def_inherit_template)
    1168 
    1169 # Inherit template properties
    1170 bld_trg := $(KBUILD_TARGET)
    1171 bld_trg_arch := $(KBUILD_TARGET_ARCH)
    1172 bld_trg_cpu := $(KBUILD_TARGET_CPU)
    1173 $(foreach target, $(_ALL_TARGET_TARGETS),$(evalval def_inherit_template))
    1174 
    1175 bld_trg := $(KBUILD_HOST)
    1176 bld_trg_arch := $(KBUILD_HOST_ARCH)
    1177 bld_trg_cpu := $(KBUILD_HOST_CPU)
    1178 $(foreach target, $(_ALL_HOST_TARGETS),$(evalval def_inherit_template))
    1179 
    1180 endif # !kb-exp-tmpl
     988define def_inherit_template_workaround_target
     989local _tmpl         := $(firstword $($(target)_TEMPLATE) $(TEMPLATE))
     990local _bld_type     := $(firstword $($(target)_BLD_TYPE)     $(TEMPLATE_$(tmpl)_BLD_TYPE)     $(KBUILD_TYPE))
     991local _bld_trg      := $(firstword $($(target)_BLD_TRG)      $(TEMPLATE_$(tmpl)_BLD_TRG)      $(KBUILD_TARGET))
     992local _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(TEMPLATE_$(tmpl)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
     993local _bld_trg_cpu  := $(firstword $($(target)_BLD_TRG_CPU)  $(TEMPLATE_$(tmpl)_BLD_TRG_CPU)  $(KBUILD_TARGET_CPU))
     994$(kb-exp-tmpl 1,$(target),$(_bld_trg),$(_bld_trg_arch),$(_bld_trg_cpu),$(_bld_type))
     995endef # def_inherit_template_workaround_target
     996#$(kb-exp-tmpl 1,$(_ALL_TARGET_TARGETS),$(KBUILD_TARGET),$(KBUILD_TARGET_ARCH),$(KBUILD_TARGET_CPU),$(KBUILD_TYPE))
     997$(foreach target,$(_ALL_TARGET_TARGETS),$(evalval def_inherit_template_workaround_target))
     998
     999define def_inherit_template_workaround_host
     1000local _tmpl         := $(firstword $($(target)_TEMPLATE) $(TEMPLATE))
     1001local _bld_type     := $(firstword $($(target)_BLD_TYPE)     $(TEMPLATE_$(tmpl)_BLD_TYPE)     $(KBUILD_TYPE))
     1002local _bld_trg      := $(firstword $($(target)_BLD_TRG)      $(TEMPLATE_$(tmpl)_BLD_TRG)      $(KBUILD_HOST))
     1003local _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(TEMPLATE_$(tmpl)_BLD_TRG_ARCH) $(KBUILD_HOST_ARCH))
     1004local _bld_trg_cpu  := $(firstword $($(target)_BLD_TRG_CPU)  $(TEMPLATE_$(tmpl)_BLD_TRG_CPU)  $(KBUILD_HOST_CPU))
     1005$(kb-exp-tmpl 1,$(target),$(_bld_trg),$(_bld_trg_arch),$(_bld_trg_cpu),$(_bld_type))
     1006endef # def_inherit_template_workaround_target
     1007#$(kb-exp-tmpl 1,$(_ALL_HOST_TARGETS),$(KBUILD_HOST),$(KBUILD_HOST_ARCH),$(KBUILD_HOST_CPU),$(KBUILD_TYPE))
     1008$(foreach target,$(_ALL_HOST_TARGETS),$(evalval def_inherit_template_workaround_host))
     1009
    11811010ifdef KBUILD_PROFILE_SELF
    11821011 $(evalcall def_profile_self, done template/target expansion)
Note: See TracChangeset for help on using the changeset viewer.