| 1 | # $Id: footer-pass1.kmk 3121 2017-10-31 10:58:59Z bird $
 | 
|---|
| 2 | ## @file
 | 
|---|
| 3 | # kBuild - Footer - Target lists - Pass 1.
 | 
|---|
| 4 | #
 | 
|---|
| 5 | #       This pass is for defining variables that might be referenced in
 | 
|---|
| 6 | #       properties of other targets.
 | 
|---|
| 7 | #
 | 
|---|
| 8 | 
 | 
|---|
| 9 | #
 | 
|---|
| 10 | # Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
 | 
|---|
| 11 | #
 | 
|---|
| 12 | # This file is part of kBuild.
 | 
|---|
| 13 | #
 | 
|---|
| 14 | # kBuild is free software; you can redistribute it and/or modify
 | 
|---|
| 15 | # it under the terms of the GNU General Public License as published by
 | 
|---|
| 16 | # the Free Software Foundation; either version source of the License, or
 | 
|---|
| 17 | # (at your option) any later version.
 | 
|---|
| 18 | #
 | 
|---|
| 19 | # kBuild is distributed in the hope that it will be useful,
 | 
|---|
| 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
| 22 | # GNU General Public License for more details.
 | 
|---|
| 23 | #
 | 
|---|
| 24 | # You should have received a copy of the GNU General Public License
 | 
|---|
| 25 | # along with kBuild; if not, write to the Free Software
 | 
|---|
| 26 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|---|
| 27 | #
 | 
|---|
| 28 | #
 | 
|---|
| 29 | # As a special exception you are granted permission to include this file, via
 | 
|---|
| 30 | # the kmk include directive, as you wish without this in itself causing the
 | 
|---|
| 31 | # resulting makefile, program or whatever to be covered by the GPL license.
 | 
|---|
| 32 | # This exception does not however invalidate any other reasons why the makefile,
 | 
|---|
| 33 | # program, whatever should not be covered the GPL.
 | 
|---|
| 34 | #
 | 
|---|
| 35 | #
 | 
|---|
| 36 | 
 | 
|---|
| 37 | 
 | 
|---|
| 38 | # Don't do anything for fetch targets (yet).
 | 
|---|
| 39 | 
 | 
|---|
| 40 | ##
 | 
|---|
| 41 | # Link prolog for Pass 1.
 | 
|---|
| 42 | #
 | 
|---|
| 43 | # @param    $(target)           Normalized target name.
 | 
|---|
| 44 | # @param    $(EXT)              EXE,DLL,SYS,LIB.
 | 
|---|
| 45 | # @param    $(EXTPRE)           HOST or nothing.
 | 
|---|
| 46 | # @param    $(definst)          The default _INST value.
 | 
|---|
| 47 | # @param    $(tool_prefix)      LD or AR.
 | 
|---|
| 48 | # @param    $(bld_trg_base_var) TARGET or PLATFORM.
 | 
|---|
| 49 | define def_pass1_link_common
 | 
|---|
| 50 | 
 | 
|---|
| 51 | local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(KBUILD_TYPE))
 | 
|---|
| 52 | local bld_trg     := $(firstword $($(target)_BLD_TRG)      $(BUILD_$(bld_trg_base_var)))
 | 
|---|
| 53 | local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
 | 
|---|
| 54 | local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_$(bld_trg_base_var)_CPU))
 | 
|---|
| 55 | 
 | 
|---|
| 56 | local tool        := $(call _TARGET_TOOL,$(target),$(tool_prefix))
 | 
|---|
| 57 | local name        := $(firstword\
 | 
|---|
| 58 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| 59 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 60 |         $($(target)_NAME.$(bld_trg).$(bld_type))\
 | 
|---|
| 61 |         $($(target)_NAME.$(bld_trg_arch))\
 | 
|---|
| 62 |         $($(target)_NAME.$(bld_trg))\
 | 
|---|
| 63 |         $($(target)_NAME.$(bld_type))\
 | 
|---|
| 64 |         $($(target)_NAME)\
 | 
|---|
| 65 |         $(target))
 | 
|---|
| 66 | local outbase     := $(call TARGET_BASE,$(name),$(target))
 | 
|---|
| 67 | $(target)_0_OUTDIR:= $(patsubst %/,%,$(dir $(outbase)))
 | 
|---|
| 68 | $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
 | 
|---|
| 69 | 
 | 
|---|
| 70 | ## @todo fix the fun at the last line (AR != LIB => mess).
 | 
|---|
| 71 | local suff := $(firstword \
 | 
|---|
| 72 |         $($(target)_$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 73 |         $($(target)_$(EXT)SUFF.$(bld_trg))\
 | 
|---|
| 74 |         $($(target)_$(EXT)SUFF)\
 | 
|---|
| 75 |         $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 76 |         $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF.$(bld_trg))\
 | 
|---|
| 77 |         $(TOOL_$(tool)_$(tool_prefix)$(EXT)SUFF)\
 | 
|---|
| 78 |         $(if $(eq $(tool_prefix),AR),$(SUFF_LIB),$($(EXTPRE)SUFF_$(EXT))) )
 | 
|---|
| 79 | local out := $(outbase)$(suff)
 | 
|---|
| 80 | 
 | 
|---|
| 81 | # Object directory target variable.
 | 
|---|
| 82 | $(target)_1_TARGET := $(out)
 | 
|---|
| 83 | $(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
 | 
|---|
| 84 | 
 | 
|---|
| 85 | # Staging and install directory target variables.
 | 
|---|
| 86 | local insttype := $(firstword \
 | 
|---|
| 87 |         $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 88 |         $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 89 |         $($(target)_INSTTYPE.$(bld_trg).$(bld_type)) \
 | 
|---|
| 90 |         $($(target)_INSTTYPE.$(bld_trg_arch)) \
 | 
|---|
| 91 |         $($(target)_INSTTYPE.$(bld_trg_cpu)) \
 | 
|---|
| 92 |         $($(target)_INSTTYPE.$(bld_trg)) \
 | 
|---|
| 93 |         $($(target)_INSTTYPE.$(bld_type)) \
 | 
|---|
| 94 |         $($(target)_INSTTYPE) \
 | 
|---|
| 95 |         )
 | 
|---|
| 96 | ifeq ($(insttype),)
 | 
|---|
| 97 |  ifneq ($(firstword \
 | 
|---|
| 98 |         $($(target)_NOINST) \
 | 
|---|
| 99 |         $($(target)_NOINST.$(bld_trg)) \
 | 
|---|
| 100 |         $($(target)_NOINST.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 101 |         $($(target)_NOINST.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 102 |         $($(target)_NOINST.$(bld_trg_arch)) \
 | 
|---|
| 103 |         $($(target)_NOINST.$(bld_trg_cpu)) \
 | 
|---|
| 104 |         $($(target)_NOINST.$(bld_type)) ),)
 | 
|---|
| 105 |    local insttype := none
 | 
|---|
| 106 |  else
 | 
|---|
| 107 |    local insttype := both
 | 
|---|
| 108 |  endif
 | 
|---|
| 109 | endif
 | 
|---|
| 110 | $(target)_1_INSTTYPE := $(insttype)
 | 
|---|
| 111 | 
 | 
|---|
| 112 | local inst := $(strip $(firstdefined \
 | 
|---|
| 113 |         $(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
 | 
|---|
| 114 |         $(target)_INST.$(bld_trg).$(bld_trg_arch) \
 | 
|---|
| 115 |         $(target)_INST.$(bld_trg).$(bld_type) \
 | 
|---|
| 116 |         $(target)_INST.$(bld_trg_arch) \
 | 
|---|
| 117 |         $(target)_INST.$(bld_trg_cpu) \
 | 
|---|
| 118 |         $(target)_INST.$(bld_trg) \
 | 
|---|
| 119 |         $(target)_INST.$(bld_type) \
 | 
|---|
| 120 |         $(target)_INST \
 | 
|---|
| 121 |         definst \
 | 
|---|
| 122 |         ,value))
 | 
|---|
| 123 | local stage := $(strip $(firstdefined \
 | 
|---|
| 124 |         $(target)_STAGE.$(bld_trg).$(bld_trg_arch).$(bld_type) \
 | 
|---|
| 125 |         $(target)_STAGE.$(bld_trg).$(bld_trg_arch) \
 | 
|---|
| 126 |         $(target)_STAGE.$(bld_trg).$(bld_type) \
 | 
|---|
| 127 |         $(target)_STAGE.$(bld_trg_arch) \
 | 
|---|
| 128 |         $(target)_STAGE.$(bld_trg_cpu) \
 | 
|---|
| 129 |         $(target)_STAGE.$(bld_trg) \
 | 
|---|
| 130 |         $(target)_STAGE.$(bld_type) \
 | 
|---|
| 131 |         $(target)_STAGE \
 | 
|---|
| 132 |         inst \
 | 
|---|
| 133 |         ,value))
 | 
|---|
| 134 | if1of ($(insttype), stage both)
 | 
|---|
| 135 |  $(target)_1_STAGE := $(stage)
 | 
|---|
| 136 |  if "$(substr $(stage),-1,1)" == "/" # Multicast support requires addprefix/suffix.
 | 
|---|
| 137 |   $(target)_1_STAGE_TARGET := $(addprefix $(PATH_STAGE)/,$(addsuffix $(notdir $(out)),$(stage)))
 | 
|---|
| 138 |  else if "$(stage)" == ""
 | 
|---|
| 139 |   $(target)_1_STAGE_TARGET := $(PATH_STAGE)/$(notdir $(out))
 | 
|---|
| 140 |  else
 | 
|---|
| 141 |   $(target)_1_STAGE_TARGET := $(addprefix $(PATH_STAGE)/,$(stage))
 | 
|---|
| 142 |  endif
 | 
|---|
| 143 | else if1of ($(insttype), none)
 | 
|---|
| 144 |  $(target)_1_STAGE :=
 | 
|---|
| 145 |  $(target)_1_STAGE_TARGET :=
 | 
|---|
| 146 | else
 | 
|---|
| 147 |  $(error kBuild: Unknown value '$(insttype)' for '$(target)_INSTTYPE'. Valid values are 'none', 'both' and 'stage'.)
 | 
|---|
| 148 | endif
 | 
|---|
| 149 | INSTARGET_$(target) := $($(target)_1_STAGE_TARGET)
 | 
|---|
| 150 | 
 | 
|---|
| 151 | if1of ($(insttype), both)
 | 
|---|
| 152 |  $(target)_1_INST := $(inst)
 | 
|---|
| 153 |  if "$(substr $(inst),-1,1)" == "/" # Multicast support requires addprefix/suffix.
 | 
|---|
| 154 |   $(target)_1_INST_TARGET := $(addprefix $(PATH_INS)/,$(addsuffix $(notdir $(out)),$(inst)))
 | 
|---|
| 155 |  else if "$(inst)" == ""
 | 
|---|
| 156 |   $(target)_1_INST_TARGET := $(PATH_INS)/$(notdir $(out))
 | 
|---|
| 157 |  else
 | 
|---|
| 158 |   $(target)_1_INST_TARGET := $(addprefix $(PATH_INS)/,$(inst))
 | 
|---|
| 159 |  endif
 | 
|---|
| 160 | else
 | 
|---|
| 161 |  $(target)_1_INST :=
 | 
|---|
| 162 |  $(target)_1_INST_TARGET :=
 | 
|---|
| 163 | endif
 | 
|---|
| 164 | 
 | 
|---|
| 165 | # Debug info related stuff.
 | 
|---|
| 166 | local debug_insttype := $(firstword \
 | 
|---|
| 167 |         $($(target)_DEBUG_INSTTYPE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 168 |         $($(target)_DEBUG_INSTTYPE.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 169 |         $($(target)_DEBUG_INSTTYPE.$(bld_trg).$(bld_type)) \
 | 
|---|
| 170 |         $($(target)_DEBUG_INSTTYPE.$(bld_trg_arch)) \
 | 
|---|
| 171 |         $($(target)_DEBUG_INSTTYPE.$(bld_trg_cpu)) \
 | 
|---|
| 172 |         $($(target)_DEBUG_INSTTYPE.$(bld_trg)) \
 | 
|---|
| 173 |         $($(target)_DEBUG_INSTTYPE.$(bld_type)) \
 | 
|---|
| 174 |         $($(target)_DEBUG_INSTTYPE) \
 | 
|---|
| 175 |         $(insttype) )
 | 
|---|
| 176 | $(target)_1_DEBUG_INSTTYPE := $(debug_insttype)
 | 
|---|
| 177 | 
 | 
|---|
| 178 | if1of ($(debug_insttype), stage both)
 | 
|---|
| 179 |  local debug_stage := $(firstdefined \
 | 
|---|
| 180 |         $(target)_DEBUG_STAGE.$(bld_trg).$(bld_trg_arch).$(bld_type) \
 | 
|---|
| 181 |         $(target)_DEBUG_STAGE.$(bld_trg).$(bld_trg_arch) \
 | 
|---|
| 182 |         $(target)_DEBUG_STAGE.$(bld_trg).$(bld_type) \
 | 
|---|
| 183 |         $(target)_DEBUG_STAGE.$(bld_trg_arch) \
 | 
|---|
| 184 |         $(target)_DEBUG_STAGE.$(bld_trg_cpu) \
 | 
|---|
| 185 |         $(target)_DEBUG_STAGE.$(bld_trg) \
 | 
|---|
| 186 |         $(target)_DEBUG_STAGE.$(bld_type) \
 | 
|---|
| 187 |         $(target)_DEBUG_STAGE \
 | 
|---|
| 188 |         $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
 | 
|---|
| 189 |         $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch) \
 | 
|---|
| 190 |         $(target)_DEBUG_INST.$(bld_trg).$(bld_type) \
 | 
|---|
| 191 |         $(target)_DEBUG_INST.$(bld_trg_arch) \
 | 
|---|
| 192 |         $(target)_DEBUG_INST.$(bld_trg_cpu) \
 | 
|---|
| 193 |         $(target)_DEBUG_INST.$(bld_trg) \
 | 
|---|
| 194 |         $(target)_DEBUG_INST.$(bld_type) \
 | 
|---|
| 195 |         $(target)_DEBUG_INST)
 | 
|---|
| 196 |  ifneq ($(debug_stage),)
 | 
|---|
| 197 |   $(target)_1_DEBUG_STAGE := $($(debug_stage))
 | 
|---|
| 198 |  else
 | 
|---|
| 199 |   $(target)_1_DEBUG_STAGE := $(addprefix $(STAGE_DEBUG),$(stage))
 | 
|---|
| 200 |  endif
 | 
|---|
| 201 |  ifndef $(target)_1_DEBUG_STAGE
 | 
|---|
| 202 |   $(target)_1_DEBUG_STAGE := ./
 | 
|---|
| 203 |  endif
 | 
|---|
| 204 | else if1of ($(debug_insttype), none)
 | 
|---|
| 205 |  $(target)_1_DEBUG_STAGE :=
 | 
|---|
| 206 | else
 | 
|---|
| 207 |  $(error kBuild: Unknown value '$(debug_insttype)' for '$(target)_DEBUG_INSTTYPE'. Valid values are 'none', 'both' and 'stage'.)
 | 
|---|
| 208 | endif
 | 
|---|
| 209 | 
 | 
|---|
| 210 | if1of ($(debug_insttype), both)
 | 
|---|
| 211 |  local debug_inst := $(firstdefined \
 | 
|---|
| 212 |         $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
 | 
|---|
| 213 |         $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch) \
 | 
|---|
| 214 |         $(target)_DEBUG_INST.$(bld_trg).$(bld_type) \
 | 
|---|
| 215 |         $(target)_DEBUG_INST.$(bld_trg_arch) \
 | 
|---|
| 216 |         $(target)_DEBUG_INST.$(bld_trg_cpu) \
 | 
|---|
| 217 |         $(target)_DEBUG_INST.$(bld_trg) \
 | 
|---|
| 218 |         $(target)_DEBUG_INST.$(bld_type) \
 | 
|---|
| 219 |         $(target)_DEBUG_INST)
 | 
|---|
| 220 |  ifneq ($(debug_inst),)
 | 
|---|
| 221 |   $(target)_1_DEBUG_INST := $($(debug_inst))
 | 
|---|
| 222 |  else
 | 
|---|
| 223 |   $(target)_1_DEBUG_INST := $(addprefix $(INST_DEBUG),$(inst))
 | 
|---|
| 224 |  endif
 | 
|---|
| 225 |  ifndef $(target)_1_DEBUG_INST
 | 
|---|
| 226 |   $(target)_1_DEBUG_INST := ./
 | 
|---|
| 227 |  endif
 | 
|---|
| 228 | else
 | 
|---|
| 229 |  $(target)_1_DEBUG_INST :=
 | 
|---|
| 230 | endif
 | 
|---|
| 231 | #$(warning $(NLTAB)$(target)_1_DEBUG_INST=$($(target)_1_DEBUG_INST)$(NLTAB)$(target)_1_DEBUG_STAGE=$($(target)_1_DEBUG_STAGE)$(NLTAB)insttype=$(insttype)$(NLTAB)debug_insttype=$(debug_insttype))
 | 
|---|
| 232 | 
 | 
|---|
| 233 | endef # def_pass1_link_common
 | 
|---|
| 234 | $(eval-opt-var def_pass1_link_common)
 | 
|---|
| 235 | 
 | 
|---|
| 236 | 
 | 
|---|
| 237 | #
 | 
|---|
| 238 | # BLDPROGS (Pass 1)
 | 
|---|
| 239 | #
 | 
|---|
| 240 | define def_pass1_bldprog
 | 
|---|
| 241 | # set NOINST if not forced installation before doing the usual stuff.
 | 
|---|
| 242 | ifndef $(target)_INST
 | 
|---|
| 243 | $(target)_INSTTYPE := none
 | 
|---|
| 244 | endif
 | 
|---|
| 245 | $(evalvalctx def_pass1_link_common)
 | 
|---|
| 246 | endef
 | 
|---|
| 247 | 
 | 
|---|
| 248 | EXT     := EXE
 | 
|---|
| 249 | EXTPRE  := HOST
 | 
|---|
| 250 | definst := $(INST_BIN)
 | 
|---|
| 251 | tool_prefix := LD
 | 
|---|
| 252 | bld_trg_base_var := PLATFORM
 | 
|---|
| 253 | $(foreach target, $(_ALL_BLDPROGS), \
 | 
|---|
| 254 |         $(evalvalctx def_pass1_bldprog))
 | 
|---|
| 255 | 
 | 
|---|
| 256 | 
 | 
|---|
| 257 | #
 | 
|---|
| 258 | # LIBRARIES (Pass 1)
 | 
|---|
| 259 | #
 | 
|---|
| 260 | EXT     := LIB
 | 
|---|
| 261 | EXTPRE  :=
 | 
|---|
| 262 | definst := $(INST_LIB)
 | 
|---|
| 263 | tool_prefix := AR
 | 
|---|
| 264 | bld_trg_base_var := TARGET
 | 
|---|
| 265 | $(foreach target, $(_ALL_LIBRARIES), \
 | 
|---|
| 266 |         $(evalvalctx def_pass1_link_common))
 | 
|---|
| 267 | 
 | 
|---|
| 268 | 
 | 
|---|
| 269 | #
 | 
|---|
| 270 | # DLLS  (Pass 1)
 | 
|---|
| 271 | #
 | 
|---|
| 272 | EXT     := DLL
 | 
|---|
| 273 | EXTPRE  :=
 | 
|---|
| 274 | definst := $(INST_DLL)
 | 
|---|
| 275 | tool_prefix := LD
 | 
|---|
| 276 | bld_trg_base_var := TARGET
 | 
|---|
| 277 | $(foreach target, $(_ALL_DLLS), \
 | 
|---|
| 278 |         $(evalvalctx def_pass1_link_common))
 | 
|---|
| 279 | 
 | 
|---|
| 280 | 
 | 
|---|
| 281 | #
 | 
|---|
| 282 | # IMPORT LIBRARIES (Pass 1)
 | 
|---|
| 283 | #
 | 
|---|
| 284 | #   - On OS/2 and windows these are libraries.
 | 
|---|
| 285 | #   - On other platforms they are fake DLLs.
 | 
|---|
| 286 | #
 | 
|---|
| 287 | if1of ($(KBUILD_TARGET), nt os2 win win64 win32)
 | 
|---|
| 288 |  EXT     := LIB
 | 
|---|
| 289 |  EXTPRE  :=
 | 
|---|
| 290 |  definst := $(INST_LIB)
 | 
|---|
| 291 |  tool_prefix := AR
 | 
|---|
| 292 |  bld_trg_base_var := TARGET
 | 
|---|
| 293 |  $(foreach target, $(_ALL_IMPORT_LIBS), \
 | 
|---|
| 294 |         $(evalvalctx def_pass1_link_common))
 | 
|---|
| 295 | else
 | 
|---|
| 296 |  EXT     := DLL
 | 
|---|
| 297 |  EXTPRE  :=
 | 
|---|
| 298 |  definst := $(INST_DLL)
 | 
|---|
| 299 |  tool_prefix := LD
 | 
|---|
| 300 |  bld_trg_base_var := TARGET
 | 
|---|
| 301 |  $(foreach target, $(_ALL_IMPORT_LIBS), \
 | 
|---|
| 302 |         $(evalvalctx def_pass1_link_common))
 | 
|---|
| 303 | endif
 | 
|---|
| 304 | 
 | 
|---|
| 305 | 
 | 
|---|
| 306 | #
 | 
|---|
| 307 | # PROGRAMS (Pass 1)
 | 
|---|
| 308 | #
 | 
|---|
| 309 | EXT     := EXE
 | 
|---|
| 310 | EXTPRE  :=
 | 
|---|
| 311 | definst := $(INST_BIN)
 | 
|---|
| 312 | tool_prefix := LD
 | 
|---|
| 313 | bld_trg_base_var := TARGET
 | 
|---|
| 314 | $(foreach target, $(_ALL_PROGRAMS), \
 | 
|---|
| 315 |         $(evalvalctx def_pass1_link_common))
 | 
|---|
| 316 | 
 | 
|---|
| 317 | 
 | 
|---|
| 318 | #
 | 
|---|
| 319 | # SYSMODS (Pass 1)
 | 
|---|
| 320 | #
 | 
|---|
| 321 | EXT     := SYS
 | 
|---|
| 322 | EXTPRE  :=
 | 
|---|
| 323 | definst := $(INST_SYS)
 | 
|---|
| 324 | tool_prefix := LD
 | 
|---|
| 325 | bld_trg_base_var := TARGET
 | 
|---|
| 326 | $(foreach target, $(_ALL_SYSMODS), \
 | 
|---|
| 327 |         $(evalvalctx def_pass1_link_common))
 | 
|---|
| 328 | 
 | 
|---|
| 329 | 
 | 
|---|
| 330 | #
 | 
|---|
| 331 | # MISCBINS (Pass 1)
 | 
|---|
| 332 | #
 | 
|---|
| 333 | EXT     := BIN
 | 
|---|
| 334 | EXTPRE  :=
 | 
|---|
| 335 | definst := $(INST_BIN)
 | 
|---|
| 336 | tool_prefix := LD
 | 
|---|
| 337 | bld_trg_base_var := TARGET
 | 
|---|
| 338 | $(foreach target, $(_ALL_MISCBINS), \
 | 
|---|
| 339 |         $(evalvalctx def_pass1_link_common))
 | 
|---|
| 340 | 
 | 
|---|
| 341 | 
 | 
|---|
| 342 | #
 | 
|---|
| 343 | # INSTALLS (Pass 1)
 | 
|---|
| 344 | #       Note! INSTARGET_* for INSTALLS aren't available until later.
 | 
|---|
| 345 | #
 | 
|---|
| 346 | define def_pass1_install
 | 
|---|
| 347 | local bld_type     := $(firstword $($(target)_BLD_TYPE)     $(KBUILD_TYPE))
 | 
|---|
| 348 | local bld_trg      := $(firstword $($(target)_BLD_TRG)      $(KBUILD_TARGET))
 | 
|---|
| 349 | local bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
 | 
|---|
| 350 | local bld_trg_cpu  := $(firstword $($(target)_BLD_TRG_CPU)  $(KBUILD_TARGET_CPU))
 | 
|---|
| 351 | # _1_TARGET
 | 
|---|
| 352 | $(target)_1_TARGET := $(PATH_TARGET)/$(target).ins
 | 
|---|
| 353 | $(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
 | 
|---|
| 354 | 
 | 
|---|
| 355 | # Determine and set 1_INSTTYPE.
 | 
|---|
| 356 | local insttype := $(firstword \
 | 
|---|
| 357 |         $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 358 |         $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 359 |         $($(target)_INSTTYPE.$(bld_trg).$(bld_type)) \
 | 
|---|
| 360 |         $($(target)_INSTTYPE.$(bld_trg_arch)) \
 | 
|---|
| 361 |         $($(target)_INSTTYPE.$(bld_trg_cpu)) \
 | 
|---|
| 362 |         $($(target)_INSTTYPE.$(bld_trg)) \
 | 
|---|
| 363 |         $($(target)_INSTTYPE.$(bld_type)) \
 | 
|---|
| 364 |         $($(target)_INSTTYPE) \
 | 
|---|
| 365 |         )
 | 
|---|
| 366 | ifeq ($(insttype),)
 | 
|---|
| 367 |  ifneq ($(firstword \
 | 
|---|
| 368 |         $($(target)_NOINST) \
 | 
|---|
| 369 |         $($(target)_NOINST.$(bld_trg)) \
 | 
|---|
| 370 |         $($(target)_NOINST.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 371 |         $($(target)_NOINST.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 372 |         $($(target)_NOINST.$(bld_trg_arch)) \
 | 
|---|
| 373 |         $($(target)_NOINST.$(bld_trg_cpu)) \
 | 
|---|
| 374 |         $($(target)_NOINST.$(bld_type)) ),)
 | 
|---|
| 375 |    local insttype := none
 | 
|---|
| 376 |  else
 | 
|---|
| 377 |    local insttype := both
 | 
|---|
| 378 |  endif
 | 
|---|
| 379 | endif
 | 
|---|
| 380 | ifn1of ($(insttype), none both stage)
 | 
|---|
| 381 |  $(error kBuild: Unknown value '$(insttype)' for '$(target)_INSTTYPE'. Valid values are 'none', 'both' and 'stage'.)
 | 
|---|
| 382 | endif
 | 
|---|
| 383 | $(target)_1_INSTTYPE    := $(insttype)
 | 
|---|
| 384 | 
 | 
|---|
| 385 | # Determine the actual INST and STAGE sub-dirs to use for this target.
 | 
|---|
| 386 | if1of ($(insttype), stage both)
 | 
|---|
| 387 |  local stage := $(strip $(firstdefined \
 | 
|---|
| 388 |         $(target)_STAGE.$(bld_trg).$(bld_trg_arch).$(bld_type) \
 | 
|---|
| 389 |         $(target)_STAGE.$(bld_trg).$(bld_trg_arch) \
 | 
|---|
| 390 |         $(target)_STAGE.$(bld_trg).$(bld_type) \
 | 
|---|
| 391 |         $(target)_STAGE.$(bld_trg_arch) \
 | 
|---|
| 392 |         $(target)_STAGE.$(bld_trg_cpu) \
 | 
|---|
| 393 |         $(target)_STAGE.$(bld_trg) \
 | 
|---|
| 394 |         $(target)_STAGE.$(bld_type) \
 | 
|---|
| 395 |         $(target)_STAGE \
 | 
|---|
| 396 |         $(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
 | 
|---|
| 397 |         $(target)_INST.$(bld_trg).$(bld_trg_arch) \
 | 
|---|
| 398 |         $(target)_INST.$(bld_trg).$(bld_type) \
 | 
|---|
| 399 |         $(target)_INST.$(bld_trg_arch) \
 | 
|---|
| 400 |         $(target)_INST.$(bld_trg_cpu) \
 | 
|---|
| 401 |         $(target)_INST.$(bld_trg) \
 | 
|---|
| 402 |         $(target)_INST.$(bld_type) \
 | 
|---|
| 403 |         $(target)_INST \
 | 
|---|
| 404 |         definst \
 | 
|---|
| 405 |         ,value))
 | 
|---|
| 406 |  if $(words $(stage)) > 1
 | 
|---|
| 407 |   $(warning kBuild: The STAGE/INST property of install '$(target)' specifies multiple location, that is not supported.)
 | 
|---|
| 408 |   local stage := $(word 1, $(stage))
 | 
|---|
| 409 |  endif
 | 
|---|
| 410 |  $(target)_1_STAGE := $(stage)
 | 
|---|
| 411 | else
 | 
|---|
| 412 |  $(target)_1_STAGE = $(error _1_STAGE not used)
 | 
|---|
| 413 | endif
 | 
|---|
| 414 | 
 | 
|---|
| 415 | if1of ($(insttype), both)
 | 
|---|
| 416 |  local inst := $(strip $(firstdefined \
 | 
|---|
| 417 |         $(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
 | 
|---|
| 418 |         $(target)_INST.$(bld_trg).$(bld_trg_arch) \
 | 
|---|
| 419 |         $(target)_INST.$(bld_trg).$(bld_type) \
 | 
|---|
| 420 |         $(target)_INST.$(bld_trg_arch) \
 | 
|---|
| 421 |         $(target)_INST.$(bld_trg_cpu) \
 | 
|---|
| 422 |         $(target)_INST.$(bld_trg) \
 | 
|---|
| 423 |         $(target)_INST.$(bld_type) \
 | 
|---|
| 424 |         $(target)_INST \
 | 
|---|
| 425 |         definst \
 | 
|---|
| 426 |         ,value))
 | 
|---|
| 427 |  if $(words $(inst)) > 1
 | 
|---|
| 428 |   $(warning kBuild: The INST property of install '$(target)' specifies multiple location, that is not supported.)
 | 
|---|
| 429 |   local inst := $(word 1, $(inst))
 | 
|---|
| 430 |  endif
 | 
|---|
| 431 |  ifneq ($(root $(stage)),)
 | 
|---|
| 432 |   $(error kBuild: The effective INST property of install '$(target)' should not start with a root specification)
 | 
|---|
| 433 |  endif
 | 
|---|
| 434 |  $(target)_1_INST := $(inst)
 | 
|---|
| 435 | else
 | 
|---|
| 436 |  $(target)_1_INST = $(error _1_INST not used)
 | 
|---|
| 437 | endif
 | 
|---|
| 438 | 
 | 
|---|
| 439 | # Block properties that we put off setting until pass 2 for INSTALLS.
 | 
|---|
| 440 | $(target)_1_STAGE_TARGET = $(error The '_1_STAGE_TARGET' property is not present on install targets.  Use '_2_STAGE_TARGETS' instead (set by pass 2!).)
 | 
|---|
| 441 | $(target)_1_INST_TARGET  = $(error The '_1_INST_TARGET' property is not present on install targets.  Use '_2_INST_TARGETS' instead (set by pass 2!).)
 | 
|---|
| 442 | INSTARGET_$(target)      = $(error The 'INSTARGET_' is deprecated and besides, it is being accessed to early.  Consider '_2_STAGE_TARGETS' or '_2_INST_TARGETS'.)
 | 
|---|
| 443 | 
 | 
|---|
| 444 | # INSTARGET_ later.
 | 
|---|
| 445 | # PATH_*
 | 
|---|
| 446 | local outbase      := $(call TARGET_BASE,$(target),$(target))
 | 
|---|
| 447 | $(target)_0_OUTDIR := $(patsubst %/,%,$(dir $(outbase)))
 | 
|---|
| 448 | $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
 | 
|---|
| 449 | endef # def_pass1_install
 | 
|---|
| 450 | $(eval-opt-var def_pass1_install)
 | 
|---|
| 451 | 
 | 
|---|
| 452 | $(foreach target, $(_ALL_INSTALLS), \
 | 
|---|
| 453 |         $(evalvalctx def_pass1_install))
 | 
|---|
| 454 | 
 | 
|---|
| 455 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| 456 |  $(evalcall def_profile_self, done pass 1)
 | 
|---|
| 457 | endif
 | 
|---|
| 458 | 
 | 
|---|
| 459 | 
 | 
|---|