| [72] | 1 | # $Id: footer-pass2-compiling-targets.kmk 3630 2024-10-25 09:49:17Z bird $
 | 
|---|
 | 2 | ## @file
 | 
|---|
| [2521] | 3 | # kBuild - Footer - Target lists - Pass 2 - Compiling Targets.
 | 
|---|
| [72] | 4 | #
 | 
|---|
| [1547] | 5 | 
 | 
|---|
 | 6 | #
 | 
|---|
| [3285] | 7 | # Copyright (c) 2004-2019 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
 | 
|---|
| [72] | 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
 | 
|---|
| [106] | 13 | # the Free Software Foundation; either version source of the License, or
 | 
|---|
| [72] | 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
 | 
|---|
| [353] | 23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|---|
| [72] | 24 | #
 | 
|---|
 | 25 | #
 | 
|---|
| [1547] | 26 | # As a special exception you are granted permission to include this file, via
 | 
|---|
| [1599] | 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.
 | 
|---|
| [1547] | 29 | # This exception does not however invalidate any other reasons why the makefile,
 | 
|---|
 | 30 | # program, whatever should not be covered the GPL.
 | 
|---|
 | 31 | #
 | 
|---|
 | 32 | #
 | 
|---|
| [72] | 33 | 
 | 
|---|
 | 34 | 
 | 
|---|
 | 35 | #
 | 
|---|
| [73] | 36 | # Object processing.
 | 
|---|
 | 37 | #
 | 
|---|
| [72] | 38 | 
 | 
|---|
| [380] | 39 | ifndef NO_COMPILE_CMDS_DEPS
 | 
|---|
| [3278] | 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
 | 
|---|
| [3284] | 94 | $$(outbase).koc +| $$(obj) $$(kbsrc_output) $$(kbsrc_output_maybe) : $$(kbsrc_depend) | $$(kbsrc_depord) $(target_intermediate_vars)
 | 
|---|
| [3278] | 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
 | 
|---|
| [2026] | 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
 | 
|---|
| [380] | 119 | else
 | 
|---|
| [730] | 120 |  _DEP_COMPILE_CMDS =
 | 
|---|
| [380] | 121 | endif
 | 
|---|
 | 122 | 
 | 
|---|
| [3278] | 123 | ## Generates the rules for building a specific object, and the aliases - legacy version.
 | 
|---|
| [380] | 124 | # for building a source file.
 | 
|---|
| [353] | 125 | # @param    $(obj)    The object file.
 | 
|---|
| [380] | 126 | define def_target_source_rule
 | 
|---|
| [2026] | 127 | ifndef NO_COMPILE_CMDS_DEPS
 | 
|---|
 | 128 | $(obj): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $$@),FORCE)
 | 
|---|
 | 129 | endif
 | 
|---|
| [3256] | 130 | ifneq ($(TOOL_$(tool)_COMPILE_$(type)_USES_KOBJCACHE),)
 | 
|---|
| [2196] | 131 | _OUT_FILES += $(outbase).koc
 | 
|---|
| [1030] | 132 | $(outbase).koc +| $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_$(source)_OUTPUT_MAYBE_) : \
 | 
|---|
| [3278] | 133 |                 $($(target)_$(source)_DEPEND_) $(value _DEP_COMPILE_CMDS) \
 | 
|---|
 | 134 |                 | $($(target)_$(source)_DEPORD_) $(target_intermediate_vars)
 | 
|---|
| [1496] | 135 |         %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
 | 
|---|
| [1007] | 136 | else
 | 
|---|
| [3280] | 137 | $(obj) + $($(target)_$(source)_OUTPUT_) +| $($(target)_$(source)_OUTPUT_MAYBE_) : \
 | 
|---|
| [3279] | 138 |                 $($(target)_$(source)_DEPEND_) $(value _DEP_COMPILE_CMDS) \
 | 
|---|
| [3278] | 139 |                 | $($(target)_$(source)_DEPORD_) $(target_intermediate_vars)
 | 
|---|
| [1496] | 140 |         %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
 | 
|---|
| [2952] | 141 | ifndef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT
 | 
|---|
| [1599] | 142 |         $$(QUIET)$$(RM) -f -- $(dep) $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_OUTPUT_MAYBE_)
 | 
|---|
| [1007] | 143 | endif
 | 
|---|
| [1012] | 144 | endif
 | 
|---|
| [412] | 145 | 
 | 
|---|
| [380] | 146 | $($(target)_$(source)_CMDS_)
 | 
|---|
 | 147 | 
 | 
|---|
 | 148 | ifndef NO_COMPILE_CMDS_DEPS
 | 
|---|
| [3135] | 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_'
 | 
|---|
| [1496] | 157 |         %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(obj)'
 | 
|---|
 | 158 |         %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
 | 
|---|
| [3135] | 159 |  endif
 | 
|---|
| [770] | 160 | endif
 | 
|---|
| [380] | 161 | 
 | 
|---|
| [749] | 162 | $(basename $(notdir $(obj))).o: $(obj)
 | 
|---|
| [1496] | 163 | 
 | 
|---|
| [2234] | 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.
 | 
|---|
| [1496] | 165 | $(target)_$(source)_CMDS_ :=
 | 
|---|
| [2234] | 166 | $(target)_$(source)_OUTPUT_ :=
 | 
|---|
 | 167 | $(target)_$(source)_OUTPUT_MAYBE_ :=
 | 
|---|
 | 168 | $(target)_$(source)_DEPEND_ :=
 | 
|---|
 | 169 | $(target)_$(source)_DEPORD_ :=
 | 
|---|
| [1936] | 170 | endef # def_target_source_rule
 | 
|---|
 | 171 | $(eval-opt-var def_target_source_rule)
 | 
|---|
| [3278] | 172 | ##
 | 
|---|
 | 173 | ## Legacy legacy legacy - end
 | 
|---|
| [205] | 174 | 
 | 
|---|
| [353] | 175 | 
 | 
|---|
| [3278] | 176 | 
 | 
|---|
| [380] | 177 | ## wrapper the link command dependency check.
 | 
|---|
| [1502] | 178 | ifndef NO_LINK_CMDS_DEPS
 | 
|---|
| [2026] | 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
 | 
|---|
| [380] | 184 | else
 | 
|---|
| [730] | 185 |  _DEP_LINK_CMDS =
 | 
|---|
| [380] | 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)
 | 
|---|
| [2234] | 193 | # @param    $($(target)_2_OUTPUT)   Output files from the link.
 | 
|---|
 | 194 | # @param    $($(target)_2_OUTPUT_MAYBE) Output files that the link may perhaps create.
 | 
|---|
| [2795] | 195 | # @param    $($(target)_2_OUTPUT_MAYBE_PRECIOUS)        Output files that the link may perhaps create but shouldn't be deleted.
 | 
|---|
| [2234] | 196 | # @param    $($(target)_2_DEPEND)   Dependencies.
 | 
|---|
 | 197 | # @param    $($(target)_2_DEPORD)   Dependencies which should only affect build order.
 | 
|---|
| [1496] | 198 | # @param    $(cmds)                 The link commands.
 | 
|---|
| [380] | 199 | # @param    $($(target)_CMDS_PREV_) The link commands from the previous run.
 | 
|---|
 | 200 | define def_link_rule
 | 
|---|
| [2531] | 201 | $$(call KB_FN_ASSERT_ABSPATH,out)
 | 
|---|
| [2026] | 202 | ifndef NO_LINK_CMDS_DEPS
 | 
|---|
 | 203 | $(out): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_CMDS_PREV_),$$(commands $$@),FORCE)
 | 
|---|
 | 204 | endif
 | 
|---|
| [2523] | 205 | $(out) \
 | 
|---|
 | 206 | + $($(target)_2_OUTPUT) \
 | 
|---|
 | 207 | + $($(target)_2_OUTPUT_DEBUG_FILES) \
 | 
|---|
 | 208 | + $($(target)_2_OUTPUT_DEBUG_DIRS) \
 | 
|---|
| [2795] | 209 | +| $($(target)_2_OUTPUT_MAYBE) $($(target)_2_OUTPUT_MAYBE_PRECIOUS) : \
 | 
|---|
| [2234] | 210 |                 $$$$($(target)_2_DEPEND) \
 | 
|---|
| [1456] | 211 |                 $(value _DEP_LINK_CMDS) \
 | 
|---|
| [380] | 212 |                 | \
 | 
|---|
| [2234] | 213 |                 $$$$($(target)_2_DEPORD)
 | 
|---|
| [1496] | 214 |         %$$(call MSG_LINK,$(target),$$@,$(tool_do))
 | 
|---|
| [2523] | 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
 | 
|---|
| [412] | 219 | 
 | 
|---|
| [1496] | 220 | $(cmds)
 | 
|---|
| [380] | 221 | 
 | 
|---|
| [524] | 222 | ifndef NO_LINK_CMDS_DEPS
 | 
|---|
| [1496] | 223 |         %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_CMDS_PREV_'
 | 
|---|
 | 224 |         %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 | 
|---|
 | 225 |         %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
 | 
|---|
| [770] | 226 | endif
 | 
|---|
| [380] | 227 | 
 | 
|---|
| [1686] | 228 | $(basename $(notdir $(out))):: $(out)
 | 
|---|
| [719] | 229 | 
 | 
|---|
| [1936] | 230 | endef # def_link_rule
 | 
|---|
 | 231 | $(eval-opt-var def_link_rule)
 | 
|---|
| [380] | 232 | 
 | 
|---|
 | 233 | 
 | 
|---|
 | 234 | ## Generate the link & lib install rule
 | 
|---|
| [2475] | 235 | # Implicit parameters: target, out, $(target)_1_STAGE_TARGET, mode,
 | 
|---|
 | 236 | #                      pre_install_cmds, post_install_cmds
 | 
|---|
| [380] | 237 | define def_link_install_rule
 | 
|---|
| [2531] | 238 | $$(call KB_FN_ASSERT_ABSPATH,$(target)_1_INST_TARGET)
 | 
|---|
| [2488] | 239 | $($(target)_1_INST_TARGET): $(out) | $$$$(dir $$$$@)
 | 
|---|
| [1496] | 240 |         %$$(call MSG_INST_TRG,$(target),$(out),$$@)
 | 
|---|
| [2475] | 241 |         $(pre_install_cmds)
 | 
|---|
 | 242 | 
 | 
|---|
| [2225] | 243 |         $$(QUIET)$$(INSTALL) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $(out) $$@
 | 
|---|
| [2475] | 244 |         $(post_install_cmds)
 | 
|---|
| [719] | 245 | 
 | 
|---|
| [2475] | 246 | endef
 | 
|---|
| [380] | 247 | 
 | 
|---|
| [2475] | 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
 | 
|---|
| [2531] | 253 | $$(call KB_FN_ASSERT_ABSPATH,$(target)_1_STAGE_TARGET)
 | 
|---|
| [2488] | 254 | $($(target)_1_STAGE_TARGET): $(out) | $$$$(dir $$$$@)
 | 
|---|
| [2475] | 255 |         %$$(call MSG_INST_TRG,$(target),$(out),$$@)
 | 
|---|
 | 256 |         $(pre_install_cmds)
 | 
|---|
 | 257 | 
 | 
|---|
| [2479] | 258 |         $$(QUIET)$$(INSTALL_STAGING) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $(out) $$@
 | 
|---|
| [2475] | 259 |         $(post_install_cmds)
 | 
|---|
 | 260 | 
 | 
|---|
 | 261 | 
 | 
|---|
 | 262 | $(basename $(notdir $(out))):: $($(target)_1_STAGE_TARGET)
 | 
|---|
 | 263 | 
 | 
|---|
 | 264 | endef
 | 
|---|
 | 265 | 
 | 
|---|
 | 266 | 
 | 
|---|
| [1424] | 267 | ## def_src_handler_*
 | 
|---|
 | 268 | #
 | 
|---|
 | 269 | # @{
 | 
|---|
 | 270 | define def_src_handler_c
 | 
|---|
| [1496] | 271 | local type := C
 | 
|---|
| [3415] | 272 |  $(kb-src-one 4)
 | 
|---|
| [1424] | 273 | endef
 | 
|---|
| [73] | 274 | 
 | 
|---|
| [1424] | 275 | define def_src_handler_cxx
 | 
|---|
| [1496] | 276 | local type := CXX
 | 
|---|
| [3415] | 277 |  $(kb-src-one 4)
 | 
|---|
| [1424] | 278 | endef
 | 
|---|
| [73] | 279 | 
 | 
|---|
| [1424] | 280 | define def_src_handler_objc
 | 
|---|
| [1496] | 281 | local type := OBJC
 | 
|---|
| [3415] | 282 |  $(kb-src-one 4)
 | 
|---|
| [1424] | 283 | endef
 | 
|---|
| [1256] | 284 | 
 | 
|---|
| [2356] | 285 | define def_src_handler_objcxx
 | 
|---|
| [2359] | 286 | local type := OBJCXX
 | 
|---|
| [3415] | 287 |  $(kb-src-one 4)
 | 
|---|
| [2356] | 288 | endef
 | 
|---|
 | 289 | 
 | 
|---|
| [1424] | 290 | define def_src_handler_asm
 | 
|---|
| [1496] | 291 | local type := AS
 | 
|---|
| [3415] | 292 |  $(kb-src-one 4)
 | 
|---|
| [1424] | 293 | endef
 | 
|---|
| [353] | 294 | 
 | 
|---|
| [1424] | 295 | define def_src_handler_rc
 | 
|---|
| [1496] | 296 | local type := RC
 | 
|---|
| [3415] | 297 |  $(kb-src-one 4)
 | 
|---|
| [1424] | 298 | endef
 | 
|---|
| [641] | 299 | 
 | 
|---|
| [3344] | 300 | ifdef KMK_WITH_QUOTING
 | 
|---|
| [1424] | 301 | define def_src_handler_obj
 | 
|---|
| [1434] | 302 | ifeq ($(defpath),)
 | 
|---|
| [2080] | 303 |  $(target)_2_OBJS += $(source)
 | 
|---|
 | 304 | else
 | 
|---|
| [3344] | 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
 | 
|---|
| [2080] | 313 |  $(target)_2_OBJS += $(abspathex $(source), $(defpath))
 | 
|---|
 | 314 | endif
 | 
|---|
 | 315 | endef
 | 
|---|
| [3344] | 316 | endif
 | 
|---|
| [1424] | 317 | ## @}
 | 
|---|
| [73] | 318 | 
 | 
|---|
| [1424] | 319 | ## Handle one source.
 | 
|---|
 | 320 | # .
 | 
|---|
 | 321 | define def_src_handler_one
 | 
|---|
| [1496] | 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))
 | 
|---|
| [1424] | 325 | ifneq ($(handler),)
 | 
|---|
| [1625] | 326 |  $(evalvalctx $(handler))
 | 
|---|
| [1424] | 327 | else
 | 
|---|
| [1434] | 328 |  othersrc += $(source)
 | 
|---|
| [1424] | 329 | endif
 | 
|---|
| [2475] | 330 | endef # def_src_handler_one
 | 
|---|
| [73] | 331 | 
 | 
|---|
| [1424] | 332 | ## Generic macro for processing all target sources.
 | 
|---|
 | 333 | # @param    $(target)   Normalized target name.
 | 
|---|
 | 334 | # @param    $(defpath)
 | 
|---|
 | 335 | # @param    much-more...
 | 
|---|
| [2236] | 336 | # @returns  othersrc, $(target)_2_OBJS, ++
 | 
|---|
| [3344] | 337 | ifdef KMK_WITH_QUOTING
 | 
|---|
| [1424] | 338 | define def_target_sources
 | 
|---|
| [1496] | 339 | local target_src_handlers := $($(target)_SRC_HANDLERS) $(KBUILD_SRC_HANDLERS)
 | 
|---|
| [3344] | 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)
 | 
|---|
| [1424] | 365 | $(foreach source,\
 | 
|---|
| [1429] | 366 |         $($(target)_SOURCES)\
 | 
|---|
 | 367 |         $($(target)_SOURCES.$(bld_trg))\
 | 
|---|
| [2433] | 368 |         $($(target)_SOURCES.$(bld_trg).$(bld_type))\
 | 
|---|
| [1429] | 369 |         $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [2433] | 370 |         $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| [1429] | 371 |         $($(target)_SOURCES.$(bld_trg_arch))\
 | 
|---|
 | 372 |         $($(target)_SOURCES.$(bld_trg_cpu))\
 | 
|---|
 | 373 |         $($(target)_SOURCES.$(bld_type))\
 | 
|---|
| [2762] | 374 |         ,$(evalvalctx def_src_handler_one) )
 | 
|---|
| [1621] | 375 | 
 | 
|---|
 | 376 | $(foreach source,\
 | 
|---|
 | 377 |         $($(target)_GEN_SOURCES_)\
 | 
|---|
 | 378 |         $($(target)_GEN_SOURCES_.$(bld_trg))\
 | 
|---|
| [2433] | 379 |         $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_type))\
 | 
|---|
| [1621] | 380 |         $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [2433] | 381 |         $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| [1621] | 382 |         $($(target)_GEN_SOURCES_.$(bld_trg_arch))\
 | 
|---|
 | 383 |         $($(target)_GEN_SOURCES_.$(bld_trg_cpu))\
 | 
|---|
 | 384 |         $($(target)_GEN_SOURCES_.$(bld_type))\
 | 
|---|
| [2762] | 385 |         ,$(evalvalctx def_src_handler_one) )
 | 
|---|
| [1936] | 386 | endef # def_target_sources
 | 
|---|
| [3344] | 387 | endif
 | 
|---|
| [1936] | 388 | $(eval-opt-var def_target_sources)
 | 
|---|
| [1424] | 389 | 
 | 
|---|
 | 390 | 
 | 
|---|
| [2475] | 391 | ##
 | 
|---|
| [2523] | 392 | # Install a debug directory.
 | 
|---|
 | 393 | # @param    debug_dir           The directory name.
 | 
|---|
 | 394 | define def_link_install_debug_dir_rule
 | 
|---|
| [2535] | 395 | local dir := $(debug_inst_path)/$(debug_inst2)$(debug_dir)
 | 
|---|
| [2531] | 396 | $$(call KB_FN_ASSERT_ABSPATH,dir)
 | 
|---|
| [2523] | 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 | ##
 | 
|---|
| [2531] | 404 | # Install a debug file.
 | 
|---|
| [2523] | 405 | # @param    debug_file          Src=>Dst file pair.
 | 
|---|
 | 406 | define def_link_install_debug_file_rule
 | 
|---|
| [2535] | 407 | local dst := $(debug_inst_path)/$(debug_inst2)$(word 2, $(subst =>,$(SP),$(debug_file)))
 | 
|---|
| [2531] | 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 $$$$@)
 | 
|---|
| [2535] | 412 |         %$$(call MSG_INST_FILE,$$<,$$@)
 | 
|---|
| [2523] | 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 | ##
 | 
|---|
| [2531] | 418 | # Install debug info to $(debug_inst), where debug_inst can be a directory or
 | 
|---|
| [2523] | 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)" == "./"
 | 
|---|
| [2535] | 423 |   local debug_inst2 :=
 | 
|---|
 | 424 |  else
 | 
|---|
 | 425 |   local debug_inst2 := $(debug_inst)
 | 
|---|
| [2523] | 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
 | 
|---|
| [2535] | 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))
 | 
|---|
| [2523] | 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 | 
 | 
|---|
| [2475] | 445 | ## Generic macro for generating the install rule(s) for a target.
 | 
|---|
| [219] | 446 | #
 | 
|---|
| [353] | 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.
 | 
|---|
| [2481] | 450 | # @param        $(target_type_mode) The default file mode implied by the target type.
 | 
|---|
| [2475] | 451 | define def_target_install_only
 | 
|---|
| [2551] | 452 | if1of ($($(target)_1_INSTTYPE) $($(target)_1_DEBUG_INSTTYPE), both stage)
 | 
|---|
 | 453 |  # Determin common variables.
 | 
|---|
| [2225] | 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)) \
 | 
|---|
| [2483] | 461 |         $($(target)_MODE) \
 | 
|---|
 | 462 |         $(target_type_mode) )
 | 
|---|
| [2225] | 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) )
 | 
|---|
| [2475] | 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)
 | 
|---|
| [2551] | 481 | endif
 | 
|---|
| [219] | 482 | 
 | 
|---|
| [2551] | 483 | ifneq ($($(target)_1_INSTTYPE),none)
 | 
|---|
| [2475] | 484 |  # Generate the rules
 | 
|---|
 | 485 |  ifeq ($($(target)_1_INSTTYPE),both)
 | 
|---|
| [353] | 486 | $(eval $(def_link_install_rule))
 | 
|---|
| [2475] | 487 |   _INSTALLS_FILES += $($(target)_1_INST_TARGET)
 | 
|---|
| [1697] | 488 |  endif
 | 
|---|
| [2475] | 489 | $(eval $(def_link_stage_rule))
 | 
|---|
 | 490 |  _STAGE_FILES += $($(target)_1_STAGE_TARGET)
 | 
|---|
 | 491 |  $(typevar) += $($(target)_1_STAGE_TARGET)
 | 
|---|
 | 492 | else  # INSTTYPE == none
 | 
|---|
| [1697] | 493 |  $(typevar) += $(out)
 | 
|---|
| [2475] | 494 | endif # INSTTYPE == none
 | 
|---|
| [353] | 495 | 
 | 
|---|
| [2523] | 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
 | 
|---|
| [2762] | 511 |   $(foreach debug_inst, $($(target)_1_DEBUG_INST), $(evalvalctx def_target_install_only_debug))
 | 
|---|
| [2523] | 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)
 | 
|---|
| [2762] | 518 |   $(foreach debug_inst, $($(target)_1_DEBUG_STAGE), $(evalvalctx def_target_install_only_debug))
 | 
|---|
| [2523] | 519 |  endif
 | 
|---|
 | 520 |  if1of ($($(target)_1_INSTTYPE), stage both)
 | 
|---|
 | 521 |   ifndef debug_nostage
 | 
|---|
| [2762] | 522 |    $(foreach debug_inst,$($(target)_1_STAGE), $(evalvalctx def_target_install_only_debug))
 | 
|---|
| [2523] | 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 | 
 | 
|---|
| [2475] | 534 | endef # def_target_install_only
 | 
|---|
| [353] | 535 | 
 | 
|---|
| [219] | 536 | 
 | 
|---|
 | 537 | 
 | 
|---|
 | 538 | #
 | 
|---|
| [72] | 539 | # LIBRARIES
 | 
|---|
| [73] | 540 | #
 | 
|---|
| [72] | 541 | 
 | 
|---|
 | 542 | ## Library (one).
 | 
|---|
| [74] | 543 | # @param    $(target)   Normalized library (target) name.
 | 
|---|
| [72] | 544 | define def_lib
 | 
|---|
| [145] | 545 | # library basics
 | 
|---|
| [222] | 546 | ## @todo prefix
 | 
|---|
| [1504] | 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))
 | 
|---|
| [1496] | 551 | local tool        := $(call _TARGET_TOOL,$(target),AR)
 | 
|---|
| [78] | 552 | ifeq ($(tool),)
 | 
|---|
| [353] | 553 | $(error kBuild: Library target $(target) does not have a tool defined!)
 | 
|---|
| [78] | 554 | endif
 | 
|---|
| [1496] | 555 | local name        := $(firstword\
 | 
|---|
| [2433] | 556 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| [889] | 557 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [2433] | 558 |         $($(target)_NAME.$(bld_trg).$(bld_type))\
 | 
|---|
| [889] | 559 |         $($(target)_NAME.$(bld_trg_arch))\
 | 
|---|
 | 560 |         $($(target)_NAME.$(bld_trg))\
 | 
|---|
 | 561 |         $($(target)_NAME.$(bld_type))\
 | 
|---|
 | 562 |         $($(target)_NAME)\
 | 
|---|
 | 563 |         $(target))
 | 
|---|
| [1496] | 564 | local outbase     := $(call TARGET_BASE,$(name),$(target))
 | 
|---|
| [2239] | 565 | $(target)_0_OUTDIR:= $(patsubst %/,%,$(dir $(outbase)))
 | 
|---|
| [2436] | 566 | $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
 | 
|---|
| [1496] | 567 | local suff        := $(firstword\
 | 
|---|
| [481] | 568 |         $($(target)_LIBSUFF.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [221] | 569 |         $($(target)_LIBSUFF.$(bld_trg))\
 | 
|---|
| [126] | 570 |         $($(target)_LIBSUFF)\
 | 
|---|
| [481] | 571 |         $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [221] | 572 |         $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg))\
 | 
|---|
| [126] | 573 |         $(TOOL_$(tool)_ARLIBSUFF)\
 | 
|---|
| [353] | 574 |         $(SUFF_LIB))
 | 
|---|
| [1496] | 575 | local out         := $(outbase)$(suff)
 | 
|---|
| [2434] | 576 | local defpath     := $($(target)_DEFPATH)
 | 
|---|
 | 577 | ifeq ($(defpath),)
 | 
|---|
 | 578 |  local defpath    := $($(target)_PATH)
 | 
|---|
 | 579 | endif
 | 
|---|
| [2238] | 580 | $(target)_1_TARGET:= $(out)
 | 
|---|
| [2436] | 581 | $(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
 | 
|---|
| [1496] | 582 | # no local here - must be writable across some foreachs.
 | 
|---|
 | 583 | othersrc          :=
 | 
|---|
| [2236] | 584 | $(target)_2_OBJS  :=
 | 
|---|
| [3284] | 585 | $(target)_2_INTERMEDIATES =
 | 
|---|
| [145] | 586 | 
 | 
|---|
| [3278] | 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 | 
 | 
|---|
| [3285] | 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 | 
 | 
|---|
| [1672] | 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)
 | 
|---|
| [2762] | 614 | $(foreach unit,$(units),$(evalvalctx def_unit_$(unit)_target_pre))
 | 
|---|
| [2952] | 615 | $(foreach unit,$(units),$(evalvalctx def_unit_$(unit)_target_pre_2))
 | 
|---|
| [1672] | 616 | 
 | 
|---|
| [145] | 617 | # source -> object
 | 
|---|
| [1496] | 618 | $(evalval def_target_sources)
 | 
|---|
| [145] | 619 | 
 | 
|---|
 | 620 | # library linking
 | 
|---|
| [1496] | 621 | local tool        := $(call _TARGET_TOOL,$(target),AR)
 | 
|---|
 | 622 | local name        := $(firstword\
 | 
|---|
| [2433] | 623 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| [889] | 624 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [2433] | 625 |         $($(target)_NAME.$(bld_trg).$(bld_type))\
 | 
|---|
| [889] | 626 |         $($(target)_NAME.$(bld_trg_arch))\
 | 
|---|
 | 627 |         $($(target)_NAME.$(bld_trg))\
 | 
|---|
 | 628 |         $($(target)_NAME.$(bld_type))\
 | 
|---|
 | 629 |         $($(target)_NAME)\
 | 
|---|
 | 630 |         $(target))
 | 
|---|
| [1496] | 631 | local outbase     := $(call TARGET_BASE,$(name),$(target))
 | 
|---|
 | 632 | local flags       :=\
 | 
|---|
| [74] | 633 |         $(TOOL_$(tool)_ARFLAGS)\
 | 
|---|
| [221] | 634 |         $(TOOL_$(tool)_ARFLAGS.$(bld_type))\
 | 
|---|
| [74] | 635 |         $(ARFLAGS)\
 | 
|---|
| [221] | 636 |         $(ARFLAGS.$(bld_type))\
 | 
|---|
| [74] | 637 |         $($(target)_ARFLAGS)\
 | 
|---|
| [481] | 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))
 | 
|---|
| [1496] | 643 | local dirdep      := $(call DIRDEP,$(dir $(out)))
 | 
|---|
| [1702] | 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)
 | 
|---|
| [72] | 678 | 
 | 
|---|
| [725] | 679 | # Adjust paths if we got a default path.
 | 
|---|
 | 680 | ifneq ($(defpath),)
 | 
|---|
| [1496] | 681 |  local deps       := $(abspathex $(deps),$(defpath))
 | 
|---|
 | 682 |  local orderdeps  := $(abspathex $(orderdeps),$(defpath))
 | 
|---|
| [1472] | 683 |  othersrc := $(abspathex $(othersrc),$(defpath))
 | 
|---|
| [725] | 684 | endif
 | 
|---|
 | 685 | 
 | 
|---|
| [859] | 686 | 
 | 
|---|
 | 687 | # Custom pre-link actions.
 | 
|---|
| [3128] | 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))
 | 
|---|
| [859] | 690 | 
 | 
|---|
| [1424] | 691 | # eliminate this guy?
 | 
|---|
| [2236] | 692 | local objs = $($(target)_2_OBJS)
 | 
|---|
| [1424] | 693 | 
 | 
|---|
| [380] | 694 | # dependency file
 | 
|---|
| [1496] | 695 | local dep := $(out)$(SUFF_DEP)
 | 
|---|
| [524] | 696 | ifndef NO_LINK_CMDS_DEPS
 | 
|---|
| [1798] | 697 |  _DEPFILES_INCLUDED += $(dep)
 | 
|---|
 | 698 |  ifdef KB_HAVE_INCLUDEDEP_QUEUE
 | 
|---|
 | 699 |   includedep-queue $(dep)
 | 
|---|
| [1795] | 700 |  else
 | 
|---|
| [1798] | 701 |   includedep $(dep)
 | 
|---|
| [1795] | 702 |  endif
 | 
|---|
| [380] | 703 | endif
 | 
|---|
| [72] | 704 | 
 | 
|---|
| [380] | 705 | # check that the tool is defined.
 | 
|---|
 | 706 | ifndef TOOL_$(tool)_LINK_LIBRARY_CMDS
 | 
|---|
 | 707 | $(warning kBuild: tools: \
 | 
|---|
| [481] | 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) )
 | 
|---|
| [380] | 720 | $(error kBuild: TOOL_$(tool)_LINK_LIBRARY_CMDS isn't defined! target=$(target) )
 | 
|---|
 | 721 | endif
 | 
|---|
 | 722 | 
 | 
|---|
 | 723 | # call the tool
 | 
|---|
| [2523] | 724 | local  cmds := $(TOOL_$(tool)_LINK_LIBRARY_CMDS)
 | 
|---|
| [859] | 725 | ifneq ($(pre_cmds),)
 | 
|---|
| [1496] | 726 |  local cmds := $(TAB)$(pre_cmds)$(NL)$(TAB)$(cmds)
 | 
|---|
| [859] | 727 | endif
 | 
|---|
 | 728 | ifneq ($(post_cmds),)
 | 
|---|
| [2523] | 729 |  local cmds := $(cmds)$(NL)$(TAB)$(post_cmds)
 | 
|---|
| [859] | 730 | endif
 | 
|---|
| [2234] | 731 | $(target)_2_OUTPUT := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT)
 | 
|---|
 | 732 | $(target)_2_OUTPUT_MAYBE := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT_MAYBE)
 | 
|---|
| [2795] | 733 | $(target)_2_OUTPUT_MAYBE_PRECIOUS := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT_MAYBE_PRECIOUS)
 | 
|---|
| [2236] | 734 | $(target)_2_DEPEND := $(TOOL_$(tool)_LINK_LIBRARY_DEPEND) $(deps) $($(target)_2_OBJS)
 | 
|---|
| [2234] | 735 | $(target)_2_DEPORD := $(TOOL_$(tool)_LINK_LIBRARY_DEPORD) $(dirdep) $(orderdeps)
 | 
|---|
| [380] | 736 | 
 | 
|---|
| [412] | 737 | # generate the link rule.
 | 
|---|
| [380] | 738 | $(eval $(def_link_rule))
 | 
|---|
 | 739 | 
 | 
|---|
| [2475] | 740 | # installing and globals.
 | 
|---|
| [2483] | 741 | local target_type_mode := a+r,u+w
 | 
|---|
| [2475] | 742 | $(evalval def_target_install_only)
 | 
|---|
 | 743 | 
 | 
|---|
| [2795] | 744 | _OUT_FILES += $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE) $($(target)_2_OUTPUT_MAYBE_PRECIOUS) $(out)
 | 
|---|
| [2475] | 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
 | 
|---|
| [1936] | 750 | $(eval-opt-var def_lib)
 | 
|---|
| [72] | 751 | 
 | 
|---|
 | 752 | # Process libraries
 | 
|---|
| [859] | 753 | typevar := _LIBS
 | 
|---|
| [776] | 754 | tool_do := LINK_LIBRARY
 | 
|---|
| [380] | 755 | mode := 0644
 | 
|---|
| [2762] | 756 | $(foreach target, $(_ALL_LIBRARIES), $(evalvalctx def_lib))
 | 
|---|
| [72] | 757 | 
 | 
|---|
| [988] | 758 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| [2008] | 759 |  $(evalcall def_profile_self, done library targets)
 | 
|---|
| [988] | 760 | endif
 | 
|---|
| [72] | 761 | 
 | 
|---|
| [988] | 762 | 
 | 
|---|
| [72] | 763 | #
 | 
|---|
| [353] | 764 | # Link operations.
 | 
|---|
| [72] | 765 | #
 | 
|---|
 | 766 | 
 | 
|---|
| [353] | 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.
 | 
|---|
| [380] | 773 | define def_link_common
 | 
|---|
| [353] | 774 | # basics
 | 
|---|
| [1504] | 775 | local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(KBUILD_TYPE))
 | 
|---|
| [3415] | 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))
 | 
|---|
| [145] | 779 | 
 | 
|---|
| [1496] | 780 | local tool        := $(call _TARGET_TOOL,$(target),LD)
 | 
|---|
 | 781 | local name        := $(firstword\
 | 
|---|
| [2433] | 782 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| [889] | 783 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [2433] | 784 |         $($(target)_NAME.$(bld_trg).$(bld_type))\
 | 
|---|
| [889] | 785 |         $($(target)_NAME.$(bld_trg_arch))\
 | 
|---|
 | 786 |         $($(target)_NAME.$(bld_trg))\
 | 
|---|
 | 787 |         $($(target)_NAME.$(bld_type))\
 | 
|---|
 | 788 |         $($(target)_NAME)\
 | 
|---|
 | 789 |         $(target))
 | 
|---|
| [1496] | 790 | local outbase     := $(call TARGET_BASE,$(name),$(target))
 | 
|---|
| [2239] | 791 | $(target)_0_OUTDIR:= $(patsubst %/,%,$(dir $(outbase)))
 | 
|---|
| [2436] | 792 | $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
 | 
|---|
| [2143] | 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)) )
 | 
|---|
| [1496] | 801 | local out         := $(outbase)$(suff)
 | 
|---|
| [2238] | 802 | $(target)_1_TARGET:= $(out)
 | 
|---|
| [2436] | 803 | $(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
 | 
|---|
| [2434] | 804 | local defpath     := $($(target)_DEFPATH)
 | 
|---|
 | 805 | ifeq ($(defpath),)
 | 
|---|
 | 806 |  local defpath    := $($(target)_PATH)
 | 
|---|
 | 807 | endif
 | 
|---|
| [1496] | 808 | # no local here - must be writable across some foreachs.
 | 
|---|
 | 809 | othersrc          :=
 | 
|---|
| [2236] | 810 | $(target)_2_OBJS  :=
 | 
|---|
| [3284] | 811 | $(target)_2_INTERMEDIATES =
 | 
|---|
| [353] | 812 | 
 | 
|---|
| [3278] | 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 | 
 | 
|---|
| [3285] | 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 | 
 | 
|---|
| [1672] | 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)
 | 
|---|
| [2762] | 840 | $(foreach unit,$(units),$(evalvalctx def_unit_$(unit)_target_pre))
 | 
|---|
| [2952] | 841 | $(foreach unit,$(units),$(evalvalctx def_unit_$(unit)_target_pre_2))
 | 
|---|
| [1672] | 842 | 
 | 
|---|
| [145] | 843 | # source -> object
 | 
|---|
| [1496] | 844 | $(evalval def_target_sources)
 | 
|---|
| [145] | 845 | 
 | 
|---|
| [744] | 846 | # more link stuff.
 | 
|---|
| [1496] | 847 | local tool        := $(call _TARGET_TOOL,$(target),LD)
 | 
|---|
 | 848 | local name        := $(firstword\
 | 
|---|
| [2433] | 849 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
 | 
|---|
| [889] | 850 |         $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [2433] | 851 |         $($(target)_NAME.$(bld_trg).$(bld_type))\
 | 
|---|
| [889] | 852 |         $($(target)_NAME.$(bld_trg_arch))\
 | 
|---|
 | 853 |         $($(target)_NAME.$(bld_trg))\
 | 
|---|
 | 854 |         $($(target)_NAME.$(bld_type))\
 | 
|---|
 | 855 |         $($(target)_NAME)\
 | 
|---|
 | 856 |         $(target))
 | 
|---|
| [1496] | 857 | local outbase     := $(call TARGET_BASE,$(name),$(target))
 | 
|---|
 | 858 | local flags       :=\
 | 
|---|
| [74] | 859 |         $(TOOL_$(tool)_LDFLAGS)\
 | 
|---|
| [221] | 860 |         $(TOOL_$(tool)_LDFLAGS.$(bld_type))\
 | 
|---|
 | 861 |         $(TOOL_$(tool)_LDFLAGS.$(bld_trg))\
 | 
|---|
 | 862 |         $(TOOL_$(tool)_LDFLAGS.$(bld_trg_arch))\
 | 
|---|
| [481] | 863 |         $(TOOL_$(tool)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [221] | 864 |         $(TOOL_$(tool)_LDFLAGS.$(bld_trg_cpu))\
 | 
|---|
| [1242] | 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)))\
 | 
|---|
| [74] | 876 |         $(LDFLAGS)\
 | 
|---|
| [221] | 877 |         $(LDFLAGS.$(bld_type))\
 | 
|---|
 | 878 |         $(LDFLAGS.$(bld_trg))\
 | 
|---|
 | 879 |         $(LDFLAGS.$(bld_trg_arch))\
 | 
|---|
| [481] | 880 |         $(LDFLAGS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [221] | 881 |         $(LDFLAGS.$(bld_trg_cpu))\
 | 
|---|
| [1242] | 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)))\
 | 
|---|
| [74] | 893 |         $($(target)_LDFLAGS)\
 | 
|---|
| [221] | 894 |         $($(target)_LDFLAGS.$(bld_type))\
 | 
|---|
 | 895 |         $($(target)_LDFLAGS.$(bld_trg))\
 | 
|---|
 | 896 |         $($(target)_LDFLAGS.$(bld_trg_arch))\
 | 
|---|
| [481] | 897 |         $($(target)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [353] | 898 |         $($(target)_LDFLAGS.$(bld_trg_cpu))
 | 
|---|
| [3630] | 899 | 
 | 
|---|
 | 900 | local targetsdks  := \
 | 
|---|
 | 901 |         $($(target)_SDKS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
 | 902 |         $($(target)_SDKS.$(bld_trg_arch))\
 | 
|---|
 | 903 |         $($(target)_SDKS.$(bld_trg))\
 | 
|---|
 | 904 |         $($(target)_SDKS.$(bld_type))\
 | 
|---|
 | 905 |         $($(target)_SDKS)
 | 
|---|
 | 906 | local globalsdks  := \
 | 
|---|
 | 907 |         $(SDKS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
 | 908 |         $(SDKS.$(bld_trg_arch))\
 | 
|---|
 | 909 |         $(SDKS.$(bld_trg))\
 | 
|---|
 | 910 |         $(SDKS.$(bld_type))\
 | 
|---|
 | 911 |         $(SDKS)
 | 
|---|
 | 912 | # Note! Global EARLY_LIBS and LATE_LIBS variables are ignored.
 | 
|---|
 | 913 | ## @todo ignore global LIBS and most other global properties.
 | 
|---|
| [1496] | 914 | local libs        :=\
 | 
|---|
| [3630] | 915 |         $($(target)_EARLY_LIBS.$(bld_trg_cpu))\
 | 
|---|
 | 916 |         $($(target)_EARLY_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
 | 917 |         $($(target)_EARLY_LIBS.$(bld_trg_arch))\
 | 
|---|
 | 918 |         $($(target)_EARLY_LIBS.$(bld_trg))\
 | 
|---|
 | 919 |         $($(target)_EARLY_LIBS.$(bld_type))\
 | 
|---|
 | 920 |         $($(target)_EARLY_LIBS)\
 | 
|---|
 | 921 |         $(foreach sdk, $(targetsdks) $(globalsdks),\
 | 
|---|
 | 922 |                 $(SDK_$(sdk)_EARLY_LIBS.$(bld_trg_cpu))\
 | 
|---|
 | 923 |                 $(SDK_$(sdk)_EARLY_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
 | 924 |                 $(SDK_$(sdk)_EARLY_LIBS.$(bld_trg_arch))\
 | 
|---|
 | 925 |                 $(SDK_$(sdk)_EARLY_LIBS.$(bld_trg))\
 | 
|---|
 | 926 |                 $(SDK_$(sdk)_EARLY_LIBS.$(bld_type))\
 | 
|---|
 | 927 |                 $(SDK_$(sdk)_EARLY_LIBS))\
 | 
|---|
 | 928 |         $(TOOL_$(tool)_EARLY_LIBS.$(bld_trg_cpu))\
 | 
|---|
 | 929 |         $(TOOL_$(tool)_EARLY_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
 | 930 |         $(TOOL_$(tool)_EARLY_LIBS.$(bld_trg_arch))\
 | 
|---|
 | 931 |         $(TOOL_$(tool)_EARLY_LIBS.$(bld_trg))\
 | 
|---|
 | 932 |         $(TOOL_$(tool)_EARLY_LIBS.$(bld_type))\
 | 
|---|
 | 933 |         $(TOOL_$(tool)_EARLY_LIBS)\
 | 
|---|
 | 934 |         \
 | 
|---|
| [221] | 935 |         $($(target)_LIBS.$(bld_trg_cpu))\
 | 
|---|
| [481] | 936 |         $($(target)_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [221] | 937 |         $($(target)_LIBS.$(bld_trg_arch))\
 | 
|---|
 | 938 |         $($(target)_LIBS.$(bld_trg))\
 | 
|---|
 | 939 |         $($(target)_LIBS.$(bld_type))\
 | 
|---|
| [74] | 940 |         $($(target)_LIBS)\
 | 
|---|
| [3630] | 941 |         $(foreach sdk, $(targetsdks),\
 | 
|---|
| [353] | 942 |                 $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
 | 
|---|
| [481] | 943 |                 $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [353] | 944 |                 $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
 | 
|---|
 | 945 |                 $(SDK_$(sdk)_LIBS.$(bld_trg))\
 | 
|---|
 | 946 |                 $(SDK_$(sdk)_LIBS.$(bld_type))\
 | 
|---|
 | 947 |                 $(SDK_$(sdk)_LIBS))\
 | 
|---|
| [221] | 948 |         $(LIBS.$(bld_trg_cpu))\
 | 
|---|
| [481] | 949 |         $(LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [221] | 950 |         $(LIBS.$(bld_trg_arch))\
 | 
|---|
 | 951 |         $(LIBS.$(bld_trg))\
 | 
|---|
 | 952 |         $(LIBS.$(bld_type))\
 | 
|---|
| [74] | 953 |         $(LIBS)\
 | 
|---|
| [3630] | 954 |         $(foreach sdk, $(globalsdks),\
 | 
|---|
| [353] | 955 |                 $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
 | 
|---|
| [481] | 956 |                 $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [353] | 957 |                 $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
 | 
|---|
 | 958 |                 $(SDK_$(sdk)_LIBS.$(bld_trg))\
 | 
|---|
 | 959 |                 $(SDK_$(sdk)_LIBS.$(bld_type))\
 | 
|---|
 | 960 |                 $(SDK_$(sdk)_LIBS))\
 | 
|---|
| [221] | 961 |         $(TOOL_$(tool)_LIBS.$(bld_trg_cpu))\
 | 
|---|
| [481] | 962 |         $(TOOL_$(tool)_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [221] | 963 |         $(TOOL_$(tool)_LIBS.$(bld_trg_arch))\
 | 
|---|
 | 964 |         $(TOOL_$(tool)_LIBS.$(bld_trg))\
 | 
|---|
 | 965 |         $(TOOL_$(tool)_LIBS.$(bld_type))\
 | 
|---|
| [3630] | 966 |         $(TOOL_$(tool)_LIBS)\
 | 
|---|
 | 967 |         \
 | 
|---|
 | 968 |         $($(target)_LATE_LIBS.$(bld_trg_cpu))\
 | 
|---|
 | 969 |         $($(target)_LATE_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
 | 970 |         $($(target)_LATE_LIBS.$(bld_trg_arch))\
 | 
|---|
 | 971 |         $($(target)_LATE_LIBS.$(bld_trg))\
 | 
|---|
 | 972 |         $($(target)_LATE_LIBS.$(bld_type))\
 | 
|---|
 | 973 |         $($(target)_LATE_LIBS)\
 | 
|---|
 | 974 |         $(foreach sdk, $(targetsdks) $(globalsdks),\
 | 
|---|
 | 975 |                 $(SDK_$(sdk)_LATE_LIBS.$(bld_trg_cpu))\
 | 
|---|
 | 976 |                 $(SDK_$(sdk)_LATE_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
 | 977 |                 $(SDK_$(sdk)_LATE_LIBS.$(bld_trg_arch))\
 | 
|---|
 | 978 |                 $(SDK_$(sdk)_LATE_LIBS.$(bld_trg))\
 | 
|---|
 | 979 |                 $(SDK_$(sdk)_LATE_LIBS.$(bld_type))\
 | 
|---|
 | 980 |                 $(SDK_$(sdk)_LATE_LIBS))\
 | 
|---|
 | 981 |         $(TOOL_$(tool)_LATE_LIBS.$(bld_trg_cpu))\
 | 
|---|
 | 982 |         $(TOOL_$(tool)_LATE_LIBS.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
 | 983 |         $(TOOL_$(tool)_LATE_LIBS.$(bld_trg_arch))\
 | 
|---|
 | 984 |         $(TOOL_$(tool)_LATE_LIBS.$(bld_trg))\
 | 
|---|
 | 985 |         $(TOOL_$(tool)_LATE_LIBS.$(bld_type))\
 | 
|---|
 | 986 |         $(TOOL_$(tool)_LATE_LIBS)
 | 
|---|
| [1496] | 987 | local libpath    :=\
 | 
|---|
| [221] | 988 |         $($(target)_LIBPATH.$(bld_trg_cpu))\
 | 
|---|
| [481] | 989 |         $($(target)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [221] | 990 |         $($(target)_LIBPATH.$(bld_trg_arch))\
 | 
|---|
 | 991 |         $($(target)_LIBPATH.$(bld_trg))\
 | 
|---|
 | 992 |         $($(target)_LIBPATH.$(bld_type))\
 | 
|---|
| [74] | 993 |         $($(target)_LIBPATH)\
 | 
|---|
| [3630] | 994 |         $(foreach sdk, $(targetsdks),\
 | 
|---|
| [353] | 995 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
 | 
|---|
| [481] | 996 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [353] | 997 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
 | 
|---|
 | 998 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
 | 
|---|
 | 999 |                 $(SDK_$(sdk)_LIBPATH.$(bld_type))\
 | 
|---|
 | 1000 |                 $(SDK_$(sdk)_LIBPATH))\
 | 
|---|
| [221] | 1001 |         $(LIBPATH.$(bld_trg_cpu))\
 | 
|---|
| [481] | 1002 |         $(LIBPATH.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [221] | 1003 |         $(LIBPATH.$(bld_trg_arch))\
 | 
|---|
 | 1004 |         $(LIBPATH.$(bld_trg))\
 | 
|---|
 | 1005 |         $(LIBPATH.$(bld_type))\
 | 
|---|
| [74] | 1006 |         $(LIBPATH)\
 | 
|---|
| [3630] | 1007 |         $(foreach sdk, $(globalsdks),\
 | 
|---|
| [353] | 1008 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
 | 
|---|
| [481] | 1009 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [353] | 1010 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
 | 
|---|
 | 1011 |                 $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
 | 
|---|
 | 1012 |                 $(SDK_$(sdk)_LIBPATH.$(bld_type))\
 | 
|---|
 | 1013 |                 $(SDK_$(sdk)_LIBPATH))\
 | 
|---|
| [221] | 1014 |         $(TOOL_$(tool)_LIBPATH.$(bld_trg_cpu))\
 | 
|---|
| [481] | 1015 |         $(TOOL_$(tool)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
 | 
|---|
| [221] | 1016 |         $(TOOL_$(tool)_LIBPATH.$(bld_trg_arch))\
 | 
|---|
 | 1017 |         $(TOOL_$(tool)_LIBPATH.$(bld_trg))\
 | 
|---|
 | 1018 |         $(TOOL_$(tool)_LIBPATH.$(bld_type))\
 | 
|---|
| [353] | 1019 |         $(TOOL_$(tool)_LIBPATH)
 | 
|---|
| [1496] | 1020 | local dirdep      := $(call DIRDEP,$(dir $(out)))
 | 
|---|
| [1702] | 1021 | local deps        := \
 | 
|---|
 | 1022 |         $($(target)_DEPS.$(bld_trg_cpu)) \
 | 
|---|
 | 1023 |         $($(target)_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
 | 1024 |         $($(target)_DEPS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
 | 1025 |         $($(target)_DEPS.$(bld_trg).$(bld_type)) \
 | 
|---|
 | 1026 |         $($(target)_DEPS.$(bld_trg_arch)) \
 | 
|---|
 | 1027 |         $($(target)_DEPS.$(bld_trg)) \
 | 
|---|
 | 1028 |         $($(target)_DEPS.$(bld_type)) \
 | 
|---|
 | 1029 |         $($(target)_DEPS) \
 | 
|---|
 | 1030 |         $($(target)_LNK_DEPS.$(bld_trg_cpu)) \
 | 
|---|
 | 1031 |         $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
 | 1032 |         $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
 | 1033 |         $($(target)_LNK_DEPS.$(bld_trg).$(bld_type)) \
 | 
|---|
 | 1034 |         $($(target)_LNK_DEPS.$(bld_trg_arch)) \
 | 
|---|
 | 1035 |         $($(target)_LNK_DEPS.$(bld_trg)) \
 | 
|---|
 | 1036 |         $($(target)_LNK_DEPS.$(bld_type)) \
 | 
|---|
 | 1037 |         $($(target)_LNK_DEPS)
 | 
|---|
 | 1038 | local orderdeps   := \
 | 
|---|
 | 1039 |         $($(target)_ORDERDEPS.$(bld_trg_cpu)) \
 | 
|---|
 | 1040 |         $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
 | 1041 |         $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
 | 1042 |         $($(target)_ORDERDEPS.$(bld_trg).$(bld_type)) \
 | 
|---|
 | 1043 |         $($(target)_ORDERDEPS.$(bld_trg_arch)) \
 | 
|---|
 | 1044 |         $($(target)_ORDERDEPS.$(bld_trg)) \
 | 
|---|
 | 1045 |         $($(target)_ORDERDEPS.$(bld_type)) \
 | 
|---|
 | 1046 |         $($(target)_ORDERDEPS) \
 | 
|---|
 | 1047 |         $($(target)_LNK_ORDERDEPS.$(bld_trg_cpu)) \
 | 
|---|
 | 1048 |         $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
 | 
|---|
 | 1049 |         $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
 | 1050 |         $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_type)) \
 | 
|---|
 | 1051 |         $($(target)_LNK_ORDERDEPS.$(bld_trg_arch)) \
 | 
|---|
 | 1052 |         $($(target)_LNK_ORDERDEPS.$(bld_trg)) \
 | 
|---|
 | 1053 |         $($(target)_LNK_ORDERDEPS.$(bld_type)) \
 | 
|---|
 | 1054 |         $($(target)_LNK_ORDERDEPS)
 | 
|---|
| [353] | 1055 | 
 | 
|---|
| [725] | 1056 | # Adjust paths if we got a default path.
 | 
|---|
 | 1057 | ifneq ($(defpath),)
 | 
|---|
| [3521] | 1058 |  ifdef KMK_WITH_QUOTING
 | 
|---|
 | 1059 |   local libpath    := $(qabspathex ,$(libpath),$(defpath))
 | 
|---|
 | 1060 |   local deps       := $(qabspathex ,$(deps),$(defpath))
 | 
|---|
 | 1061 |   local orderdeps  := $(qabspathex ,$(orderdeps),$(defpath))
 | 
|---|
 | 1062 |   othersrc := $(qabspathex ,$(othersrc),$(defpath))
 | 
|---|
 | 1063 |  else
 | 
|---|
 | 1064 |   local libpath    := $(abspathex $(libpath),$(defpath))
 | 
|---|
 | 1065 |   local deps       := $(abspathex $(deps),$(defpath))
 | 
|---|
 | 1066 |   local orderdeps  := $(abspathex $(orderdeps),$(defpath))
 | 
|---|
 | 1067 |   othersrc := $(abspathex $(othersrc),$(defpath))
 | 
|---|
 | 1068 |  endif
 | 
|---|
| [1755] | 1069 |  # libs are not subject to this because of the the -l<lib> stuff. Use $(<target>_DEFPATH)/lib if relative to current dir!
 | 
|---|
| [725] | 1070 | endif
 | 
|---|
 | 1071 | 
 | 
|---|
| [2523] | 1072 | # Debug info.
 | 
|---|
 | 1073 | local ld_debug      := $(evalcall def_fn_prop_get_first_defined,LD_DEBUG)
 | 
|---|
 | 1074 | local debug_inst    := $(evalcall def_fn_prop_get_first_defined,DEBUG_INST)
 | 
|---|
 | 1075 | local debug_stage   := $(evalcall def_fn_prop_get_first_defined,DEBUG_STAGE)
 | 
|---|
 | 1076 | local debug_nostage := $(evalcall def_fn_prop_get_first_word,DEBUG_NOSTAGE)
 | 
|---|
 | 1077 | 
 | 
|---|
| [2475] | 1078 | # Custom pre/post-link actions.
 | 
|---|
| [3128] | 1079 | local pre_cmds      := $(evalcall def_fn_prop_get_all_prefixed_priority_last,PRE_CMDS,$(NLTAB))
 | 
|---|
 | 1080 | local post_cmds     := $(evalcall def_fn_prop_get_all_prefixed_priority_last,POST_CMDS,$(NLTAB))
 | 
|---|
| [72] | 1081 | 
 | 
|---|
| [1424] | 1082 | # eliminate this guy?
 | 
|---|
| [2236] | 1083 | local objs = $($(target)_2_OBJS)
 | 
|---|
| [1424] | 1084 | 
 | 
|---|
| [380] | 1085 | # dependency file
 | 
|---|
| [1496] | 1086 | local dep := $(outbase)$(SUFF_DEP)
 | 
|---|
| [524] | 1087 | ifndef NO_LINK_CMDS_DEPS
 | 
|---|
| [2188] | 1088 |  _DEPFILES_INCLUDED += $(dep)
 | 
|---|
| [1798] | 1089 |  ifdef KB_HAVE_INCLUDEDEP_QUEUE
 | 
|---|
 | 1090 |   includedep-queue $(dep)
 | 
|---|
| [1795] | 1091 |  else
 | 
|---|
| [1798] | 1092 |   includedep $(dep)
 | 
|---|
| [1795] | 1093 |  endif
 | 
|---|
| [380] | 1094 | endif
 | 
|---|
| [353] | 1095 | 
 | 
|---|
| [380] | 1096 | # check that the tool is defined.
 | 
|---|
 | 1097 | ifndef TOOL_$(tool)_$(tool_do)_CMDS
 | 
|---|
 | 1098 | $(warning kBuild: tools: \
 | 
|---|
| [481] | 1099 |         1 $($(target)_$(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
 | 1100 |         2 $($(target)_$(source)TOOL.$(bld_trg)) \
 | 
|---|
 | 1101 |         3 $($(target)_$(source)TOOL) \
 | 
|---|
 | 1102 |         4 $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
 | 1103 |         5 $($(target)_TOOL.$(bld_trg)) \
 | 
|---|
 | 1104 |         6 $($(target)_TOOL) \
 | 
|---|
 | 1105 |         7 $($(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
 | 1106 |         8 $($(source)TOOL.$(bld_trg)) \
 | 
|---|
 | 1107 |         9 $($(source)TOOL) \
 | 
|---|
 | 1108 |         10 $(TOOL.$(bld_trg).$(bld_trg_arch)) \
 | 
|---|
 | 1109 |         11 $(TOOL.$(bld_trg)) \
 | 
|---|
 | 1110 |         12 $(TOOL) )
 | 
|---|
| [380] | 1111 | $(error kBuild: TOOL_$(tool)_$(tool_do)_CMDS isn't defined! target=$(target) )
 | 
|---|
 | 1112 | endif
 | 
|---|
| [353] | 1113 | 
 | 
|---|
| [380] | 1114 | # call the tool
 | 
|---|
| [1496] | 1115 | local cmds   := $(TOOL_$(tool)_$(tool_do)_CMDS)
 | 
|---|
| [859] | 1116 | ifneq ($(pre_cmds),)
 | 
|---|
| [1496] | 1117 |  local cmds  := $(TAB)$(pre_cmds)$(NL)$(TAB)$(cmds)
 | 
|---|
| [859] | 1118 | endif
 | 
|---|
 | 1119 | ifneq ($(post_cmds),)
 | 
|---|
| [1496] | 1120 |  local cmds  := $(cmds)$(NL)$(TAB)$(post_cmds)
 | 
|---|
| [859] | 1121 | endif
 | 
|---|
| [2523] | 1122 | $(target)_2_OUTPUT              := $(TOOL_$(tool)_$(tool_do)_OUTPUT)
 | 
|---|
 | 1123 | $(target)_2_OUTPUT_MAYBE        := $(TOOL_$(tool)_$(tool_do)_OUTPUT_MAYBE)
 | 
|---|
| [2795] | 1124 | $(target)_2_OUTPUT_MAYBE_PRECIOUS := $(TOOL_$(tool)_$(tool_do)_OUTPUT_MAYBE_PRECIOUS)
 | 
|---|
| [2523] | 1125 | if1of ($(ld_debug), split)
 | 
|---|
 | 1126 |  $(target)_2_OUTPUT_DEBUG_FILES := $(filter-out %/,$(TOOL_$(tool)_$(tool_do)_OUTPUT_DEBUG))
 | 
|---|
 | 1127 |  $(target)_2_OUTPUT_DEBUG_DIRS  := $(filter     %/,$(TOOL_$(tool)_$(tool_do)_OUTPUT_DEBUG))
 | 
|---|
 | 1128 | else
 | 
|---|
 | 1129 |  $(target)_2_OUTPUT_DEBUG_FILES :=
 | 
|---|
 | 1130 |  $(target)_2_OUTPUT_DEBUG_DIRS  :=
 | 
|---|
 | 1131 | endif
 | 
|---|
 | 1132 | $(target)_2_DEPEND              := $(TOOL_$(tool)_$(tool_do)_DEPEND) $(deps) $($(target)_2_OBJS)
 | 
|---|
 | 1133 | $(target)_2_DEPORD              := $(TOOL_$(tool)_$(tool_do)_DEPORD) $(dirdep) $(orderdeps)
 | 
|---|
| [353] | 1134 | 
 | 
|---|
| [412] | 1135 | # generate the link rule.
 | 
|---|
| [380] | 1136 | $(eval $(def_link_rule))
 | 
|---|
 | 1137 | 
 | 
|---|
| [2523] | 1138 | # installation targets
 | 
|---|
 | 1139 | local target_type_mode :=
 | 
|---|
 | 1140 | $(evalval def_target_install_only)
 | 
|---|
| [412] | 1141 | 
 | 
|---|
| [380] | 1142 | # Update globals.
 | 
|---|
| [2236] | 1143 | _OBJS += $($(target)_2_OBJS)
 | 
|---|
| [3304] | 1144 | _OUT_FILES += $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE) $($(target)_2_OUTPUT_MAYBE_PRECIOUS) $($(target)_2_OUTPUT_DEBUG_FILES) $(out)
 | 
|---|
| [905] | 1145 | _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))
 | 
|---|
 | 1146 | _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))
 | 
|---|
| [827] | 1147 | _INSTALLS_FILES += $(INSTARGET_$(target))
 | 
|---|
| [353] | 1148 | 
 | 
|---|
| [1936] | 1149 | endef # def_link_common
 | 
|---|
 | 1150 | $(eval-opt-var def_link_common)
 | 
|---|
| [353] | 1151 | 
 | 
|---|
 | 1152 | 
 | 
|---|
 | 1153 | #
 | 
|---|
 | 1154 | # BLDPROGS
 | 
|---|
 | 1155 | #
 | 
|---|
 | 1156 | 
 | 
|---|
 | 1157 | # Process build programs.
 | 
|---|
 | 1158 | EXT     := EXE
 | 
|---|
 | 1159 | EXTPRE  := HOST
 | 
|---|
| [380] | 1160 | tool_do := LINK_PROGRAM
 | 
|---|
| [353] | 1161 | typevar := _BLDPROGS
 | 
|---|
| [380] | 1162 | mode    := 0755
 | 
|---|
| [3415] | 1163 | bld_trg_base_var := HOST
 | 
|---|
| [2762] | 1164 | $(foreach target, $(_ALL_BLDPROGS), $(evalvalctx def_link_common))
 | 
|---|
| [353] | 1165 | 
 | 
|---|
| [988] | 1166 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| [2008] | 1167 |  $(evalcall def_profile_self, done build program targets)
 | 
|---|
| [988] | 1168 | endif
 | 
|---|
| [353] | 1169 | 
 | 
|---|
 | 1170 | 
 | 
|---|
 | 1171 | #
 | 
|---|
 | 1172 | # DLLS
 | 
|---|
 | 1173 | #
 | 
|---|
 | 1174 | 
 | 
|---|
| [189] | 1175 | # Process dlls
 | 
|---|
| [353] | 1176 | EXT     := DLL
 | 
|---|
 | 1177 | EXTPRE  :=
 | 
|---|
| [380] | 1178 | tool_do := LINK_DLL
 | 
|---|
| [353] | 1179 | typevar := _DLLS
 | 
|---|
| [830] | 1180 | mode    := 0644
 | 
|---|
| [353] | 1181 | bld_trg_base_var := TARGET
 | 
|---|
| [2762] | 1182 | $(foreach target, $(_ALL_DLLS), $(evalvalctx def_link_common))
 | 
|---|
| [74] | 1183 | 
 | 
|---|
| [988] | 1184 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| [2008] | 1185 |  $(evalcall def_profile_self, done dll targets)
 | 
|---|
| [988] | 1186 | endif
 | 
|---|
| [74] | 1187 | 
 | 
|---|
| [988] | 1188 | 
 | 
|---|
| [72] | 1189 | #
 | 
|---|
| [830] | 1190 | # IMPORT LIBRARIES
 | 
|---|
| [72] | 1191 | #
 | 
|---|
| [219] | 1192 | #   - On OS/2 and windows these are libraries.
 | 
|---|
| [189] | 1193 | #   - On other platforms they are fake DLLs.
 | 
|---|
| [830] | 1194 | #
 | 
|---|
 | 1195 | EXTPRE  :=
 | 
|---|
 | 1196 | typevar := _IMPORT_LIBS
 | 
|---|
 | 1197 | mode    := 0644
 | 
|---|
 | 1198 | bld_trg_base_var := TARGET
 | 
|---|
| [1504] | 1199 | ifeq ($(filter-out nt os2 win win64 win32,$(KBUILD_TARGET)),)
 | 
|---|
| [830] | 1200 |  EXT     := LIB
 | 
|---|
 | 1201 |  tool_do := LINK_LIBRARY
 | 
|---|
| [2762] | 1202 |  $(foreach target, $(_ALL_IMPORT_LIBS), $(evalvalctx def_lib))
 | 
|---|
| [189] | 1203 | else
 | 
|---|
| [830] | 1204 |  EXT     := DLL
 | 
|---|
 | 1205 |  tool_do := LINK_DLL
 | 
|---|
| [2762] | 1206 |  $(foreach target, $(_ALL_IMPORT_LIBS), $(evalvalctx def_link_common))
 | 
|---|
| [189] | 1207 | endif
 | 
|---|
| [72] | 1208 | 
 | 
|---|
| [988] | 1209 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| [2008] | 1210 |  $(evalcall def_profile_self, done import library targets)
 | 
|---|
| [988] | 1211 | endif
 | 
|---|
| [189] | 1212 | 
 | 
|---|
| [988] | 1213 | 
 | 
|---|
| [189] | 1214 | #
 | 
|---|
 | 1215 | # PROGRAMS
 | 
|---|
 | 1216 | #
 | 
|---|
 | 1217 | 
 | 
|---|
| [353] | 1218 | # Process programs
 | 
|---|
 | 1219 | EXT     := EXE
 | 
|---|
 | 1220 | EXTPRE  :=
 | 
|---|
| [380] | 1221 | tool_do := LINK_PROGRAM
 | 
|---|
| [353] | 1222 | typevar := _PROGRAMS
 | 
|---|
| [380] | 1223 | mode    := 0755
 | 
|---|
| [353] | 1224 | bld_trg_base_var := TARGET
 | 
|---|
| [2762] | 1225 | $(foreach target, $(_ALL_PROGRAMS), $(evalvalctx def_link_common))
 | 
|---|
| [130] | 1226 | 
 | 
|---|
| [988] | 1227 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| [2008] | 1228 |  $(evalcall def_profile_self, done program targets)
 | 
|---|
| [988] | 1229 | endif
 | 
|---|
| [130] | 1230 | 
 | 
|---|
| [189] | 1231 | 
 | 
|---|
| [72] | 1232 | #
 | 
|---|
| [83] | 1233 | # SYSMODS
 | 
|---|
| [72] | 1234 | #
 | 
|---|
 | 1235 | 
 | 
|---|
| [130] | 1236 | # Process sysmods
 | 
|---|
| [353] | 1237 | EXT     := SYS
 | 
|---|
 | 1238 | EXTPRE  :=
 | 
|---|
| [380] | 1239 | tool_do := LINK_SYSMOD
 | 
|---|
| [353] | 1240 | typevar := _SYSMODS
 | 
|---|
| [380] | 1241 | mode    := 0644
 | 
|---|
| [353] | 1242 | bld_trg_base_var := TARGET
 | 
|---|
| [2762] | 1243 | $(foreach target, $(_ALL_SYSMODS), $(evalvalctx def_link_common))
 | 
|---|
| [83] | 1244 | 
 | 
|---|
| [988] | 1245 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
| [2008] | 1246 |  $(evalcall def_profile_self, done sysmod targets)
 | 
|---|
| [988] | 1247 | endif
 | 
|---|
| [83] | 1248 | 
 | 
|---|
| [988] | 1249 | 
 | 
|---|
| [72] | 1250 | #
 | 
|---|
| [2084] | 1251 | # MISCBINS
 | 
|---|
 | 1252 | #
 | 
|---|
 | 1253 | 
 | 
|---|
 | 1254 | # Process MISCBINS
 | 
|---|
 | 1255 | EXT     := BIN
 | 
|---|
 | 1256 | EXTPRE  :=
 | 
|---|
 | 1257 | tool_do := LINK_MISCBIN
 | 
|---|
 | 1258 | typevar := _MISCBINS
 | 
|---|
 | 1259 | mode    := 0644
 | 
|---|
 | 1260 | bld_trg_base_var := TARGET
 | 
|---|
| [2762] | 1261 | $(foreach target, $(_ALL_MISCBINS), $(evalvalctx def_link_common))
 | 
|---|
| [2084] | 1262 | 
 | 
|---|
 | 1263 | ifdef KBUILD_PROFILE_SELF
 | 
|---|
 | 1264 |  $(evalcall def_profile_self, done misc binary targets)
 | 
|---|
 | 1265 | endif
 | 
|---|
 | 1266 | 
 | 
|---|