| 1 | # $Id: footer-pass2-compiling-targets.kmk 3521 2021-12-18 13:41:28Z bird $
 | 
|---|
| 2 | ## @file
 | 
|---|
| 3 | # kBuild - Footer - Target lists - Pass 2 - Compiling Targets.
 | 
|---|
| 4 | #
 | 
|---|
| 5 | 
 | 
|---|
| 6 | #
 | 
|---|
| 7 | # Copyright (c) 2004-2019 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
 | 
|---|
| 8 | #
 | 
|---|
| 9 | # This file is part of kBuild.
 | 
|---|
| 10 | #
 | 
|---|
| 11 | # kBuild is free software; you can redistribute it and/or modify
 | 
|---|
| 12 | # it under the terms of the GNU General Public License as published by
 | 
|---|
| 13 | # the Free Software Foundation; either version source of the License, or
 | 
|---|
| 14 | # (at your option) any later version.
 | 
|---|
| 15 | #
 | 
|---|
| 16 | # kBuild is distributed in the hope that it will be useful,
 | 
|---|
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
| 19 | # GNU General Public License for more details.
 | 
|---|
| 20 | #
 | 
|---|
| 21 | # You should have received a copy of the GNU General Public License
 | 
|---|
| 22 | # along with kBuild; if not, write to the Free Software
 | 
|---|
| 23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|---|
| 24 | #
 | 
|---|
| 25 | #
 | 
|---|
| 26 | # As a special exception you are granted permission to include this file, via
 | 
|---|
| 27 | # the kmk include directive, as you wish without this in itself causing the
 | 
|---|
| 28 | # resulting makefile, program or whatever to be covered by the GPL license.
 | 
|---|
| 29 | # This exception does not however invalidate any other reasons why the makefile,
 | 
|---|
| 30 | # program, whatever should not be covered the GPL.
 | 
|---|
| 31 | #
 | 
|---|
| 32 | #
 | 
|---|
| 33 | 
 | 
|---|
| 34 | 
 | 
|---|
| 35 | #
 | 
|---|
| 36 | # Object processing.
 | 
|---|
| 37 | #
 | 
|---|
| 38 | 
 | 
|---|
| 39 | ifndef NO_COMPILE_CMDS_DEPS
 | 
|---|
| 40 |  ## Generates the rules for building a specific object and the aliases.
 | 
|---|
| 41 |  # for building a source file.
 | 
|---|
| 42 |  # @param    $(obj)    The object file.
 | 
|---|
| 43 |  define def_target_source_rule_v3plus
 | 
|---|
| 44 | $$(obj): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $$@),FORCE)
 | 
|---|
| 45 | $$(obj) + $$(kbsrc_output) +| $$(kbsrc_output_maybe) : $$(kbsrc_depend) | $$(kbsrc_depord) $(target_intermediate_vars)
 | 
|---|
| 46 |         %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
 | 
|---|
| 47 |   ifndef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT
 | 
|---|
| 48 |         $$(QUIET)$$(RM) -f -- $(dep) $(obj) $(kbsrc_output) $(kbsrc_output_maybe)
 | 
|---|
| 49 |   endif
 | 
|---|
| 50 | 
 | 
|---|
| 51 | $(kbsrc_cmds)
 | 
|---|
| 52 | 
 | 
|---|
| 53 |         %$$(QUIET2)$$(APPEND) -in '$(dep)' '' 'define $(target)_$(subst :,_,$(source))_CMDS_PREV_' '--insert-command=$(obj)' 'endef'
 | 
|---|
| 54 | $$(basename $$(notdir $$(obj))).o: $$(obj)
 | 
|---|
| 55 |  endef # def_target_source_rule_v3plus
 | 
|---|
| 56 | 
 | 
|---|
| 57 |  ## Generates the rules for building a specific object and the aliases, kObjCache variant.
 | 
|---|
| 58 |  # for building a source file.
 | 
|---|
| 59 |  # @param    $(obj)    The object file.
 | 
|---|
| 60 |  define def_target_source_rule_v3plus_objcache
 | 
|---|
| 61 | $$(obj): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $$@),FORCE)
 | 
|---|
| 62 | _OUT_FILES += $(outbase).koc
 | 
|---|
| 63 | $$(outbase).koc +| $$(obj) $$(kbsrc_output) $$(kbsrc_output_maybe) : $$(kbsrc_depend) | $$(kbsrc_depord) $(target_intermediate_vars)
 | 
|---|
| 64 |         %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
 | 
|---|
| 65 | 
 | 
|---|
| 66 | $(kbsrc_cmds)
 | 
|---|
| 67 | 
 | 
|---|
| 68 |         %$$(QUIET2)$$(APPEND) -in '$(dep)' '' 'define $(target)_$(subst :,_,$(source))_CMDS_PREV_' '--insert-command=$(obj)' 'endef'
 | 
|---|
| 69 | $$(basename $$(notdir $$(obj))).o: $$(obj)
 | 
|---|
| 70 |  endef # def_target_source_rule_v3plus_objcache
 | 
|---|
| 71 | 
 | 
|---|
| 72 | else # NO_COMPILE_CMDS_DEPS
 | 
|---|
| 73 | 
 | 
|---|
| 74 |  ## Generates the rules for building a specific object and the aliases.
 | 
|---|
| 75 |  # for building a source file.
 | 
|---|
| 76 |  # @param    $(obj)    The object file.
 | 
|---|
| 77 |  define def_target_source_rule_v3plus
 | 
|---|
| 78 | $$(obj) + $$(kbsrc_output) +| $$(kbsrc_output_maybe) : $$(kbsrc_depend) | $$(kbsrc_depord) $(target_intermediate_vars)
 | 
|---|
| 79 |         %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
 | 
|---|
| 80 |   ifndef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT
 | 
|---|
| 81 |         $$(QUIET)$$(RM) -f -- $(dep) $(obj) $(kbsrc_output) $(kbsrc_output_maybe)
 | 
|---|
| 82 |   endif
 | 
|---|
| 83 | 
 | 
|---|
| 84 | $(kbsrc_cmds)
 | 
|---|
| 85 | 
 | 
|---|
| 86 | $$(basename $$(notdir $$(obj))).o: $$(obj)
 | 
|---|
| 87 |  endef # def_target_source_rule_v3plus
 | 
|---|
| 88 | 
 | 
|---|
| 89 |  ## Generates the rules for building a specific object and the aliases, kObjCache variant.
 | 
|---|
| 90 |  # for building a source file.
 | 
|---|
| 91 |  # @param    $(obj)    The object file.
 | 
|---|
| 92 |  define def_target_source_rule_v3plus_objcache
 | 
|---|
| 93 | _OUT_FILES += $(outbase).koc
 | 
|---|
| 94 | $$(outbase).koc +| $$(obj) $$(kbsrc_output) $$(kbsrc_output_maybe) : $$(kbsrc_depend) | $$(kbsrc_depord) $(target_intermediate_vars)
 | 
|---|
| 95 |         %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
 | 
|---|
| 96 | 
 | 
|---|
| 97 | $(kbsrc_cmds)
 | 
|---|
| 98 | 
 | 
|---|
| 99 | $$(basename $$(notdir $$(obj))).o: $$(obj)
 | 
|---|
| 100 |  endef # def_target_source_rule_v3plus_objcache
 | 
|---|
| 101 | 
 | 
|---|
| 102 | endif # NO_COMPILE_CMDS_DEPS
 | 
|---|
| 103 | $(eval-opt-var def_target_source_rule_v3plus)
 | 
|---|
| 104 | $(eval-opt-var def_target_source_rule_v3plus_objcache)
 | 
|---|
| 105 | 
 | 
|---|
| 106 | 
 | 
|---|
| 107 | ##
 | 
|---|
| 108 | ## Legacy legacy legacy - start
 | 
|---|
| 109 | ##
 | 
|---|
| 110 | 
 | 
|---|
| 111 | ## Wrapper
 | 
|---|
| 112 | ifndef NO_COMPILE_CMDS_DEPS
 | 
|---|
| 113 |  if1of ($(KMK_FEATURES),dot-must-make)
 | 
|---|
| 114 |   _DEP_COMPILE_CMDS =
 | 
|---|
| 115 |   # for debugging:  $$(warning MUST_MAKE=$$$$(comp-cmds-ex $$$$($(target)_$(subst :,_,$(source))_CMDS_PREV_), $$$$(commands $$@)) -> $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $$@),FORCE))
 | 
|---|
| 116 |  else
 | 
|---|
| 117 |   _DEP_COMPILE_CMDS = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $(obj)),FORCE)
 | 
|---|
| 118 |  endif
 | 
|---|
| 119 | else
 | 
|---|
| 120 |  _DEP_COMPILE_CMDS =
 | 
|---|
| 121 | endif
 | 
|---|
| 122 | 
 | 
|---|
| 123 | ## Generates the rules for building a specific object, and the aliases - legacy version.
 | 
|---|
| 124 | # for building a source file.
 | 
|---|
| 125 | # @param    $(obj)    The object file.
 | 
|---|
| 126 | define def_target_source_rule
 | 
|---|
| 127 | ifndef NO_COMPILE_CMDS_DEPS
 | 
|---|
| 128 | $(obj): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $$@),FORCE)
 | 
|---|
| 129 | endif
 | 
|---|
| 130 | ifneq ($(TOOL_$(tool)_COMPILE_$(type)_USES_KOBJCACHE),)
 | 
|---|
| 131 | _OUT_FILES += $(outbase).koc
 | 
|---|
| 132 | $(outbase).koc +| $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_$(source)_OUTPUT_MAYBE_) : \
 | 
|---|
| 133 |                 $($(target)_$(source)_DEPEND_) $(value _DEP_COMPILE_CMDS) \
 | 
|---|
| 134 |                 | $($(target)_$(source)_DEPORD_) $(target_intermediate_vars)
 | 
|---|
| 135 |         %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
 | 
|---|
| 136 | else
 | 
|---|
| 137 | $(obj) + $($(target)_$(source)_OUTPUT_) +| $($(target)_$(source)_OUTPUT_MAYBE_) : \
 | 
|---|
| 138 |                 $($(target)_$(source)_DEPEND_) $(value _DEP_COMPILE_CMDS) \
 | 
|---|
| 139 |                 | $($(target)_$(source)_DEPORD_) $(target_intermediate_vars)
 | 
|---|
| 140 |         %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
 | 
|---|
| 141 | ifndef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT
 | 
|---|
| 142 |         $$(QUIET)$$(RM) -f -- $(dep) $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_OUTPUT_MAYBE_)
 | 
|---|
| 143 | endif
 | 
|---|
| 144 | endif
 | 
|---|
| 145 | 
 | 
|---|
| 146 | $($(target)_$(source)_CMDS_)
 | 
|---|
| 147 | 
 | 
|---|
| 148 | ifndef NO_COMPILE_CMDS_DEPS
 | 
|---|
| 149 |  ifdef KBUILD_HAVE_OPTIMIZED_APPEND
 | 
|---|
| 150 |         %$$(QUIET2)$$(APPEND) -in '$(dep)' \
 | 
|---|
| 151 |                 '' \
 | 
|---|
| 152 |                 'define $(target)_$(subst :,_,$(source))_CMDS_PREV_' \
 | 
|---|
| 153 |                 '--insert-command=$(obj)' \
 | 
|---|
| 154 |                 'endef'
 | 
|---|
| 155 |  else
 | 
|---|
| 156 |         %$$(QUIET2)$$(APPEND) -n '$(dep)' '' 'define $(target)_$(subst :,_,$(source))_CMDS_PREV_'
 | 
|---|
| 157 |         %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(obj)'
 | 
|---|
| 158 |         %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
 | 
|---|
| 159 |  endif
 | 
|---|
| 160 | endif
 | 
|---|
| 161 | 
 | 
|---|
| 162 | $(basename $(notdir $(obj))).o: $(obj)
 | 
|---|
| 163 | 
 | 
|---|
| 164 | ## @todo make this 'local cmds,output,output_maybe,depend and depord' in 0.2.x or when a new kb-src-one is added.
 | 
|---|
| 165 | $(target)_$(source)_CMDS_ :=
 | 
|---|
| 166 | $(target)_$(source)_OUTPUT_ :=
 | 
|---|
| 167 | $(target)_$(source)_OUTPUT_MAYBE_ :=
 | 
|---|
| 168 | $(target)_$(source)_DEPEND_ :=
 | 
|---|
| 169 | $(target)_$(source)_DEPORD_ :=
 | 
|---|
| 170 | endef # def_target_source_rule
 | 
|---|
| 171 | $(eval-opt-var def_target_source_rule)
 | 
|---|
| 172 | ##
 | 
|---|
| 173 | ## Legacy legacy legacy - end
 | 
|---|
| 174 | 
 | 
|---|
| 175 | 
 | 
|---|
| 176 | 
 | 
|---|
| 177 | ## wrapper the link command dependency check.
 | 
|---|
| 178 | ifndef NO_LINK_CMDS_DEPS
 | 
|---|
| 179 |  if1of ($(KMK_FEATURES),dot-must-make)
 | 
|---|
| 180 |   _DEP_LINK_CMDS =
 | 
|---|
| 181 |  else
 | 
|---|
| 182 |   _DEP_LINK_CMDS = $$(comp-cmds-ex $$($(target)_CMDS_PREV_),$$(commands $(out)),FORCE)
 | 
|---|
| 183 |  endif
 | 
|---|
| 184 | else
 | 
|---|
| 185 |  _DEP_LINK_CMDS =
 | 
|---|
| 186 | endif
 | 
|---|
| 187 | 
 | 
|---|
| 188 | ## Generate the link rule for a target.
 | 
|---|
| 189 | # @param    $(target)               The normalized target name.
 | 
|---|
| 190 | # @param    $(dirdep)               Directories we depend upon begin created before linking.
 | 
|---|
| 191 | # @param    $(dep)                  The name of the dependency file.
 | 
|---|
| 192 | # @param    $(out)
 | 
|---|
| 193 | # @param    $($(target)_2_OUTPUT)   Output files from the link.
 | 
|---|
| 194 | # @param    $($(target)_2_OUTPUT_MAYBE) Output files that the link may perhaps create.
 | 
|---|
| 195 | # @param    $($(target)_2_OUTPUT_MAYBE_PRECIOUS)        Output files that the link may perhaps create but shouldn't be deleted.
 | 
|---|
| 196 | # @param    $($(target)_2_DEPEND)   Dependencies.
 | 
|---|
| 197 | # @param    $($(target)_2_DEPORD)   Dependencies which should only affect build order.
 | 
|---|
| 198 | # @param    $(cmds)                 The link commands.
 | 
|---|
| 199 | # @param    $($(target)_CMDS_PREV_) The link commands from the previous run.
 | 
|---|
| 200 | define def_link_rule
 | 
|---|
| 201 | $$(call KB_FN_ASSERT_ABSPATH,out)
 | 
|---|
| 202 | ifndef NO_LINK_CMDS_DEPS
 | 
|---|
| 203 | $(out): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_CMDS_PREV_),$$(commands $$@),FORCE)
 | 
|---|
| 204 | endif
 | 
|---|
| 205 | $(out) \
 | 
|---|
| 206 | + $($(target)_2_OUTPUT) \
 | 
|---|
| 207 | + $($(target)_2_OUTPUT_DEBUG_FILES) \
 | 
|---|
| 208 | + $($(target)_2_OUTPUT_DEBUG_DIRS) \
 | 
|---|
| 209 | +| $($(target)_2_OUTPUT_MAYBE) $($(target)_2_OUTPUT_MAYBE_PRECIOUS) : \
 | 
|---|
| 210 |                 $$$$($(target)_2_DEPEND) \
 | 
|---|
| 211 |                 $(value _DEP_LINK_CMDS) \
 | 
|---|
| 212 |                 | \
 | 
|---|
| 213 |                 $$$$($(target)_2_DEPORD)
 | 
|---|
| 214 |         %$$(call MSG_LINK,$(target),$$@,$(tool_do))
 | 
|---|
| 215 |         $$(QUIET)$$(RM) -f -- $(dep) $(out) $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE) $($(target)_2_OUTPUT_DEBUG_FILES)
 | 
|---|
| 216 | ifdef $(target)_2_OUTPUT_DEBUG_DIRS
 | 
|---|
| 217 |         $$(QUIET)$$(RM) -Rf -- $($(target)_2_OUTPUT_DEBUG_DIRS)
 | 
|---|
| 218 | endif
 | 
|---|
| 219 | 
 | 
|---|
| 220 | $(cmds)
 | 
|---|
| 221 | 
 | 
|---|
| 222 | ifndef NO_LINK_CMDS_DEPS
 | 
|---|
| 223 |         %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_CMDS_PREV_'
 | 
|---|
| 224 |         %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 | 
|---|
| 225 |         %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
 | 
|---|
| 226 | endif
 | 
|---|
| 227 | 
 | 
|---|
| 228 | $(basename $(notdir $(out))):: $(out)
 | 
|---|
| 229 | 
 | 
|---|
| 230 | endef # def_link_rule
 | 
|---|
| 231 | $(eval-opt-var def_link_rule)
 | 
|---|
| 232 | 
 | 
|---|
| 233 | 
 | 
|---|
| 234 | ## Generate the link & lib install rule
 | 
|---|
| 235 | # Implicit parameters: target, out, $(target)_1_STAGE_TARGET, mode,
 | 
|---|
| 236 | #                      pre_install_cmds, post_install_cmds
 | 
|---|
| 237 | define def_link_install_rule
 | 
|---|
| 238 | $$(call KB_FN_ASSERT_ABSPATH,$(target)_1_INST_TARGET)
 | 
|---|
| 239 | $($(target)_1_INST_TARGET): $(out) | $$$$(dir $$$$@)
 | 
|---|
| 240 |         %$$(call MSG_INST_TRG,$(target),$(out),$$@)
 | 
|---|
| 241 |         $(pre_install_cmds)
 | 
|---|
| 242 | 
 | 
|---|
| 243 |         $$(QUIET)$$(INSTALL) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $(out) $$@
 | 
|---|
| 244 |         $(post_install_cmds)
 | 
|---|
| 245 | 
 | 
|---|
| 246 | endef
 | 
|---|
| 247 | 
 | 
|---|
| 248 | 
 | 
|---|
| 249 | ## Generate the link & lib stage installation rule
 | 
|---|
| 250 | # Implicit parameters: target, out, $(target)_1_STAGE_TARGET, mode,
 | 
|---|
| 251 | #                      pre_install_cmds, post_install_cmds
 | 
|---|
| 252 | define def_link_stage_rule
 | 
|---|
| 253 | $$(call KB_FN_ASSERT_ABSPATH,$(target)_1_STAGE_TARGET)
 | 
|---|
| 254 | $($(target)_1_STAGE_TARGET): $(out) | $$$$(dir $$$$@)
 | 
|---|
| 255 |         %$$(call MSG_INST_TRG,$(target),$(out),$$@)
 | 
|---|
| 256 |         $(pre_install_cmds)
 | 
|---|
| 257 | 
 | 
|---|
| 258 |         $$(QUIET)$$(INSTALL_STAGING) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $(out) $$@
 | 
|---|
| 259 |         $(post_install_cmds)
 | 
|---|
| 260 | 
 | 
|---|
| 261 | 
 | 
|---|
| 262 | $(basename $(notdir $(out))):: $($(target)_1_STAGE_TARGET)
 | 
|---|
| 263 | 
 | 
|---|
| 264 | endef
 | 
|---|
| 265 | 
 | 
|---|
| 266 | 
 | 
|---|
| 267 | ## def_src_handler_*
 | 
|---|
| 268 | #
 | 
|---|
| 269 | # @{
 | 
|---|
| 270 | define def_src_handler_c
 | 
|---|
| 271 | local type := C
 | 
|---|
| 272 |  $(kb-src-one 4)
 | 
|---|
| 273 | endef
 | 
|---|
| 274 | 
 | 
|---|
| 275 | define def_src_handler_cxx
 | 
|---|
| 276 | local type := CXX
 | 
|---|
| 277 |  $(kb-src-one 4)
 | 
|---|
| 278 | endef
 | 
|---|
| 279 | 
 | 
|---|
| 280 | define def_src_handler_objc
 | 
|---|
| 281 | local type := OBJC
 | 
|---|
| 282 |  $(kb-src-one 4)
 | 
|---|
| 283 | endef
 | 
|---|
| 284 | 
 | 
|---|
| 285 | define def_src_handler_objcxx
 | 
|---|
| 286 | local type := OBJCXX
 | 
|---|
| 287 |  $(kb-src-one 4)
 | 
|---|
| 288 | endef
 | 
|---|
| 289 | 
 | 
|---|
| 290 | define def_src_handler_asm
 | 
|---|
| 291 | local type := AS
 | 
|---|
| 292 |  $(kb-src-one 4)
 | 
|---|
| 293 | endef
 | 
|---|
| 294 | 
 | 
|---|
| 295 | define def_src_handler_rc
 | 
|---|
| 296 | local type := RC
 | 
|---|
| 297 |  $(kb-src-one 4)
 | 
|---|
| 298 | endef
 | 
|---|
| 299 | 
 | 
|---|
| 300 | ifdef KMK_WITH_QUOTING
 | 
|---|
| 301 | define def_src_handler_obj
 | 
|---|
| 302 | ifeq ($(defpath),)
 | 
|---|
| 303 |  $(target)_2_OBJS += $(source)
 | 
|---|
| 304 | else
 | 
|---|
| 305 |  $(target)_2_OBJS += $(qabspathex ,$(source), $(defpath))
 | 
|---|
| 306 | endif
 | 
|---|
| 307 | endef
 | 
|---|
| 308 | else
 | 
|---|
| 309 | define def_src_handler_obj
 | 
|---|
| 310 | ifeq ($(defpath),)
 | 
|---|
| 311 |  $(target)_2_OBJS += $(source)
 | 
|---|
| 312 | else
 | 
|---|
| 313 |  $(target)_2_OBJS += $(abspathex $(source), $(defpath))
 | 
|---|
| 314 | endif
 | 
|---|
| 315 | endef
 | 
|---|
| 316 | endif
 | 
|---|
| 317 | ## @}
 | 
|---|
| 318 | 
 | 
|---|
| 319 | ## Handle one source.
 | 
|---|
| 320 | # .
 | 
|---|
| 321 | define def_src_handler_one
 | 
|---|
| 322 | local suff := $(suffix $(source))
 | 
|---|
| 323 | local src_handler := $(firstword $(filter $(suff):%, $($(target)_$(source)_SRC_HANDLERS) $($(source)_SRC_HANDLERS) $(target_src_handlers) ))
 | 
|---|
| 324 | local handler := $(patsubst $(suff):%,%,$(src_handler))
 | 
|---|
| 325 | ifneq ($(handler),)
 | 
|---|
| 326 |  $(evalvalctx $(handler))
 | 
|---|
| 327 | else
 | 
|---|
| 328 |  othersrc += $(source)
 | 
|---|
| 329 | endif
 | 
|---|
| 330 | endef # def_src_handler_one
 | 
|---|
| 331 | 
 | 
|---|
| 332 | ## Generic macro for processing all target sources.
 | 
|---|
| 333 | # @param    $(target)   Normalized target name.
 | 
|---|
| 334 | # @param    $(defpath)
 | 
|---|
| 335 | # @param    much-more...
 | 
|---|
| 336 | # @returns  othersrc, $(target)_2_OBJS, ++
 | 
|---|
| 337 | ifdef KMK_WITH_QUOTING
 | 
|---|
| 338 | define def_target_sources
 | 
|---|
| 339 | local target_src_handlers := $($(target)_SRC_HANDLERS) $(KBUILD_SRC_HANDLERS)
 | 
|---|
| 340 | $(foreachfile source,\
 | 
|---|
| 341 |         $($(target)_SOURCES)\
 | 
|---|
| 342 |         $($(target)_SOURCES.$(bld_trg))\
 | 
|---|
| 343 |         $($(target)_SOURCES.$(bld_trg).$(bld_type))\
 | 
|---|
| 344 |         $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 345 |         $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| 346 |         $($(target)_SOURCES.$(bld_trg_arch))\
 | 
|---|
| 347 |         $($(target)_SOURCES.$(bld_trg_cpu))\
 | 
|---|
| 348 |         $($(target)_SOURCES.$(bld_type))\
 | 
|---|
| 349 |         ,$(evalvalctx def_src_handler_one) )
 | 
|---|
| 350 | 
 | 
|---|
| 351 | $(foreachfile source,\
 | 
|---|
| 352 |         $($(target)_GEN_SOURCES_)\
 | 
|---|
| 353 |         $($(target)_GEN_SOURCES_.$(bld_trg))\
 | 
|---|
| 354 |         $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_type))\
 | 
|---|
| 355 |         $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 356 |         $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| 357 |         $($(target)_GEN_SOURCES_.$(bld_trg_arch))\
 | 
|---|
| 358 |         $($(target)_GEN_SOURCES_.$(bld_trg_cpu))\
 | 
|---|
| 359 |         $($(target)_GEN_SOURCES_.$(bld_type))\
 | 
|---|
| 360 |         ,$(evalvalctx def_src_handler_one) )
 | 
|---|
| 361 | endef # def_target_sources
 | 
|---|
| 362 | else
 | 
|---|
| 363 | define def_target_sources
 | 
|---|
| 364 | local target_src_handlers := $($(target)_SRC_HANDLERS) $(KBUILD_SRC_HANDLERS)
 | 
|---|
| 365 | $(foreach source,\
 | 
|---|
| 366 |         $($(target)_SOURCES)\
 | 
|---|
| 367 |         $($(target)_SOURCES.$(bld_trg))\
 | 
|---|
| 368 |         $($(target)_SOURCES.$(bld_trg).$(bld_type))\
 | 
|---|
| 369 |         $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 370 |         $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| 371 |         $($(target)_SOURCES.$(bld_trg_arch))\
 | 
|---|
| 372 |         $($(target)_SOURCES.$(bld_trg_cpu))\
 | 
|---|
| 373 |         $($(target)_SOURCES.$(bld_type))\
 | 
|---|
| 374 |         ,$(evalvalctx def_src_handler_one) )
 | 
|---|
| 375 | 
 | 
|---|
| 376 | $(foreach source,\
 | 
|---|
| 377 |         $($(target)_GEN_SOURCES_)\
 | 
|---|
| 378 |         $($(target)_GEN_SOURCES_.$(bld_trg))\
 | 
|---|
| 379 |         $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_type))\
 | 
|---|
| 380 |         $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 381 |         $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| 382 |         $($(target)_GEN_SOURCES_.$(bld_trg_arch))\
 | 
|---|
| 383 |         $($(target)_GEN_SOURCES_.$(bld_trg_cpu))\
 | 
|---|
| 384 |         $($(target)_GEN_SOURCES_.$(bld_type))\
 | 
|---|
| 385 |         ,$(evalvalctx def_src_handler_one) )
 | 
|---|
| 386 | endef # def_target_sources
 | 
|---|
| 387 | endif
 | 
|---|
| 388 | $(eval-opt-var def_target_sources)
 | 
|---|
| 389 | 
 | 
|---|
| 390 | 
 | 
|---|
| 391 | ##
 | 
|---|
| 392 | # Install a debug directory.
 | 
|---|
| 393 | # @param    debug_dir           The directory name.
 | 
|---|
| 394 | define def_link_install_debug_dir_rule
 | 
|---|
| 395 | local dir := $(debug_inst_path)/$(debug_inst2)$(debug_dir)
 | 
|---|
| 396 | $$(call KB_FN_ASSERT_ABSPATH,dir)
 | 
|---|
| 397 | $$(dir): | $$$$(dir $$$$(patsubst %/,%,$$$$@))
 | 
|---|
| 398 |         %$$(call MSG_INST_DIR,$$@)
 | 
|---|
| 399 |         $$(QUIET)$$(MKDIR) -p -- $$@
 | 
|---|
| 400 | $(target)_2_DEBUG_$(debug_var)_TARGET_DIRS += $$(dir)
 | 
|---|
| 401 | endef # def_link_install_debug_dir_rule
 | 
|---|
| 402 | 
 | 
|---|
| 403 | ##
 | 
|---|
| 404 | # Install a debug file.
 | 
|---|
| 405 | # @param    debug_file          Src=>Dst file pair.
 | 
|---|
| 406 | define def_link_install_debug_file_rule
 | 
|---|
| 407 | local dst := $(debug_inst_path)/$(debug_inst2)$(word 2, $(subst =>,$(SP),$(debug_file)))
 | 
|---|
| 408 | $$(call KB_FN_ASSERT_ABSPATH,dst)
 | 
|---|
| 409 | local src := $(word 1, $(subst =>,$(SP),$(debug_file)))
 | 
|---|
| 410 | $$(call KB_FN_ASSERT_ABSPATH,src)
 | 
|---|
| 411 | $$(dst): $$(src) | $$$$(dir $$$$@)
 | 
|---|
| 412 |         %$$(call MSG_INST_FILE,$$<,$$@)
 | 
|---|
| 413 |         $$(QUIET)$(debug_install_cmd) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $$< $$@
 | 
|---|
| 414 | $(target)_2_DEBUG_$(debug_var)_TARGET_FILES += $$(dst)
 | 
|---|
| 415 | endef # def_link_install_debug_file_rule
 | 
|---|
| 416 | 
 | 
|---|
| 417 | ##
 | 
|---|
| 418 | # Install debug info to $(debug_inst), where debug_inst can be a directory or
 | 
|---|
| 419 | # file (just like $(inst) and $(stage).  Used for both staging and installing.
 | 
|---|
| 420 | define def_target_install_only_debug
 | 
|---|
| 421 | if "$(substr $(debug_inst),-1,1)" == "/"
 | 
|---|
| 422 |  if "$(debug_inst)" == "./"
 | 
|---|
| 423 |   local debug_inst2 :=
 | 
|---|
| 424 |  else
 | 
|---|
| 425 |   local debug_inst2 := $(debug_inst)
 | 
|---|
| 426 |  endif
 | 
|---|
| 427 |  local debug_dirs  := $(patsubst $($(target)_0_OUTDIR)/%,%,$($(target)_2_OUTPUT_DEBUG_DIRS))
 | 
|---|
| 428 |  ifneq ($(strip $(root $(debug_dirs))),)
 | 
|---|
| 429 |   $(error kBuild: Bad tool? debug_dirs='$(debug_dirs)', expected all to be under '$(outbase)')
 | 
|---|
| 430 |  endif
 | 
|---|
| 431 |  local debug_files := $(foreach file, $(patsubst $($(target)_0_OUTDIR)/%,%,$($(target)_2_OUTPUT_DEBUG_FILES)) \
 | 
|---|
| 432 |                         ,$($(target)_0_OUTDIR)/$(file)=>$(file))
 | 
|---|
| 433 | else
 | 
|---|
| 434 |  local debug_notdir:= $(notdir $(debug_inst))
 | 
|---|
| 435 |  local debug_inst2 := $(dir $(debug_inst))
 | 
|---|
| 436 |  local debug_files := $(call TOOL_$(tool)_$(tool_do)_DEBUG_INSTALL_FN,$(out),$(outbase),$(debug_notdir))
 | 
|---|
| 437 |  local debug_dirs  := $(filter     %/,$(debug_files))
 | 
|---|
| 438 |  local debug_files := $(filter-out %/,$(debug_files))
 | 
|---|
| 439 | endif
 | 
|---|
| 440 | $(foreach debug_dir, $(debug_dirs), $(eval $(def_link_install_debug_dir_rule)))
 | 
|---|
| 441 | $(foreach debug_file, $(debug_files), $(eval $(def_link_install_debug_file_rule)))
 | 
|---|
| 442 | endef
 | 
|---|
| 443 | 
 | 
|---|
| 444 | 
 | 
|---|
| 445 | ## Generic macro for generating the install rule(s) for a target.
 | 
|---|
| 446 | #
 | 
|---|
| 447 | # @param        $(target)   Normalized target name.
 | 
|---|
| 448 | # @param        $(out)      The output file.
 | 
|---|
| 449 | # @param        $(typevar)  The name of the variable with all the root targets of its type.
 | 
|---|
| 450 | # @param        $(target_type_mode) The default file mode implied by the target type.
 | 
|---|
| 451 | define def_target_install_only
 | 
|---|
| 452 | if1of ($($(target)_1_INSTTYPE) $($(target)_1_DEBUG_INSTTYPE), both stage)
 | 
|---|
| 453 |  # Determin common variables.
 | 
|---|
| 454 |  local mode := $(firstword \
 | 
|---|
| 455 |         $($(target)_MODE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 456 |         $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 457 |         $($(target)_MODE.$(bld_trg).$(bld_type)) \
 | 
|---|
| 458 |         $($(target)_MODE.$(bld_trg_arch)) \
 | 
|---|
| 459 |         $($(target)_MODE.$(bld_trg)) \
 | 
|---|
| 460 |         $($(target)_MODE.$(bld_type)) \
 | 
|---|
| 461 |         $($(target)_MODE) \
 | 
|---|
| 462 |         $(target_type_mode) )
 | 
|---|
| 463 |  local uid := $(firstword \
 | 
|---|
| 464 |         $($(target)_UID.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 465 |         $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 466 |         $($(target)_UID.$(bld_trg).$(bld_type)) \
 | 
|---|
| 467 |         $($(target)_UID.$(bld_trg_arch)) \
 | 
|---|
| 468 |         $($(target)_UID.$(bld_trg)) \
 | 
|---|
| 469 |         $($(target)_UID.$(bld_type)) \
 | 
|---|
| 470 |         $($(target)_UID) )
 | 
|---|
| 471 |  local gid := $(firstword \
 | 
|---|
| 472 |         $($(target)_GID.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 473 |         $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 474 |         $($(target)_GID.$(bld_trg).$(bld_type)) \
 | 
|---|
| 475 |         $($(target)_GID.$(bld_trg_arch)) \
 | 
|---|
| 476 |         $($(target)_GID.$(bld_trg)) \
 | 
|---|
| 477 |         $($(target)_GID.$(bld_type)) \
 | 
|---|
| 478 |         $($(target)_GID) )
 | 
|---|
| 479 |  local pre_install_cmds  := $(evalcall def_fn_prop_get_first_defined,PRE_INST_CMDS)
 | 
|---|
| 480 |  local post_install_cmds := $(evalcall def_fn_prop_get_first_defined,POST_INST_CMDS)
 | 
|---|
| 481 | endif
 | 
|---|
| 482 | 
 | 
|---|
| 483 | ifneq ($($(target)_1_INSTTYPE),none)
 | 
|---|
| 484 |  # Generate the rules
 | 
|---|
| 485 |  ifeq ($($(target)_1_INSTTYPE),both)
 | 
|---|
| 486 | $(eval $(def_link_install_rule))
 | 
|---|
| 487 |   _INSTALLS_FILES += $($(target)_1_INST_TARGET)
 | 
|---|
| 488 |  endif
 | 
|---|
| 489 | $(eval $(def_link_stage_rule))
 | 
|---|
| 490 |  _STAGE_FILES += $($(target)_1_STAGE_TARGET)
 | 
|---|
| 491 |  $(typevar) += $($(target)_1_STAGE_TARGET)
 | 
|---|
| 492 | else  # INSTTYPE == none
 | 
|---|
| 493 |  $(typevar) += $(out)
 | 
|---|
| 494 | endif # INSTTYPE == none
 | 
|---|
| 495 | 
 | 
|---|
| 496 | # Install debug info.
 | 
|---|
| 497 | $(target)_2_DEBUG_STAGE_TARGET_DIRS :=
 | 
|---|
| 498 | $(target)_2_DEBUG_STAGE_TARGET_FILES :=
 | 
|---|
| 499 | $(target)_2_DEBUG_INSTALL_TARGET_DIRS :=
 | 
|---|
| 500 | $(target)_2_DEBUG_INSTALL_TARGET_FILES :=
 | 
|---|
| 501 | 
 | 
|---|
| 502 | if  (   defined($(target)_2_OUTPUT_DEBUG_DIRS) \
 | 
|---|
| 503 |      || defined($(target)_2_OUTPUT_DEBUG_FILES) ) \
 | 
|---|
| 504 |  && "$($(target)_1_DEBUG_INSTTYPE)" != "none"
 | 
|---|
| 505 |  local mode := $(if $(mode),$(mode)$(COMMA)a-x,0644)
 | 
|---|
| 506 | 
 | 
|---|
| 507 |  ifeq ($($(target)_1_DEBUG_INSTTYPE),both)
 | 
|---|
| 508 |   local debug_inst_path   := $(PATH_INS)
 | 
|---|
| 509 |   local debug_install_cmd := $(INSTALL)
 | 
|---|
| 510 |   local debug_var         := INSTALL
 | 
|---|
| 511 |   $(foreach debug_inst, $($(target)_1_DEBUG_INST), $(evalvalctx def_target_install_only_debug))
 | 
|---|
| 512 |  endif
 | 
|---|
| 513 | 
 | 
|---|
| 514 |  local debug_inst_path    := $(PATH_STAGE)
 | 
|---|
| 515 |  local debug_install_cmd  := $(INSTALL_STAGING)
 | 
|---|
| 516 |  local debug_var          := STAGE
 | 
|---|
| 517 |  if1of ($($(target)_1_DEBUG_INSTTYPE), stage both)
 | 
|---|
| 518 |   $(foreach debug_inst, $($(target)_1_DEBUG_STAGE), $(evalvalctx def_target_install_only_debug))
 | 
|---|
| 519 |  endif
 | 
|---|
| 520 |  if1of ($($(target)_1_INSTTYPE), stage both)
 | 
|---|
| 521 |   ifndef debug_nostage
 | 
|---|
| 522 |    $(foreach debug_inst,$($(target)_1_STAGE), $(evalvalctx def_target_install_only_debug))
 | 
|---|
| 523 |   endif
 | 
|---|
| 524 |  endif
 | 
|---|
| 525 | 
 | 
|---|
| 526 |  _DEBUG_STAGE_DIRS    += $($(target)_2_DEBUG_STAGE_TARGET_DIRS)
 | 
|---|
| 527 |  _DEBUG_STAGE_FILES   += $($(target)_2_DEBUG_STAGE_TARGET_FILES)
 | 
|---|
| 528 |  _DEBUG_INSTALL_DIRS  += $($(target)_2_DEBUG_INSTALL_TARGET_DIRS)
 | 
|---|
| 529 |  _DEBUG_INSTALL_FILES += $($(target)_2_DEBUG_INSTALL_TARGET_FILES)
 | 
|---|
| 530 | 
 | 
|---|
| 531 |  $(basename $(notdir $(out))):: $($(target)_2_DEBUG_STAGE_TARGET_DIRS) $($(target)_2_DEBUG_STAGE_TARGET_FILES)
 | 
|---|
| 532 | endif
 | 
|---|
| 533 | 
 | 
|---|
| 534 | endef # def_target_install_only
 | 
|---|
| 535 | 
 | 
|---|
| 536 | 
 | 
|---|
| 537 | 
 | 
|---|
| 538 | #
 | 
|---|
| 539 | # LIBRARIES
 | 
|---|
| 540 | #
 | 
|---|
| 541 | 
 | 
|---|
| 542 | ## Library (one).
 | 
|---|
| 543 | # @param    $(target)   Normalized library (target) name.
 | 
|---|
| 544 | define def_lib
 | 
|---|
| 545 | # library basics
 | 
|---|
| 546 | ## @todo prefix
 | 
|---|
| 547 | local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(KBUILD_TYPE))
 | 
|---|
| 548 | local bld_trg     := $(firstword $($(target)_BLD_TRG)      $(KBUILD_TARGET))
 | 
|---|
| 549 | local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
 | 
|---|
| 550 | local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(KBUILD_TARGET_CPU))
 | 
|---|
| 551 | local tool        := $(call _TARGET_TOOL,$(target),AR)
 | 
|---|
| 552 | ifeq ($(tool),)
 | 
|---|
| 553 | $(error kBuild: Library target $(target) does not have a tool defined!)
 | 
|---|
| 554 | endif
 | 
|---|
| 555 | local name        := $(firstword\
 | 
|---|
| 556 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| 557 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 558 |         $($(target)_NAME.$(bld_trg).$(bld_type))\
 | 
|---|
| 559 |         $($(target)_NAME.$(bld_trg_arch))\
 | 
|---|
| 560 |         $($(target)_NAME.$(bld_trg))\
 | 
|---|
| 561 |         $($(target)_NAME.$(bld_type))\
 | 
|---|
| 562 |         $($(target)_NAME)\
 | 
|---|
| 563 |         $(target))
 | 
|---|
| 564 | local outbase     := $(call TARGET_BASE,$(name),$(target))
 | 
|---|
| 565 | $(target)_0_OUTDIR:= $(patsubst %/,%,$(dir $(outbase)))
 | 
|---|
| 566 | $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
 | 
|---|
| 567 | local suff        := $(firstword\
 | 
|---|
| 568 |         $($(target)_LIBSUFF.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 569 |         $($(target)_LIBSUFF.$(bld_trg))\
 | 
|---|
| 570 |         $($(target)_LIBSUFF)\
 | 
|---|
| 571 |         $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 572 |         $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg))\
 | 
|---|
| 573 |         $(TOOL_$(tool)_ARLIBSUFF)\
 | 
|---|
| 574 |         $(SUFF_LIB))
 | 
|---|
| 575 | local out         := $(outbase)$(suff)
 | 
|---|
| 576 | local defpath     := $($(target)_DEFPATH)
 | 
|---|
| 577 | ifeq ($(defpath),)
 | 
|---|
| 578 |  local defpath    := $($(target)_PATH)
 | 
|---|
| 579 | endif
 | 
|---|
| 580 | $(target)_1_TARGET:= $(out)
 | 
|---|
| 581 | $(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
 | 
|---|
| 582 | # no local here - must be writable across some foreachs.
 | 
|---|
| 583 | othersrc          :=
 | 
|---|
| 584 | $(target)_2_OBJS  :=
 | 
|---|
| 585 | $(target)_2_INTERMEDIATES =
 | 
|---|
| 586 | 
 | 
|---|
| 587 | # kObjCache.
 | 
|---|
| 588 | ifdef KBUILD_USE_KOBJCACHE
 | 
|---|
| 589 |  ifneq ($($(target)_KOBJCACHE),)
 | 
|---|
| 590 | local use_objcache := 1
 | 
|---|
| 591 |  else
 | 
|---|
| 592 | local use_objcache :=
 | 
|---|
| 593 |  endif
 | 
|---|
| 594 | local use_objcache :=
 | 
|---|
| 595 | endif
 | 
|---|
| 596 | 
 | 
|---|
| 597 | # Target level intermediates (before units!).
 | 
|---|
| 598 | local target_intermediate_vars := $$$$($(target)_2_INTERMEDIATES) $(foreach var, \
 | 
|---|
| 599 |         $(target)_INTERMEDIATES \
 | 
|---|
| 600 |         $(target)_INTERMEDIATES.$(bld_trg) \
 | 
|---|
| 601 |         $(target)_INTERMEDIATES.$(bld_trg).$(bld_trg_arch) \
 | 
|---|
| 602 |         $(target)_INTERMEDIATES.$(bld_trg_arch) \
 | 
|---|
| 603 |         $(target)_INTERMEDIATES.$(bld_trg_cpu) \
 | 
|---|
| 604 |         $(target)_INTERMEDIATES.$(bld_type) \
 | 
|---|
| 605 |         ,$(if-expr defined($(var)),$$$$($(var)),))
 | 
|---|
| 606 | 
 | 
|---|
| 607 | # Do units pre source callouts.
 | 
|---|
| 608 | local units       := \
 | 
|---|
| 609 |         $($(target)_USES.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 610 |         $($(target)_USES.$(bld_trg_arch))\
 | 
|---|
| 611 |         $($(target)_USES.$(bld_trg))\
 | 
|---|
| 612 |         $($(target)_USES.$(bld_type))\
 | 
|---|
| 613 |         $($(target)_USES)
 | 
|---|
| 614 | $(foreach unit,$(units),$(evalvalctx def_unit_$(unit)_target_pre))
 | 
|---|
| 615 | $(foreach unit,$(units),$(evalvalctx def_unit_$(unit)_target_pre_2))
 | 
|---|
| 616 | 
 | 
|---|
| 617 | # source -> object
 | 
|---|
| 618 | $(evalval def_target_sources)
 | 
|---|
| 619 | 
 | 
|---|
| 620 | # library linking
 | 
|---|
| 621 | local tool        := $(call _TARGET_TOOL,$(target),AR)
 | 
|---|
| 622 | local name        := $(firstword\
 | 
|---|
| 623 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| 624 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 625 |         $($(target)_NAME.$(bld_trg).$(bld_type))\
 | 
|---|
| 626 |         $($(target)_NAME.$(bld_trg_arch))\
 | 
|---|
| 627 |         $($(target)_NAME.$(bld_trg))\
 | 
|---|
| 628 |         $($(target)_NAME.$(bld_type))\
 | 
|---|
| 629 |         $($(target)_NAME)\
 | 
|---|
| 630 |         $(target))
 | 
|---|
| 631 | local outbase     := $(call TARGET_BASE,$(name),$(target))
 | 
|---|
| 632 | local flags       :=\
 | 
|---|
| 633 |         $(TOOL_$(tool)_ARFLAGS)\
 | 
|---|
| 634 |         $(TOOL_$(tool)_ARFLAGS.$(bld_type))\
 | 
|---|
| 635 |         $(ARFLAGS)\
 | 
|---|
| 636 |         $(ARFLAGS.$(bld_type))\
 | 
|---|
| 637 |         $($(target)_ARFLAGS)\
 | 
|---|
| 638 |         $($(target)_ARFLAGS.$(bld_type)) \
 | 
|---|
| 639 |         $($(target)_ARFLAGS.$(bld_trg)) \
 | 
|---|
| 640 |         $($(target)_ARFLAGS.$(bld_trg_arch)) \
 | 
|---|
| 641 |         $($(target)_ARFLAGS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 642 |         $($(target)_ARFLAGS.$(bld_trg_cpu))
 | 
|---|
| 643 | local dirdep      := $(call DIRDEP,$(dir $(out)))
 | 
|---|
| 644 | local deps        := \
 | 
|---|
| 645 |         $($(target)_DEPS.$(bld_trg_cpu)) \
 | 
|---|
| 646 |         $($(target)_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 647 |         $($(target)_DEPS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 648 |         $($(target)_DEPS.$(bld_trg).$(bld_type)) \
 | 
|---|
| 649 |         $($(target)_DEPS.$(bld_trg_arch)) \
 | 
|---|
| 650 |         $($(target)_DEPS.$(bld_trg)) \
 | 
|---|
| 651 |         $($(target)_DEPS.$(bld_type)) \
 | 
|---|
| 652 |         $($(target)_DEPS) \
 | 
|---|
| 653 |         $($(target)_LNK_DEPS.$(bld_trg_cpu)) \
 | 
|---|
| 654 |         $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 655 |         $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 656 |         $($(target)_LNK_DEPS.$(bld_trg).$(bld_type)) \
 | 
|---|
| 657 |         $($(target)_LNK_DEPS.$(bld_trg_arch)) \
 | 
|---|
| 658 |         $($(target)_LNK_DEPS.$(bld_trg)) \
 | 
|---|
| 659 |         $($(target)_LNK_DEPS.$(bld_type)) \
 | 
|---|
| 660 |         $($(target)_LNK_DEPS)
 | 
|---|
| 661 | local orderdeps   := \
 | 
|---|
| 662 |         $($(target)_ORDERDEPS.$(bld_trg_cpu)) \
 | 
|---|
| 663 |         $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 664 |         $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 665 |         $($(target)_ORDERDEPS.$(bld_trg).$(bld_type)) \
 | 
|---|
| 666 |         $($(target)_ORDERDEPS.$(bld_trg_arch)) \
 | 
|---|
| 667 |         $($(target)_ORDERDEPS.$(bld_trg)) \
 | 
|---|
| 668 |         $($(target)_ORDERDEPS.$(bld_type)) \
 | 
|---|
| 669 |         $($(target)_ORDERDEPS) \
 | 
|---|
| 670 |         $($(target)_LNK_ORDERDEPS.$(bld_trg_cpu)) \
 | 
|---|
| 671 |         $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 672 |         $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 673 |         $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_type)) \
 | 
|---|
| 674 |         $($(target)_LNK_ORDERDEPS.$(bld_trg_arch)) \
 | 
|---|
| 675 |         $($(target)_LNK_ORDERDEPS.$(bld_trg)) \
 | 
|---|
| 676 |         $($(target)_LNK_ORDERDEPS.$(bld_type)) \
 | 
|---|
| 677 |         $($(target)_LNK_ORDERDEPS)
 | 
|---|
| 678 | 
 | 
|---|
| 679 | # Adjust paths if we got a default path.
 | 
|---|
| 680 | ifneq ($(defpath),)
 | 
|---|
| 681 |  local deps       := $(abspathex $(deps),$(defpath))
 | 
|---|
| 682 |  local orderdeps  := $(abspathex $(orderdeps),$(defpath))
 | 
|---|
| 683 |  othersrc := $(abspathex $(othersrc),$(defpath))
 | 
|---|
| 684 | endif
 | 
|---|
| 685 | 
 | 
|---|
| 686 | 
 | 
|---|
| 687 | # Custom pre-link actions.
 | 
|---|
| 688 | local pre_cmds  := $(evalcall def_fn_prop_get_all_prefixed_priority_last,PRE_CMDS,$(NLTAB))
 | 
|---|
| 689 | local post_cmds := $(evalcall def_fn_prop_get_all_prefixed_priority_last,POST_CMDS,$(NLTAB))
 | 
|---|
| 690 | 
 | 
|---|
| 691 | # eliminate this guy?
 | 
|---|
| 692 | local objs = $($(target)_2_OBJS)
 | 
|---|
| 693 | 
 | 
|---|
| 694 | # dependency file
 | 
|---|
| 695 | local dep := $(out)$(SUFF_DEP)
 | 
|---|
| 696 | ifndef NO_LINK_CMDS_DEPS
 | 
|---|
| 697 |  _DEPFILES_INCLUDED += $(dep)
 | 
|---|
| 698 |  ifdef KB_HAVE_INCLUDEDEP_QUEUE
 | 
|---|
| 699 |   includedep-queue $(dep)
 | 
|---|
| 700 |  else
 | 
|---|
| 701 |   includedep $(dep)
 | 
|---|
| 702 |  endif
 | 
|---|
| 703 | endif
 | 
|---|
| 704 | 
 | 
|---|
| 705 | # check that the tool is defined.
 | 
|---|
| 706 | ifndef TOOL_$(tool)_LINK_LIBRARY_CMDS
 | 
|---|
| 707 | $(warning kBuild: tools: \
 | 
|---|
| 708 |         1 $($(target)_$(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 709 |         2 $($(target)_$(source)TOOL.$(bld_trg)) \
 | 
|---|
| 710 |         3 $($(target)_$(source)TOOL) \
 | 
|---|
| 711 |         4 $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 712 |         5 $($(target)_TOOL.$(bld_trg)) \
 | 
|---|
| 713 |         6 $($(target)_TOOL) \
 | 
|---|
| 714 |         7 $($(source)TOOL) \
 | 
|---|
| 715 |         8 $($(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 716 |         9 $($(source)TOOL.$(bld_trg)) \
 | 
|---|
| 717 |         10 $(TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 718 |         11 $(TOOL.$(bld_trg)) \
 | 
|---|
| 719 |         12 $(TOOL) )
 | 
|---|
| 720 | $(error kBuild: TOOL_$(tool)_LINK_LIBRARY_CMDS isn't defined! target=$(target) )
 | 
|---|
| 721 | endif
 | 
|---|
| 722 | 
 | 
|---|
| 723 | # call the tool
 | 
|---|
| 724 | local  cmds := $(TOOL_$(tool)_LINK_LIBRARY_CMDS)
 | 
|---|
| 725 | ifneq ($(pre_cmds),)
 | 
|---|
| 726 |  local cmds := $(TAB)$(pre_cmds)$(NL)$(TAB)$(cmds)
 | 
|---|
| 727 | endif
 | 
|---|
| 728 | ifneq ($(post_cmds),)
 | 
|---|
| 729 |  local cmds := $(cmds)$(NL)$(TAB)$(post_cmds)
 | 
|---|
| 730 | endif
 | 
|---|
| 731 | $(target)_2_OUTPUT := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT)
 | 
|---|
| 732 | $(target)_2_OUTPUT_MAYBE := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT_MAYBE)
 | 
|---|
| 733 | $(target)_2_OUTPUT_MAYBE_PRECIOUS := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT_MAYBE_PRECIOUS)
 | 
|---|
| 734 | $(target)_2_DEPEND := $(TOOL_$(tool)_LINK_LIBRARY_DEPEND) $(deps) $($(target)_2_OBJS)
 | 
|---|
| 735 | $(target)_2_DEPORD := $(TOOL_$(tool)_LINK_LIBRARY_DEPORD) $(dirdep) $(orderdeps)
 | 
|---|
| 736 | 
 | 
|---|
| 737 | # generate the link rule.
 | 
|---|
| 738 | $(eval $(def_link_rule))
 | 
|---|
| 739 | 
 | 
|---|
| 740 | # installing and globals.
 | 
|---|
| 741 | local target_type_mode := a+r,u+w
 | 
|---|
| 742 | $(evalval def_target_install_only)
 | 
|---|
| 743 | 
 | 
|---|
| 744 | _OUT_FILES += $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE) $($(target)_2_OUTPUT_MAYBE_PRECIOUS) $(out)
 | 
|---|
| 745 | _CLEAN_FILES += $($(target)_CLEAN) $($(target)_CLEAN.$(bld_trg)) $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_cpu)) $($(target)_CLEAN.$(bld_type))
 | 
|---|
| 746 | _DIRS += $($(target)_BLDDIRS) $($(target)_BLDDIRS.$(bld_trg)) $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_cpu)) $($(target)_BLDDIRS.$(bld_type))
 | 
|---|
| 747 | _OBJS += $($(target)_2_OBJS)
 | 
|---|
| 748 | 
 | 
|---|
| 749 | endef # def_lib
 | 
|---|
| 750 | $(eval-opt-var def_lib)
 | 
|---|
| 751 | 
 | 
|---|
| 752 | # Process libraries
 | 
|---|
| 753 | typevar := _LIBS
 | 
|---|
| 754 | tool_do := LINK_LIBRARY
 | 
|---|
| 755 | mode := 0644
 | 
|---|
| 756 | $(foreach target, $(_ALL_LIBRARIES), $(evalvalctx def_lib))
 | 
|---|
| 757 | 
 | 
|---|
| 758 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| 759 |  $(evalcall def_profile_self, done library targets)
 | 
|---|
| 760 | endif
 | 
|---|
| 761 | 
 | 
|---|
| 762 | 
 | 
|---|
| 763 | #
 | 
|---|
| 764 | # Link operations.
 | 
|---|
| 765 | #
 | 
|---|
| 766 | 
 | 
|---|
| 767 | ##
 | 
|---|
| 768 | # Link prolog
 | 
|---|
| 769 | #
 | 
|---|
| 770 | # @param    $(target)   Normalized target name.
 | 
|---|
| 771 | # @param    $(EXT)      EXE,DLL,SYS.
 | 
|---|
| 772 | # @param    $(typevar)  The name of the variable with all the root targets of its type.
 | 
|---|
| 773 | define def_link_common
 | 
|---|
| 774 | # basics
 | 
|---|
| 775 | local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(KBUILD_TYPE))
 | 
|---|
| 776 | local bld_trg     := $(firstword $($(target)_BLD_TRG)      $(KBUILD_$(bld_trg_base_var)))
 | 
|---|
| 777 | local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_$(bld_trg_base_var)_ARCH))
 | 
|---|
| 778 | local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(KBUILD_$(bld_trg_base_var)_CPU))
 | 
|---|
| 779 | 
 | 
|---|
| 780 | local tool        := $(call _TARGET_TOOL,$(target),LD)
 | 
|---|
| 781 | local name        := $(firstword\
 | 
|---|
| 782 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| 783 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 784 |         $($(target)_NAME.$(bld_trg).$(bld_type))\
 | 
|---|
| 785 |         $($(target)_NAME.$(bld_trg_arch))\
 | 
|---|
| 786 |         $($(target)_NAME.$(bld_trg))\
 | 
|---|
| 787 |         $($(target)_NAME.$(bld_type))\
 | 
|---|
| 788 |         $($(target)_NAME)\
 | 
|---|
| 789 |         $(target))
 | 
|---|
| 790 | local outbase     := $(call TARGET_BASE,$(name),$(target))
 | 
|---|
| 791 | $(target)_0_OUTDIR:= $(patsubst %/,%,$(dir $(outbase)))
 | 
|---|
| 792 | $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
 | 
|---|
| 793 | local suff := $(firstword \
 | 
|---|
| 794 |         $($(target)_$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 795 |         $($(target)_$(EXT)SUFF.$(bld_trg))\
 | 
|---|
| 796 |         $($(target)_$(EXT)SUFF)\
 | 
|---|
| 797 |         $(TOOL_$(tool)_LD$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 798 |         $(TOOL_$(tool)_LD$(EXT)SUFF.$(bld_trg))\
 | 
|---|
| 799 |         $(TOOL_$(tool)_LD$(EXT)SUFF)\
 | 
|---|
| 800 |         $($(EXTPRE)SUFF_$(EXT)) )
 | 
|---|
| 801 | local out         := $(outbase)$(suff)
 | 
|---|
| 802 | $(target)_1_TARGET:= $(out)
 | 
|---|
| 803 | $(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
 | 
|---|
| 804 | local defpath     := $($(target)_DEFPATH)
 | 
|---|
| 805 | ifeq ($(defpath),)
 | 
|---|
| 806 |  local defpath    := $($(target)_PATH)
 | 
|---|
| 807 | endif
 | 
|---|
| 808 | # no local here - must be writable across some foreachs.
 | 
|---|
| 809 | othersrc          :=
 | 
|---|
| 810 | $(target)_2_OBJS  :=
 | 
|---|
| 811 | $(target)_2_INTERMEDIATES =
 | 
|---|
| 812 | 
 | 
|---|
| 813 | # kObjCache.
 | 
|---|
| 814 | ifdef KBUILD_USE_KOBJCACHE
 | 
|---|
| 815 |  ifneq ($($(target)_KOBJCACHE),)
 | 
|---|
| 816 | local use_objcache := 1
 | 
|---|
| 817 |  else
 | 
|---|
| 818 | local use_objcache :=
 | 
|---|
| 819 |  endif
 | 
|---|
| 820 | local use_objcache :=
 | 
|---|
| 821 | endif
 | 
|---|
| 822 | 
 | 
|---|
| 823 | # Target level intermediates (before units!).
 | 
|---|
| 824 | local target_intermediate_vars := $$$$($(target)_2_INTERMEDIATES) $(foreach var, \
 | 
|---|
| 825 |         $(target)_INTERMEDIATES \
 | 
|---|
| 826 |         $(target)_INTERMEDIATES.$(bld_trg) \
 | 
|---|
| 827 |         $(target)_INTERMEDIATES.$(bld_trg).$(bld_trg_arch) \
 | 
|---|
| 828 |         $(target)_INTERMEDIATES.$(bld_trg_arch) \
 | 
|---|
| 829 |         $(target)_INTERMEDIATES.$(bld_trg_cpu) \
 | 
|---|
| 830 |         $(target)_INTERMEDIATES.$(bld_type) \
 | 
|---|
| 831 |         ,$(if-expr defined($(var)),$$$$($(var)),))
 | 
|---|
| 832 | 
 | 
|---|
| 833 | # Do units pre source callouts.
 | 
|---|
| 834 | local units       := \
 | 
|---|
| 835 |         $($(target)_USES.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 836 |         $($(target)_USES.$(bld_trg_arch))\
 | 
|---|
| 837 |         $($(target)_USES.$(bld_trg))\
 | 
|---|
| 838 |         $($(target)_USES.$(bld_type))\
 | 
|---|
| 839 |         $($(target)_USES)
 | 
|---|
| 840 | $(foreach unit,$(units),$(evalvalctx def_unit_$(unit)_target_pre))
 | 
|---|
| 841 | $(foreach unit,$(units),$(evalvalctx def_unit_$(unit)_target_pre_2))
 | 
|---|
| 842 | 
 | 
|---|
| 843 | # source -> object
 | 
|---|
| 844 | $(evalval def_target_sources)
 | 
|---|
| 845 | 
 | 
|---|
| 846 | # more link stuff.
 | 
|---|
| 847 | local tool        := $(call _TARGET_TOOL,$(target),LD)
 | 
|---|
| 848 | local name        := $(firstword\
 | 
|---|
| 849 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| 850 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 851 |         $($(target)_NAME.$(bld_trg).$(bld_type))\
 | 
|---|
| 852 |         $($(target)_NAME.$(bld_trg_arch))\
 | 
|---|
| 853 |         $($(target)_NAME.$(bld_trg))\
 | 
|---|
| 854 |         $($(target)_NAME.$(bld_type))\
 | 
|---|
| 855 |         $($(target)_NAME)\
 | 
|---|
| 856 |         $(target))
 | 
|---|
| 857 | local outbase     := $(call TARGET_BASE,$(name),$(target))
 | 
|---|
| 858 | local flags       :=\
 | 
|---|
| 859 |         $(TOOL_$(tool)_LDFLAGS)\
 | 
|---|
| 860 |         $(TOOL_$(tool)_LDFLAGS.$(bld_type))\
 | 
|---|
| 861 |         $(TOOL_$(tool)_LDFLAGS.$(bld_trg))\
 | 
|---|
| 862 |         $(TOOL_$(tool)_LDFLAGS.$(bld_trg_arch))\
 | 
|---|
| 863 |         $(TOOL_$(tool)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 864 |         $(TOOL_$(tool)_LDFLAGS.$(bld_trg_cpu))\
 | 
|---|
| 865 |         $(foreach sdk, $(SDKS) \
 | 
|---|
| 866 |                        $(SDKS.$(bld_type)) \
 | 
|---|
| 867 |                        $(SDKS.$(bld_trg)) \
 | 
|---|
| 868 |                        $(SDKS.$(bld_trg_arch)) \
 | 
|---|
| 869 |                        $(SDKS.$(bld_trg).$(bld_trg_arch)),\
 | 
|---|
| 870 |                 $(SDK_$(sdk)_LDFLAGS)\
 | 
|---|
| 871 |                 $(SDK_$(sdk)_LDFLAGS.$(bld_type))\
 | 
|---|
| 872 |                 $(SDK_$(sdk)_LDFLAGS.$(bld_trg))\
 | 
|---|
| 873 |                 $(SDK_$(sdk)_LDFLAGS.$(bld_trg_arch))\
 | 
|---|
| 874 |                 $(SDK_$(sdk)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 875 |                 $(SDK_$(sdk)_LDFLAGS.$(bld_trg_cpu)))\
 | 
|---|
| 876 |         $(LDFLAGS)\
 | 
|---|
| 877 |         $(LDFLAGS.$(bld_type))\
 | 
|---|
| 878 |         $(LDFLAGS.$(bld_trg))\
 | 
|---|
| 879 |         $(LDFLAGS.$(bld_trg_arch))\
 | 
|---|
| 880 |         $(LDFLAGS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 881 |         $(LDFLAGS.$(bld_trg_cpu))\
 | 
|---|
| 882 |         $(foreach sdk, $($(target)_SDKS) \
 | 
|---|
| 883 |                        $($(target)_SDKS.$(bld_type)) \
 | 
|---|
| 884 |                        $($(target)_SDKS.$(bld_trg)) \
 | 
|---|
| 885 |                        $($(target)_SDKS.$(bld_trg_arch)) \
 | 
|---|
| 886 |                        $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)),\
 | 
|---|
| 887 |                 $(SDK_$(sdk)_LDFLAGS)\
 | 
|---|
| 888 |                 $(SDK_$(sdk)_LDFLAGS.$(bld_type))\
 | 
|---|
| 889 |                 $(SDK_$(sdk)_LDFLAGS.$(bld_trg))\
 | 
|---|
| 890 |                 $(SDK_$(sdk)_LDFLAGS.$(bld_trg_arch))\
 | 
|---|
| 891 |                 $(SDK_$(sdk)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 892 |                 $(SDK_$(sdk)_LDFLAGS.$(bld_trg_cpu)))\
 | 
|---|
| 893 |         $($(target)_LDFLAGS)\
 | 
|---|
| 894 |         $($(target)_LDFLAGS.$(bld_type))\
 | 
|---|
| 895 |         $($(target)_LDFLAGS.$(bld_trg))\
 | 
|---|
| 896 |         $($(target)_LDFLAGS.$(bld_trg_arch))\
 | 
|---|
| 897 |         $($(target)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 898 |         $($(target)_LDFLAGS.$(bld_trg_cpu))
 | 
|---|
| 899 | local libs        :=\
 | 
|---|
| 900 |         $($(target)_LIBS.$(bld_trg_cpu))\
 | 
|---|
| 901 |         $($(target)_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 902 |         $($(target)_LIBS.$(bld_trg_arch))\
 | 
|---|
| 903 |         $($(target)_LIBS.$(bld_trg))\
 | 
|---|
| 904 |         $($(target)_LIBS.$(bld_type))\
 | 
|---|
| 905 |         $($(target)_LIBS)\
 | 
|---|
| 906 |         $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 907 |                        $($(target)_SDKS.$(bld_trg_arch)) \
 | 
|---|
| 908 |                        $($(target)_SDKS.$(bld_trg)) \
 | 
|---|
| 909 |                        $($(target)_SDKS.$(bld_type)) \
 | 
|---|
| 910 |                        $($(target)_SDKS),\
 | 
|---|
| 911 |                 $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
 | 
|---|
| 912 |                 $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 913 |                 $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
 | 
|---|
| 914 |                 $(SDK_$(sdk)_LIBS.$(bld_trg))\
 | 
|---|
| 915 |                 $(SDK_$(sdk)_LIBS.$(bld_type))\
 | 
|---|
| 916 |                 $(SDK_$(sdk)_LIBS))\
 | 
|---|
| 917 |         $(LIBS.$(bld_trg_cpu))\
 | 
|---|
| 918 |         $(LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 919 |         $(LIBS.$(bld_trg_arch))\
 | 
|---|
| 920 |         $(LIBS.$(bld_trg))\
 | 
|---|
| 921 |         $(LIBS.$(bld_type))\
 | 
|---|
| 922 |         $(LIBS)\
 | 
|---|
| 923 |         $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 924 |                        $(SDKS.$(bld_trg_arch)) \
 | 
|---|
| 925 |                        $(SDKS.$(bld_trg)) \
 | 
|---|
| 926 |                        $(SDKS.$(bld_type)) \
 | 
|---|
| 927 |                        $(SDKS),\
 | 
|---|
| 928 |                 $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
 | 
|---|
| 929 |                 $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 930 |                 $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
 | 
|---|
| 931 |                 $(SDK_$(sdk)_LIBS.$(bld_trg))\
 | 
|---|
| 932 |                 $(SDK_$(sdk)_LIBS.$(bld_type))\
 | 
|---|
| 933 |                 $(SDK_$(sdk)_LIBS))\
 | 
|---|
| 934 |         $(TOOL_$(tool)_LIBS.$(bld_trg_cpu))\
 | 
|---|
| 935 |         $(TOOL_$(tool)_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 936 |         $(TOOL_$(tool)_LIBS.$(bld_trg_arch))\
 | 
|---|
| 937 |         $(TOOL_$(tool)_LIBS.$(bld_trg))\
 | 
|---|
| 938 |         $(TOOL_$(tool)_LIBS.$(bld_type))\
 | 
|---|
| 939 |         $(TOOL_$(tool)_LIBS)
 | 
|---|
| 940 | local libpath    :=\
 | 
|---|
| 941 |         $($(target)_LIBPATH.$(bld_trg_cpu))\
 | 
|---|
| 942 |         $($(target)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 943 |         $($(target)_LIBPATH.$(bld_trg_arch))\
 | 
|---|
| 944 |         $($(target)_LIBPATH.$(bld_trg))\
 | 
|---|
| 945 |         $($(target)_LIBPATH.$(bld_type))\
 | 
|---|
| 946 |         $($(target)_LIBPATH)\
 | 
|---|
| 947 |         $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 948 |                        $($(target)_SDKS.$(bld_trg_arch)) \
 | 
|---|
| 949 |                        $($(target)_SDKS.$(bld_trg)) \
 | 
|---|
| 950 |                        $($(target)_SDKS.$(bld_type)) \
 | 
|---|
| 951 |                        $($(target)_SDKS),\
 | 
|---|
| 952 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
 | 
|---|
| 953 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 954 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
 | 
|---|
| 955 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
 | 
|---|
| 956 |                 $(SDK_$(sdk)_LIBPATH.$(bld_type))\
 | 
|---|
| 957 |                 $(SDK_$(sdk)_LIBPATH))\
 | 
|---|
| 958 |         $(LIBPATH.$(bld_trg_cpu))\
 | 
|---|
| 959 |         $(LIBPATH.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 960 |         $(LIBPATH.$(bld_trg_arch))\
 | 
|---|
| 961 |         $(LIBPATH.$(bld_trg))\
 | 
|---|
| 962 |         $(LIBPATH.$(bld_type))\
 | 
|---|
| 963 |         $(LIBPATH)\
 | 
|---|
| 964 |         $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 965 |                        $(SDKS.$(bld_trg_arch)) \
 | 
|---|
| 966 |                        $(SDKS.$(bld_trg)) \
 | 
|---|
| 967 |                        $(SDKS.$(bld_type)) \
 | 
|---|
| 968 |                        $(SDKS),\
 | 
|---|
| 969 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
 | 
|---|
| 970 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 971 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
 | 
|---|
| 972 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
 | 
|---|
| 973 |                 $(SDK_$(sdk)_LIBPATH.$(bld_type))\
 | 
|---|
| 974 |                 $(SDK_$(sdk)_LIBPATH))\
 | 
|---|
| 975 |         $(TOOL_$(tool)_LIBPATH.$(bld_trg_cpu))\
 | 
|---|
| 976 |         $(TOOL_$(tool)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| 977 |         $(TOOL_$(tool)_LIBPATH.$(bld_trg_arch))\
 | 
|---|
| 978 |         $(TOOL_$(tool)_LIBPATH.$(bld_trg))\
 | 
|---|
| 979 |         $(TOOL_$(tool)_LIBPATH.$(bld_type))\
 | 
|---|
| 980 |         $(TOOL_$(tool)_LIBPATH)
 | 
|---|
| 981 | local dirdep      := $(call DIRDEP,$(dir $(out)))
 | 
|---|
| 982 | local deps        := \
 | 
|---|
| 983 |         $($(target)_DEPS.$(bld_trg_cpu)) \
 | 
|---|
| 984 |         $($(target)_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 985 |         $($(target)_DEPS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 986 |         $($(target)_DEPS.$(bld_trg).$(bld_type)) \
 | 
|---|
| 987 |         $($(target)_DEPS.$(bld_trg_arch)) \
 | 
|---|
| 988 |         $($(target)_DEPS.$(bld_trg)) \
 | 
|---|
| 989 |         $($(target)_DEPS.$(bld_type)) \
 | 
|---|
| 990 |         $($(target)_DEPS) \
 | 
|---|
| 991 |         $($(target)_LNK_DEPS.$(bld_trg_cpu)) \
 | 
|---|
| 992 |         $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 993 |         $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 994 |         $($(target)_LNK_DEPS.$(bld_trg).$(bld_type)) \
 | 
|---|
| 995 |         $($(target)_LNK_DEPS.$(bld_trg_arch)) \
 | 
|---|
| 996 |         $($(target)_LNK_DEPS.$(bld_trg)) \
 | 
|---|
| 997 |         $($(target)_LNK_DEPS.$(bld_type)) \
 | 
|---|
| 998 |         $($(target)_LNK_DEPS)
 | 
|---|
| 999 | local orderdeps   := \
 | 
|---|
| 1000 |         $($(target)_ORDERDEPS.$(bld_trg_cpu)) \
 | 
|---|
| 1001 |         $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 1002 |         $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 1003 |         $($(target)_ORDERDEPS.$(bld_trg).$(bld_type)) \
 | 
|---|
| 1004 |         $($(target)_ORDERDEPS.$(bld_trg_arch)) \
 | 
|---|
| 1005 |         $($(target)_ORDERDEPS.$(bld_trg)) \
 | 
|---|
| 1006 |         $($(target)_ORDERDEPS.$(bld_type)) \
 | 
|---|
| 1007 |         $($(target)_ORDERDEPS) \
 | 
|---|
| 1008 |         $($(target)_LNK_ORDERDEPS.$(bld_trg_cpu)) \
 | 
|---|
| 1009 |         $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
| 1010 |         $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 1011 |         $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_type)) \
 | 
|---|
| 1012 |         $($(target)_LNK_ORDERDEPS.$(bld_trg_arch)) \
 | 
|---|
| 1013 |         $($(target)_LNK_ORDERDEPS.$(bld_trg)) \
 | 
|---|
| 1014 |         $($(target)_LNK_ORDERDEPS.$(bld_type)) \
 | 
|---|
| 1015 |         $($(target)_LNK_ORDERDEPS)
 | 
|---|
| 1016 | 
 | 
|---|
| 1017 | # Adjust paths if we got a default path.
 | 
|---|
| 1018 | ifneq ($(defpath),)
 | 
|---|
| 1019 |  ifdef KMK_WITH_QUOTING
 | 
|---|
| 1020 |   local libpath    := $(qabspathex ,$(libpath),$(defpath))
 | 
|---|
| 1021 |   local deps       := $(qabspathex ,$(deps),$(defpath))
 | 
|---|
| 1022 |   local orderdeps  := $(qabspathex ,$(orderdeps),$(defpath))
 | 
|---|
| 1023 |   othersrc := $(qabspathex ,$(othersrc),$(defpath))
 | 
|---|
| 1024 |  else
 | 
|---|
| 1025 |   local libpath    := $(abspathex $(libpath),$(defpath))
 | 
|---|
| 1026 |   local deps       := $(abspathex $(deps),$(defpath))
 | 
|---|
| 1027 |   local orderdeps  := $(abspathex $(orderdeps),$(defpath))
 | 
|---|
| 1028 |   othersrc := $(abspathex $(othersrc),$(defpath))
 | 
|---|
| 1029 |  endif
 | 
|---|
| 1030 |  # libs are not subject to this because of the the -l<lib> stuff. Use $(<target>_DEFPATH)/lib if relative to current dir!
 | 
|---|
| 1031 | endif
 | 
|---|
| 1032 | 
 | 
|---|
| 1033 | # Debug info.
 | 
|---|
| 1034 | local ld_debug      := $(evalcall def_fn_prop_get_first_defined,LD_DEBUG)
 | 
|---|
| 1035 | local debug_inst    := $(evalcall def_fn_prop_get_first_defined,DEBUG_INST)
 | 
|---|
| 1036 | local debug_stage   := $(evalcall def_fn_prop_get_first_defined,DEBUG_STAGE)
 | 
|---|
| 1037 | local debug_nostage := $(evalcall def_fn_prop_get_first_word,DEBUG_NOSTAGE)
 | 
|---|
| 1038 | 
 | 
|---|
| 1039 | # Custom pre/post-link actions.
 | 
|---|
| 1040 | local pre_cmds      := $(evalcall def_fn_prop_get_all_prefixed_priority_last,PRE_CMDS,$(NLTAB))
 | 
|---|
| 1041 | local post_cmds     := $(evalcall def_fn_prop_get_all_prefixed_priority_last,POST_CMDS,$(NLTAB))
 | 
|---|
| 1042 | 
 | 
|---|
| 1043 | # eliminate this guy?
 | 
|---|
| 1044 | local objs = $($(target)_2_OBJS)
 | 
|---|
| 1045 | 
 | 
|---|
| 1046 | # dependency file
 | 
|---|
| 1047 | local dep := $(outbase)$(SUFF_DEP)
 | 
|---|
| 1048 | ifndef NO_LINK_CMDS_DEPS
 | 
|---|
| 1049 |  _DEPFILES_INCLUDED += $(dep)
 | 
|---|
| 1050 |  ifdef KB_HAVE_INCLUDEDEP_QUEUE
 | 
|---|
| 1051 |   includedep-queue $(dep)
 | 
|---|
| 1052 |  else
 | 
|---|
| 1053 |   includedep $(dep)
 | 
|---|
| 1054 |  endif
 | 
|---|
| 1055 | endif
 | 
|---|
| 1056 | 
 | 
|---|
| 1057 | # check that the tool is defined.
 | 
|---|
| 1058 | ifndef TOOL_$(tool)_$(tool_do)_CMDS
 | 
|---|
| 1059 | $(warning kBuild: tools: \
 | 
|---|
| 1060 |         1 $($(target)_$(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 1061 |         2 $($(target)_$(source)TOOL.$(bld_trg)) \
 | 
|---|
| 1062 |         3 $($(target)_$(source)TOOL) \
 | 
|---|
| 1063 |         4 $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 1064 |         5 $($(target)_TOOL.$(bld_trg)) \
 | 
|---|
| 1065 |         6 $($(target)_TOOL) \
 | 
|---|
| 1066 |         7 $($(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 1067 |         8 $($(source)TOOL.$(bld_trg)) \
 | 
|---|
| 1068 |         9 $($(source)TOOL) \
 | 
|---|
| 1069 |         10 $(TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
| 1070 |         11 $(TOOL.$(bld_trg)) \
 | 
|---|
| 1071 |         12 $(TOOL) )
 | 
|---|
| 1072 | $(error kBuild: TOOL_$(tool)_$(tool_do)_CMDS isn't defined! target=$(target) )
 | 
|---|
| 1073 | endif
 | 
|---|
| 1074 | 
 | 
|---|
| 1075 | # call the tool
 | 
|---|
| 1076 | local cmds   := $(TOOL_$(tool)_$(tool_do)_CMDS)
 | 
|---|
| 1077 | ifneq ($(pre_cmds),)
 | 
|---|
| 1078 |  local cmds  := $(TAB)$(pre_cmds)$(NL)$(TAB)$(cmds)
 | 
|---|
| 1079 | endif
 | 
|---|
| 1080 | ifneq ($(post_cmds),)
 | 
|---|
| 1081 |  local cmds  := $(cmds)$(NL)$(TAB)$(post_cmds)
 | 
|---|
| 1082 | endif
 | 
|---|
| 1083 | $(target)_2_OUTPUT              := $(TOOL_$(tool)_$(tool_do)_OUTPUT)
 | 
|---|
| 1084 | $(target)_2_OUTPUT_MAYBE        := $(TOOL_$(tool)_$(tool_do)_OUTPUT_MAYBE)
 | 
|---|
| 1085 | $(target)_2_OUTPUT_MAYBE_PRECIOUS := $(TOOL_$(tool)_$(tool_do)_OUTPUT_MAYBE_PRECIOUS)
 | 
|---|
| 1086 | if1of ($(ld_debug), split)
 | 
|---|
| 1087 |  $(target)_2_OUTPUT_DEBUG_FILES := $(filter-out %/,$(TOOL_$(tool)_$(tool_do)_OUTPUT_DEBUG))
 | 
|---|
| 1088 |  $(target)_2_OUTPUT_DEBUG_DIRS  := $(filter     %/,$(TOOL_$(tool)_$(tool_do)_OUTPUT_DEBUG))
 | 
|---|
| 1089 | else
 | 
|---|
| 1090 |  $(target)_2_OUTPUT_DEBUG_FILES :=
 | 
|---|
| 1091 |  $(target)_2_OUTPUT_DEBUG_DIRS  :=
 | 
|---|
| 1092 | endif
 | 
|---|
| 1093 | $(target)_2_DEPEND              := $(TOOL_$(tool)_$(tool_do)_DEPEND) $(deps) $($(target)_2_OBJS)
 | 
|---|
| 1094 | $(target)_2_DEPORD              := $(TOOL_$(tool)_$(tool_do)_DEPORD) $(dirdep) $(orderdeps)
 | 
|---|
| 1095 | 
 | 
|---|
| 1096 | # generate the link rule.
 | 
|---|
| 1097 | $(eval $(def_link_rule))
 | 
|---|
| 1098 | 
 | 
|---|
| 1099 | # installation targets
 | 
|---|
| 1100 | local target_type_mode :=
 | 
|---|
| 1101 | $(evalval def_target_install_only)
 | 
|---|
| 1102 | 
 | 
|---|
| 1103 | # Update globals.
 | 
|---|
| 1104 | _OBJS += $($(target)_2_OBJS)
 | 
|---|
| 1105 | _OUT_FILES += $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE) $($(target)_2_OUTPUT_MAYBE_PRECIOUS) $($(target)_2_OUTPUT_DEBUG_FILES) $(out)
 | 
|---|
| 1106 | _CLEAN_FILES += $($(target)_CLEAN) $($(target)_CLEAN.$(bld_trg)) $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_cpu)) $($(target)_CLEAN.$(bld_type))
 | 
|---|
| 1107 | _DIRS += $($(target)_BLDDIRS) $($(target)_BLDDIRS.$(bld_trg)) $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_cpu)) $($(target)_BLDDIRS.$(bld_type))
 | 
|---|
| 1108 | _INSTALLS_FILES += $(INSTARGET_$(target))
 | 
|---|
| 1109 | 
 | 
|---|
| 1110 | endef # def_link_common
 | 
|---|
| 1111 | $(eval-opt-var def_link_common)
 | 
|---|
| 1112 | 
 | 
|---|
| 1113 | 
 | 
|---|
| 1114 | #
 | 
|---|
| 1115 | # BLDPROGS
 | 
|---|
| 1116 | #
 | 
|---|
| 1117 | 
 | 
|---|
| 1118 | # Process build programs.
 | 
|---|
| 1119 | EXT     := EXE
 | 
|---|
| 1120 | EXTPRE  := HOST
 | 
|---|
| 1121 | tool_do := LINK_PROGRAM
 | 
|---|
| 1122 | typevar := _BLDPROGS
 | 
|---|
| 1123 | mode    := 0755
 | 
|---|
| 1124 | bld_trg_base_var := HOST
 | 
|---|
| 1125 | $(foreach target, $(_ALL_BLDPROGS), $(evalvalctx def_link_common))
 | 
|---|
| 1126 | 
 | 
|---|
| 1127 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| 1128 |  $(evalcall def_profile_self, done build program targets)
 | 
|---|
| 1129 | endif
 | 
|---|
| 1130 | 
 | 
|---|
| 1131 | 
 | 
|---|
| 1132 | #
 | 
|---|
| 1133 | # DLLS
 | 
|---|
| 1134 | #
 | 
|---|
| 1135 | 
 | 
|---|
| 1136 | # Process dlls
 | 
|---|
| 1137 | EXT     := DLL
 | 
|---|
| 1138 | EXTPRE  :=
 | 
|---|
| 1139 | tool_do := LINK_DLL
 | 
|---|
| 1140 | typevar := _DLLS
 | 
|---|
| 1141 | mode    := 0644
 | 
|---|
| 1142 | bld_trg_base_var := TARGET
 | 
|---|
| 1143 | $(foreach target, $(_ALL_DLLS), $(evalvalctx def_link_common))
 | 
|---|
| 1144 | 
 | 
|---|
| 1145 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| 1146 |  $(evalcall def_profile_self, done dll targets)
 | 
|---|
| 1147 | endif
 | 
|---|
| 1148 | 
 | 
|---|
| 1149 | 
 | 
|---|
| 1150 | #
 | 
|---|
| 1151 | # IMPORT LIBRARIES
 | 
|---|
| 1152 | #
 | 
|---|
| 1153 | #   - On OS/2 and windows these are libraries.
 | 
|---|
| 1154 | #   - On other platforms they are fake DLLs.
 | 
|---|
| 1155 | #
 | 
|---|
| 1156 | EXTPRE  :=
 | 
|---|
| 1157 | typevar := _IMPORT_LIBS
 | 
|---|
| 1158 | mode    := 0644
 | 
|---|
| 1159 | bld_trg_base_var := TARGET
 | 
|---|
| 1160 | ifeq ($(filter-out nt os2 win win64 win32,$(KBUILD_TARGET)),)
 | 
|---|
| 1161 |  EXT     := LIB
 | 
|---|
| 1162 |  tool_do := LINK_LIBRARY
 | 
|---|
| 1163 |  $(foreach target, $(_ALL_IMPORT_LIBS), $(evalvalctx def_lib))
 | 
|---|
| 1164 | else
 | 
|---|
| 1165 |  EXT     := DLL
 | 
|---|
| 1166 |  tool_do := LINK_DLL
 | 
|---|
| 1167 |  $(foreach target, $(_ALL_IMPORT_LIBS), $(evalvalctx def_link_common))
 | 
|---|
| 1168 | endif
 | 
|---|
| 1169 | 
 | 
|---|
| 1170 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| 1171 |  $(evalcall def_profile_self, done import library targets)
 | 
|---|
| 1172 | endif
 | 
|---|
| 1173 | 
 | 
|---|
| 1174 | 
 | 
|---|
| 1175 | #
 | 
|---|
| 1176 | # PROGRAMS
 | 
|---|
| 1177 | #
 | 
|---|
| 1178 | 
 | 
|---|
| 1179 | # Process programs
 | 
|---|
| 1180 | EXT     := EXE
 | 
|---|
| 1181 | EXTPRE  :=
 | 
|---|
| 1182 | tool_do := LINK_PROGRAM
 | 
|---|
| 1183 | typevar := _PROGRAMS
 | 
|---|
| 1184 | mode    := 0755
 | 
|---|
| 1185 | bld_trg_base_var := TARGET
 | 
|---|
| 1186 | $(foreach target, $(_ALL_PROGRAMS), $(evalvalctx def_link_common))
 | 
|---|
| 1187 | 
 | 
|---|
| 1188 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| 1189 |  $(evalcall def_profile_self, done program targets)
 | 
|---|
| 1190 | endif
 | 
|---|
| 1191 | 
 | 
|---|
| 1192 | 
 | 
|---|
| 1193 | #
 | 
|---|
| 1194 | # SYSMODS
 | 
|---|
| 1195 | #
 | 
|---|
| 1196 | 
 | 
|---|
| 1197 | # Process sysmods
 | 
|---|
| 1198 | EXT     := SYS
 | 
|---|
| 1199 | EXTPRE  :=
 | 
|---|
| 1200 | tool_do := LINK_SYSMOD
 | 
|---|
| 1201 | typevar := _SYSMODS
 | 
|---|
| 1202 | mode    := 0644
 | 
|---|
| 1203 | bld_trg_base_var := TARGET
 | 
|---|
| 1204 | $(foreach target, $(_ALL_SYSMODS), $(evalvalctx def_link_common))
 | 
|---|
| 1205 | 
 | 
|---|
| 1206 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| 1207 |  $(evalcall def_profile_self, done sysmod targets)
 | 
|---|
| 1208 | endif
 | 
|---|
| 1209 | 
 | 
|---|
| 1210 | 
 | 
|---|
| 1211 | #
 | 
|---|
| 1212 | # MISCBINS
 | 
|---|
| 1213 | #
 | 
|---|
| 1214 | 
 | 
|---|
| 1215 | # Process MISCBINS
 | 
|---|
| 1216 | EXT     := BIN
 | 
|---|
| 1217 | EXTPRE  :=
 | 
|---|
| 1218 | tool_do := LINK_MISCBIN
 | 
|---|
| 1219 | typevar := _MISCBINS
 | 
|---|
| 1220 | mode    := 0644
 | 
|---|
| 1221 | bld_trg_base_var := TARGET
 | 
|---|
| 1222 | $(foreach target, $(_ALL_MISCBINS), $(evalvalctx def_link_common))
 | 
|---|
| 1223 | 
 | 
|---|
| 1224 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| 1225 |  $(evalcall def_profile_self, done misc binary targets)
 | 
|---|
| 1226 | endif
 | 
|---|
| 1227 | 
 | 
|---|