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