[72] | 1 | # $Id: footer-pass2-compiling-targets.kmk 2726 2014-02-26 23:23:54Z bird $
|
---|
| 2 | ## @file
|
---|
[2521] | 3 | # kBuild - Footer - Target lists - Pass 2 - Compiling Targets.
|
---|
[72] | 4 | #
|
---|
[1547] | 5 |
|
---|
| 6 | #
|
---|
[2726] | 7 | # Copyright (c) 2004-2014 knut st. osmundsen <bird-kBuild-spam-xiv@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
|
---|
[2551] | 350 | if1of ($($(target)_1_INSTTYPE) $($(target)_1_DEBUG_INSTTYPE), both stage)
|
---|
| 351 | # Determin common variables.
|
---|
[2225] | 352 | local mode := $(firstword \
|
---|
| 353 | $($(target)_MODE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
| 354 | $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 355 | $($(target)_MODE.$(bld_trg).$(bld_type)) \
|
---|
| 356 | $($(target)_MODE.$(bld_trg_arch)) \
|
---|
| 357 | $($(target)_MODE.$(bld_trg)) \
|
---|
| 358 | $($(target)_MODE.$(bld_type)) \
|
---|
[2483] | 359 | $($(target)_MODE) \
|
---|
| 360 | $(target_type_mode) )
|
---|
[2225] | 361 | local uid := $(firstword \
|
---|
| 362 | $($(target)_UID.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
| 363 | $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 364 | $($(target)_UID.$(bld_trg).$(bld_type)) \
|
---|
| 365 | $($(target)_UID.$(bld_trg_arch)) \
|
---|
| 366 | $($(target)_UID.$(bld_trg)) \
|
---|
| 367 | $($(target)_UID.$(bld_type)) \
|
---|
| 368 | $($(target)_UID) )
|
---|
| 369 | local gid := $(firstword \
|
---|
| 370 | $($(target)_GID.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
| 371 | $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 372 | $($(target)_GID.$(bld_trg).$(bld_type)) \
|
---|
| 373 | $($(target)_GID.$(bld_trg_arch)) \
|
---|
| 374 | $($(target)_GID.$(bld_trg)) \
|
---|
| 375 | $($(target)_GID.$(bld_type)) \
|
---|
| 376 | $($(target)_GID) )
|
---|
[2475] | 377 | local pre_install_cmds := $(evalcall def_fn_prop_get_first_defined,PRE_INST_CMDS)
|
---|
| 378 | local post_install_cmds := $(evalcall def_fn_prop_get_first_defined,POST_INST_CMDS)
|
---|
[2551] | 379 | endif
|
---|
[219] | 380 |
|
---|
[2551] | 381 | ifneq ($($(target)_1_INSTTYPE),none)
|
---|
[2475] | 382 | # Generate the rules
|
---|
| 383 | ifeq ($($(target)_1_INSTTYPE),both)
|
---|
[353] | 384 | $(eval $(def_link_install_rule))
|
---|
[2475] | 385 | _INSTALLS_FILES += $($(target)_1_INST_TARGET)
|
---|
[1697] | 386 | endif
|
---|
[2475] | 387 | $(eval $(def_link_stage_rule))
|
---|
| 388 | _STAGE_FILES += $($(target)_1_STAGE_TARGET)
|
---|
| 389 | $(typevar) += $($(target)_1_STAGE_TARGET)
|
---|
| 390 | else # INSTTYPE == none
|
---|
[1697] | 391 | $(typevar) += $(out)
|
---|
[2475] | 392 | endif # INSTTYPE == none
|
---|
[353] | 393 |
|
---|
[2523] | 394 | # Install debug info.
|
---|
| 395 | $(target)_2_DEBUG_STAGE_TARGET_DIRS :=
|
---|
| 396 | $(target)_2_DEBUG_STAGE_TARGET_FILES :=
|
---|
| 397 | $(target)_2_DEBUG_INSTALL_TARGET_DIRS :=
|
---|
| 398 | $(target)_2_DEBUG_INSTALL_TARGET_FILES :=
|
---|
| 399 |
|
---|
| 400 | if ( defined($(target)_2_OUTPUT_DEBUG_DIRS) \
|
---|
| 401 | || defined($(target)_2_OUTPUT_DEBUG_FILES) ) \
|
---|
| 402 | && "$($(target)_1_DEBUG_INSTTYPE)" != "none"
|
---|
| 403 | local mode := $(if $(mode),$(mode)$(COMMA)a-x,0644)
|
---|
| 404 |
|
---|
| 405 | ifeq ($($(target)_1_DEBUG_INSTTYPE),both)
|
---|
| 406 | local debug_inst_path := $(PATH_INS)
|
---|
| 407 | local debug_install_cmd := $(INSTALL)
|
---|
| 408 | local debug_var := INSTALL
|
---|
| 409 | $(foreach debug_inst, $($(target)_1_DEBUG_INST), $(evalval def_target_install_only_debug))
|
---|
| 410 | endif
|
---|
| 411 |
|
---|
| 412 | local debug_inst_path := $(PATH_STAGE)
|
---|
| 413 | local debug_install_cmd := $(INSTALL_STAGING)
|
---|
| 414 | local debug_var := STAGE
|
---|
| 415 | if1of ($($(target)_1_DEBUG_INSTTYPE), stage both)
|
---|
| 416 | $(foreach debug_inst, $($(target)_1_DEBUG_STAGE), $(evalval def_target_install_only_debug))
|
---|
| 417 | endif
|
---|
| 418 | if1of ($($(target)_1_INSTTYPE), stage both)
|
---|
| 419 | ifndef debug_nostage
|
---|
| 420 | $(foreach debug_inst,$($(target)_1_STAGE), $(evalval def_target_install_only_debug))
|
---|
| 421 | endif
|
---|
| 422 | endif
|
---|
| 423 |
|
---|
| 424 | _DEBUG_STAGE_DIRS += $($(target)_2_DEBUG_STAGE_TARGET_DIRS)
|
---|
| 425 | _DEBUG_STAGE_FILES += $($(target)_2_DEBUG_STAGE_TARGET_FILES)
|
---|
| 426 | _DEBUG_INSTALL_DIRS += $($(target)_2_DEBUG_INSTALL_TARGET_DIRS)
|
---|
| 427 | _DEBUG_INSTALL_FILES += $($(target)_2_DEBUG_INSTALL_TARGET_FILES)
|
---|
| 428 |
|
---|
| 429 | $(basename $(notdir $(out))):: $($(target)_2_DEBUG_STAGE_TARGET_DIRS) $($(target)_2_DEBUG_STAGE_TARGET_FILES)
|
---|
| 430 | endif
|
---|
| 431 |
|
---|
[2475] | 432 | endef # def_target_install_only
|
---|
[353] | 433 |
|
---|
[219] | 434 |
|
---|
| 435 |
|
---|
| 436 | #
|
---|
[72] | 437 | # LIBRARIES
|
---|
[73] | 438 | #
|
---|
[72] | 439 |
|
---|
| 440 | ## Library (one).
|
---|
[74] | 441 | # @param $(target) Normalized library (target) name.
|
---|
[72] | 442 | define def_lib
|
---|
[145] | 443 | # library basics
|
---|
[222] | 444 | ## @todo prefix
|
---|
[1504] | 445 | local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
|
---|
| 446 | local bld_trg := $(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))
|
---|
| 447 | local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
|
---|
| 448 | local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(KBUILD_TARGET_CPU))
|
---|
[1496] | 449 | local tool := $(call _TARGET_TOOL,$(target),AR)
|
---|
[78] | 450 | ifeq ($(tool),)
|
---|
[353] | 451 | $(error kBuild: Library target $(target) does not have a tool defined!)
|
---|
[78] | 452 | endif
|
---|
[1496] | 453 | local name := $(firstword\
|
---|
[2433] | 454 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
|
---|
[889] | 455 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
---|
[2433] | 456 | $($(target)_NAME.$(bld_trg).$(bld_type))\
|
---|
[889] | 457 | $($(target)_NAME.$(bld_trg_arch))\
|
---|
| 458 | $($(target)_NAME.$(bld_trg))\
|
---|
| 459 | $($(target)_NAME.$(bld_type))\
|
---|
| 460 | $($(target)_NAME)\
|
---|
| 461 | $(target))
|
---|
[1496] | 462 | local outbase := $(call TARGET_BASE,$(name),$(target))
|
---|
[2239] | 463 | $(target)_0_OUTDIR:= $(patsubst %/,%,$(dir $(outbase)))
|
---|
[2436] | 464 | $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
|
---|
[1496] | 465 | local suff := $(firstword\
|
---|
[481] | 466 | $($(target)_LIBSUFF.$(bld_trg).$(bld_trg_arch))\
|
---|
[221] | 467 | $($(target)_LIBSUFF.$(bld_trg))\
|
---|
[126] | 468 | $($(target)_LIBSUFF)\
|
---|
[481] | 469 | $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg).$(bld_trg_arch))\
|
---|
[221] | 470 | $(TOOL_$(tool)_ARLIBSUFF.$(bld_trg))\
|
---|
[126] | 471 | $(TOOL_$(tool)_ARLIBSUFF)\
|
---|
[353] | 472 | $(SUFF_LIB))
|
---|
[1496] | 473 | local out := $(outbase)$(suff)
|
---|
[2434] | 474 | local defpath := $($(target)_DEFPATH)
|
---|
| 475 | ifeq ($(defpath),)
|
---|
| 476 | local defpath := $($(target)_PATH)
|
---|
| 477 | endif
|
---|
[2238] | 478 | $(target)_1_TARGET:= $(out)
|
---|
[2436] | 479 | $(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
|
---|
[1496] | 480 | # no local here - must be writable across some foreachs.
|
---|
| 481 | othersrc :=
|
---|
[2236] | 482 | $(target)_2_OBJS :=
|
---|
[145] | 483 |
|
---|
[1672] | 484 | # Do units pre source callouts.
|
---|
| 485 | local units := \
|
---|
| 486 | $($(target)_USES.$(bld_trg).$(bld_trg_arch))\
|
---|
| 487 | $($(target)_USES.$(bld_trg_arch))\
|
---|
| 488 | $($(target)_USES.$(bld_trg))\
|
---|
| 489 | $($(target)_USES.$(bld_type))\
|
---|
| 490 | $($(target)_USES)
|
---|
| 491 | $(foreach unit,$(units),$(evalval def_unit_$(unit)_target_pre))
|
---|
| 492 |
|
---|
[145] | 493 | # source -> object
|
---|
[1496] | 494 | $(evalval def_target_sources)
|
---|
[145] | 495 |
|
---|
| 496 | # library linking
|
---|
[1496] | 497 | local tool := $(call _TARGET_TOOL,$(target),AR)
|
---|
| 498 | local name := $(firstword\
|
---|
[2433] | 499 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
|
---|
[889] | 500 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
---|
[2433] | 501 | $($(target)_NAME.$(bld_trg).$(bld_type))\
|
---|
[889] | 502 | $($(target)_NAME.$(bld_trg_arch))\
|
---|
| 503 | $($(target)_NAME.$(bld_trg))\
|
---|
| 504 | $($(target)_NAME.$(bld_type))\
|
---|
| 505 | $($(target)_NAME)\
|
---|
| 506 | $(target))
|
---|
[1496] | 507 | local outbase := $(call TARGET_BASE,$(name),$(target))
|
---|
| 508 | local flags :=\
|
---|
[74] | 509 | $(TOOL_$(tool)_ARFLAGS)\
|
---|
[221] | 510 | $(TOOL_$(tool)_ARFLAGS.$(bld_type))\
|
---|
[74] | 511 | $(ARFLAGS)\
|
---|
[221] | 512 | $(ARFLAGS.$(bld_type))\
|
---|
[74] | 513 | $($(target)_ARFLAGS)\
|
---|
[481] | 514 | $($(target)_ARFLAGS.$(bld_type)) \
|
---|
| 515 | $($(target)_ARFLAGS.$(bld_trg)) \
|
---|
| 516 | $($(target)_ARFLAGS.$(bld_trg_arch)) \
|
---|
| 517 | $($(target)_ARFLAGS.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 518 | $($(target)_ARFLAGS.$(bld_trg_cpu))
|
---|
[1496] | 519 | local dirdep := $(call DIRDEP,$(dir $(out)))
|
---|
[1702] | 520 | local deps := \
|
---|
| 521 | $($(target)_DEPS.$(bld_trg_cpu)) \
|
---|
| 522 | $($(target)_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
| 523 | $($(target)_DEPS.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 524 | $($(target)_DEPS.$(bld_trg).$(bld_type)) \
|
---|
| 525 | $($(target)_DEPS.$(bld_trg_arch)) \
|
---|
| 526 | $($(target)_DEPS.$(bld_trg)) \
|
---|
| 527 | $($(target)_DEPS.$(bld_type)) \
|
---|
| 528 | $($(target)_DEPS) \
|
---|
| 529 | $($(target)_LNK_DEPS.$(bld_trg_cpu)) \
|
---|
| 530 | $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
| 531 | $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 532 | $($(target)_LNK_DEPS.$(bld_trg).$(bld_type)) \
|
---|
| 533 | $($(target)_LNK_DEPS.$(bld_trg_arch)) \
|
---|
| 534 | $($(target)_LNK_DEPS.$(bld_trg)) \
|
---|
| 535 | $($(target)_LNK_DEPS.$(bld_type)) \
|
---|
| 536 | $($(target)_LNK_DEPS)
|
---|
| 537 | local orderdeps := \
|
---|
| 538 | $($(target)_ORDERDEPS.$(bld_trg_cpu)) \
|
---|
| 539 | $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
| 540 | $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 541 | $($(target)_ORDERDEPS.$(bld_trg).$(bld_type)) \
|
---|
| 542 | $($(target)_ORDERDEPS.$(bld_trg_arch)) \
|
---|
| 543 | $($(target)_ORDERDEPS.$(bld_trg)) \
|
---|
| 544 | $($(target)_ORDERDEPS.$(bld_type)) \
|
---|
| 545 | $($(target)_ORDERDEPS) \
|
---|
| 546 | $($(target)_LNK_ORDERDEPS.$(bld_trg_cpu)) \
|
---|
| 547 | $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
| 548 | $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 549 | $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_type)) \
|
---|
| 550 | $($(target)_LNK_ORDERDEPS.$(bld_trg_arch)) \
|
---|
| 551 | $($(target)_LNK_ORDERDEPS.$(bld_trg)) \
|
---|
| 552 | $($(target)_LNK_ORDERDEPS.$(bld_type)) \
|
---|
| 553 | $($(target)_LNK_ORDERDEPS)
|
---|
[72] | 554 |
|
---|
[725] | 555 | # Adjust paths if we got a default path.
|
---|
| 556 | ifneq ($(defpath),)
|
---|
[1496] | 557 | local deps := $(abspathex $(deps),$(defpath))
|
---|
| 558 | local orderdeps := $(abspathex $(orderdeps),$(defpath))
|
---|
[1472] | 559 | othersrc := $(abspathex $(othersrc),$(defpath))
|
---|
[725] | 560 | endif
|
---|
| 561 |
|
---|
[859] | 562 |
|
---|
| 563 | # Custom pre-link actions.
|
---|
[2475] | 564 | local pre_cmds := $(evalcall def_fn_prop_get_first_defined,PRE_CMDS)
|
---|
| 565 | local post_cmds := $(evalcall def_fn_prop_get_first_defined,POST_CMDS)
|
---|
[859] | 566 |
|
---|
[1424] | 567 | # eliminate this guy?
|
---|
[2236] | 568 | local objs = $($(target)_2_OBJS)
|
---|
[1424] | 569 |
|
---|
[380] | 570 | # dependency file
|
---|
[1496] | 571 | local dep := $(out)$(SUFF_DEP)
|
---|
[524] | 572 | ifndef NO_LINK_CMDS_DEPS
|
---|
[1798] | 573 | _DEPFILES_INCLUDED += $(dep)
|
---|
| 574 | ifdef KB_HAVE_INCLUDEDEP_QUEUE
|
---|
| 575 | includedep-queue $(dep)
|
---|
[1795] | 576 | else
|
---|
[1798] | 577 | includedep $(dep)
|
---|
[1795] | 578 | endif
|
---|
[380] | 579 | endif
|
---|
[72] | 580 |
|
---|
[380] | 581 | # check that the tool is defined.
|
---|
| 582 | ifndef TOOL_$(tool)_LINK_LIBRARY_CMDS
|
---|
| 583 | $(warning kBuild: tools: \
|
---|
[481] | 584 | 1 $($(target)_$(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 585 | 2 $($(target)_$(source)TOOL.$(bld_trg)) \
|
---|
| 586 | 3 $($(target)_$(source)TOOL) \
|
---|
| 587 | 4 $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 588 | 5 $($(target)_TOOL.$(bld_trg)) \
|
---|
| 589 | 6 $($(target)_TOOL) \
|
---|
| 590 | 7 $($(source)TOOL) \
|
---|
| 591 | 8 $($(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 592 | 9 $($(source)TOOL.$(bld_trg)) \
|
---|
| 593 | 10 $(TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 594 | 11 $(TOOL.$(bld_trg)) \
|
---|
| 595 | 12 $(TOOL) )
|
---|
[380] | 596 | $(error kBuild: TOOL_$(tool)_LINK_LIBRARY_CMDS isn't defined! target=$(target) )
|
---|
| 597 | endif
|
---|
| 598 |
|
---|
| 599 | # call the tool
|
---|
[2523] | 600 | local cmds := $(TOOL_$(tool)_LINK_LIBRARY_CMDS)
|
---|
[859] | 601 | ifneq ($(pre_cmds),)
|
---|
[1496] | 602 | local cmds := $(TAB)$(pre_cmds)$(NL)$(TAB)$(cmds)
|
---|
[859] | 603 | endif
|
---|
| 604 | ifneq ($(post_cmds),)
|
---|
[2523] | 605 | local cmds := $(cmds)$(NL)$(TAB)$(post_cmds)
|
---|
[859] | 606 | endif
|
---|
[2234] | 607 | $(target)_2_OUTPUT := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT)
|
---|
| 608 | $(target)_2_OUTPUT_MAYBE := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT_MAYBE)
|
---|
[2236] | 609 | $(target)_2_DEPEND := $(TOOL_$(tool)_LINK_LIBRARY_DEPEND) $(deps) $($(target)_2_OBJS)
|
---|
[2234] | 610 | $(target)_2_DEPORD := $(TOOL_$(tool)_LINK_LIBRARY_DEPORD) $(dirdep) $(orderdeps)
|
---|
[380] | 611 |
|
---|
[412] | 612 | # generate the link rule.
|
---|
[380] | 613 | $(eval $(def_link_rule))
|
---|
| 614 |
|
---|
[2475] | 615 | # installing and globals.
|
---|
[2483] | 616 | local target_type_mode := a+r,u+w
|
---|
[2475] | 617 | $(evalval def_target_install_only)
|
---|
| 618 |
|
---|
| 619 | _OUT_FILES += $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE) $(out)
|
---|
| 620 | _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))
|
---|
| 621 | _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))
|
---|
| 622 | _OBJS += $($(target)_2_OBJS)
|
---|
| 623 |
|
---|
| 624 | endef # def_lib
|
---|
[1936] | 625 | $(eval-opt-var def_lib)
|
---|
[72] | 626 |
|
---|
| 627 | # Process libraries
|
---|
[859] | 628 | typevar := _LIBS
|
---|
[776] | 629 | tool_do := LINK_LIBRARY
|
---|
[380] | 630 | mode := 0644
|
---|
[1648] | 631 | $(foreach target, $(_ALL_LIBRARIES), $(evalval def_lib))
|
---|
[72] | 632 |
|
---|
[988] | 633 | ifdef KBUILD_PROFILE_SELF
|
---|
[2008] | 634 | $(evalcall def_profile_self, done library targets)
|
---|
[988] | 635 | endif
|
---|
[72] | 636 |
|
---|
[988] | 637 |
|
---|
[72] | 638 | #
|
---|
[353] | 639 | # Link operations.
|
---|
[72] | 640 | #
|
---|
| 641 |
|
---|
[353] | 642 | ##
|
---|
| 643 | # Link prolog
|
---|
| 644 | #
|
---|
| 645 | # @param $(target) Normalized target name.
|
---|
| 646 | # @param $(EXT) EXE,DLL,SYS.
|
---|
| 647 | # @param $(typevar) The name of the variable with all the root targets of its type.
|
---|
[380] | 648 | define def_link_common
|
---|
[353] | 649 | # basics
|
---|
[1504] | 650 | local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
|
---|
[1496] | 651 | local bld_trg := $(firstword $($(target)_BLD_TRG) $(BUILD_$(bld_trg_base_var)))
|
---|
| 652 | local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
|
---|
| 653 | local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(BUILD_$(bld_trg_base_var)_CPU))
|
---|
[145] | 654 |
|
---|
[1496] | 655 | local tool := $(call _TARGET_TOOL,$(target),LD)
|
---|
| 656 | local name := $(firstword\
|
---|
[2433] | 657 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
|
---|
[889] | 658 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
---|
[2433] | 659 | $($(target)_NAME.$(bld_trg).$(bld_type))\
|
---|
[889] | 660 | $($(target)_NAME.$(bld_trg_arch))\
|
---|
| 661 | $($(target)_NAME.$(bld_trg))\
|
---|
| 662 | $($(target)_NAME.$(bld_type))\
|
---|
| 663 | $($(target)_NAME)\
|
---|
| 664 | $(target))
|
---|
[1496] | 665 | local outbase := $(call TARGET_BASE,$(name),$(target))
|
---|
[2239] | 666 | $(target)_0_OUTDIR:= $(patsubst %/,%,$(dir $(outbase)))
|
---|
[2436] | 667 | $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
|
---|
[2143] | 668 | local suff := $(firstword \
|
---|
| 669 | $($(target)_$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
|
---|
| 670 | $($(target)_$(EXT)SUFF.$(bld_trg))\
|
---|
| 671 | $($(target)_$(EXT)SUFF)\
|
---|
| 672 | $(TOOL_$(tool)_LD$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
|
---|
| 673 | $(TOOL_$(tool)_LD$(EXT)SUFF.$(bld_trg))\
|
---|
| 674 | $(TOOL_$(tool)_LD$(EXT)SUFF)\
|
---|
| 675 | $($(EXTPRE)SUFF_$(EXT)) )
|
---|
[1496] | 676 | local out := $(outbase)$(suff)
|
---|
[2238] | 677 | $(target)_1_TARGET:= $(out)
|
---|
[2436] | 678 | $(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
|
---|
[2434] | 679 | local defpath := $($(target)_DEFPATH)
|
---|
| 680 | ifeq ($(defpath),)
|
---|
| 681 | local defpath := $($(target)_PATH)
|
---|
| 682 | endif
|
---|
[1496] | 683 | # no local here - must be writable across some foreachs.
|
---|
| 684 | othersrc :=
|
---|
[2236] | 685 | $(target)_2_OBJS :=
|
---|
[353] | 686 |
|
---|
[1672] | 687 | # Do units pre source callouts.
|
---|
| 688 | local units := \
|
---|
| 689 | $($(target)_USES.$(bld_trg).$(bld_trg_arch))\
|
---|
| 690 | $($(target)_USES.$(bld_trg_arch))\
|
---|
| 691 | $($(target)_USES.$(bld_trg))\
|
---|
| 692 | $($(target)_USES.$(bld_type))\
|
---|
| 693 | $($(target)_USES)
|
---|
| 694 | $(foreach unit,$(units),$(evalval def_unit_$(unit)_target_pre))
|
---|
| 695 |
|
---|
[145] | 696 | # source -> object
|
---|
[1496] | 697 | $(evalval def_target_sources)
|
---|
[145] | 698 |
|
---|
[744] | 699 | # more link stuff.
|
---|
[1496] | 700 | local tool := $(call _TARGET_TOOL,$(target),LD)
|
---|
| 701 | local name := $(firstword\
|
---|
[2433] | 702 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch).$(bld_type))\
|
---|
[889] | 703 | $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
|
---|
[2433] | 704 | $($(target)_NAME.$(bld_trg).$(bld_type))\
|
---|
[889] | 705 | $($(target)_NAME.$(bld_trg_arch))\
|
---|
| 706 | $($(target)_NAME.$(bld_trg))\
|
---|
| 707 | $($(target)_NAME.$(bld_type))\
|
---|
| 708 | $($(target)_NAME)\
|
---|
| 709 | $(target))
|
---|
[1496] | 710 | local outbase := $(call TARGET_BASE,$(name),$(target))
|
---|
| 711 | local flags :=\
|
---|
[74] | 712 | $(TOOL_$(tool)_LDFLAGS)\
|
---|
[221] | 713 | $(TOOL_$(tool)_LDFLAGS.$(bld_type))\
|
---|
| 714 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg))\
|
---|
| 715 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg_arch))\
|
---|
[481] | 716 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
---|
[221] | 717 | $(TOOL_$(tool)_LDFLAGS.$(bld_trg_cpu))\
|
---|
[1242] | 718 | $(foreach sdk, $(SDKS) \
|
---|
| 719 | $(SDKS.$(bld_type)) \
|
---|
| 720 | $(SDKS.$(bld_trg)) \
|
---|
| 721 | $(SDKS.$(bld_trg_arch)) \
|
---|
| 722 | $(SDKS.$(bld_trg).$(bld_trg_arch)),\
|
---|
| 723 | $(SDK_$(sdk)_LDFLAGS)\
|
---|
| 724 | $(SDK_$(sdk)_LDFLAGS.$(bld_type))\
|
---|
| 725 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg))\
|
---|
| 726 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg_arch))\
|
---|
| 727 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
---|
| 728 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg_cpu)))\
|
---|
[74] | 729 | $(LDFLAGS)\
|
---|
[221] | 730 | $(LDFLAGS.$(bld_type))\
|
---|
| 731 | $(LDFLAGS.$(bld_trg))\
|
---|
| 732 | $(LDFLAGS.$(bld_trg_arch))\
|
---|
[481] | 733 | $(LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
---|
[221] | 734 | $(LDFLAGS.$(bld_trg_cpu))\
|
---|
[1242] | 735 | $(foreach sdk, $($(target)_SDKS) \
|
---|
| 736 | $($(target)_SDKS.$(bld_type)) \
|
---|
| 737 | $($(target)_SDKS.$(bld_trg)) \
|
---|
| 738 | $($(target)_SDKS.$(bld_trg_arch)) \
|
---|
| 739 | $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)),\
|
---|
| 740 | $(SDK_$(sdk)_LDFLAGS)\
|
---|
| 741 | $(SDK_$(sdk)_LDFLAGS.$(bld_type))\
|
---|
| 742 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg))\
|
---|
| 743 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg_arch))\
|
---|
| 744 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
---|
| 745 | $(SDK_$(sdk)_LDFLAGS.$(bld_trg_cpu)))\
|
---|
[74] | 746 | $($(target)_LDFLAGS)\
|
---|
[221] | 747 | $($(target)_LDFLAGS.$(bld_type))\
|
---|
| 748 | $($(target)_LDFLAGS.$(bld_trg))\
|
---|
| 749 | $($(target)_LDFLAGS.$(bld_trg_arch))\
|
---|
[481] | 750 | $($(target)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
|
---|
[353] | 751 | $($(target)_LDFLAGS.$(bld_trg_cpu))
|
---|
[1496] | 752 | local libs :=\
|
---|
[221] | 753 | $($(target)_LIBS.$(bld_trg_cpu))\
|
---|
[481] | 754 | $($(target)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
[221] | 755 | $($(target)_LIBS.$(bld_trg_arch))\
|
---|
| 756 | $($(target)_LIBS.$(bld_trg))\
|
---|
| 757 | $($(target)_LIBS.$(bld_type))\
|
---|
[74] | 758 | $($(target)_LIBS)\
|
---|
[592] | 759 | $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 760 | $($(target)_SDKS.$(bld_trg_arch)) \
|
---|
| 761 | $($(target)_SDKS.$(bld_trg)) \
|
---|
| 762 | $($(target)_SDKS.$(bld_type)) \
|
---|
| 763 | $($(target)_SDKS),\
|
---|
[353] | 764 | $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
|
---|
[481] | 765 | $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
[353] | 766 | $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
|
---|
| 767 | $(SDK_$(sdk)_LIBS.$(bld_trg))\
|
---|
| 768 | $(SDK_$(sdk)_LIBS.$(bld_type))\
|
---|
| 769 | $(SDK_$(sdk)_LIBS))\
|
---|
[221] | 770 | $(LIBS.$(bld_trg_cpu))\
|
---|
[481] | 771 | $(LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
[221] | 772 | $(LIBS.$(bld_trg_arch))\
|
---|
| 773 | $(LIBS.$(bld_trg))\
|
---|
| 774 | $(LIBS.$(bld_type))\
|
---|
[74] | 775 | $(LIBS)\
|
---|
[592] | 776 | $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 777 | $(SDKS.$(bld_trg_arch)) \
|
---|
| 778 | $(SDKS.$(bld_trg)) \
|
---|
| 779 | $(SDKS.$(bld_type)) \
|
---|
| 780 | $(SDKS),\
|
---|
[353] | 781 | $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
|
---|
[481] | 782 | $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
[353] | 783 | $(SDK_$(sdk)_LIBS.$(bld_trg_arch))\
|
---|
| 784 | $(SDK_$(sdk)_LIBS.$(bld_trg))\
|
---|
| 785 | $(SDK_$(sdk)_LIBS.$(bld_type))\
|
---|
| 786 | $(SDK_$(sdk)_LIBS))\
|
---|
[221] | 787 | $(TOOL_$(tool)_LIBS.$(bld_trg_cpu))\
|
---|
[481] | 788 | $(TOOL_$(tool)_LIBS.$(bld_trg).$(bld_trg_arch))\
|
---|
[221] | 789 | $(TOOL_$(tool)_LIBS.$(bld_trg_arch))\
|
---|
| 790 | $(TOOL_$(tool)_LIBS.$(bld_trg))\
|
---|
| 791 | $(TOOL_$(tool)_LIBS.$(bld_type))\
|
---|
[353] | 792 | $(TOOL_$(tool)_LIBS)
|
---|
[1496] | 793 | local libpath :=\
|
---|
[221] | 794 | $($(target)_LIBPATH.$(bld_trg_cpu))\
|
---|
[481] | 795 | $($(target)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
[221] | 796 | $($(target)_LIBPATH.$(bld_trg_arch))\
|
---|
| 797 | $($(target)_LIBPATH.$(bld_trg))\
|
---|
| 798 | $($(target)_LIBPATH.$(bld_type))\
|
---|
[74] | 799 | $($(target)_LIBPATH)\
|
---|
[592] | 800 | $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 801 | $($(target)_SDKS.$(bld_trg_arch)) \
|
---|
| 802 | $($(target)_SDKS.$(bld_trg)) \
|
---|
| 803 | $($(target)_SDKS.$(bld_type)) \
|
---|
| 804 | $($(target)_SDKS),\
|
---|
[353] | 805 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
|
---|
[481] | 806 | $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
[353] | 807 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
|
---|
| 808 | $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
|
---|
| 809 | $(SDK_$(sdk)_LIBPATH.$(bld_type))\
|
---|
| 810 | $(SDK_$(sdk)_LIBPATH))\
|
---|
[221] | 811 | $(LIBPATH.$(bld_trg_cpu))\
|
---|
[481] | 812 | $(LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
[221] | 813 | $(LIBPATH.$(bld_trg_arch))\
|
---|
| 814 | $(LIBPATH.$(bld_trg))\
|
---|
| 815 | $(LIBPATH.$(bld_type))\
|
---|
[74] | 816 | $(LIBPATH)\
|
---|
[592] | 817 | $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 818 | $(SDKS.$(bld_trg_arch)) \
|
---|
| 819 | $(SDKS.$(bld_trg)) \
|
---|
| 820 | $(SDKS.$(bld_type)) \
|
---|
| 821 | $(SDKS),\
|
---|
[353] | 822 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
|
---|
[481] | 823 | $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
[353] | 824 | $(SDK_$(sdk)_LIBPATH.$(bld_trg_arch))\
|
---|
| 825 | $(SDK_$(sdk)_LIBPATH.$(bld_trg))\
|
---|
| 826 | $(SDK_$(sdk)_LIBPATH.$(bld_type))\
|
---|
| 827 | $(SDK_$(sdk)_LIBPATH))\
|
---|
[221] | 828 | $(TOOL_$(tool)_LIBPATH.$(bld_trg_cpu))\
|
---|
[481] | 829 | $(TOOL_$(tool)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
|
---|
[221] | 830 | $(TOOL_$(tool)_LIBPATH.$(bld_trg_arch))\
|
---|
| 831 | $(TOOL_$(tool)_LIBPATH.$(bld_trg))\
|
---|
| 832 | $(TOOL_$(tool)_LIBPATH.$(bld_type))\
|
---|
[353] | 833 | $(TOOL_$(tool)_LIBPATH)
|
---|
[1496] | 834 | local dirdep := $(call DIRDEP,$(dir $(out)))
|
---|
[1702] | 835 | local deps := \
|
---|
| 836 | $($(target)_DEPS.$(bld_trg_cpu)) \
|
---|
| 837 | $($(target)_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
| 838 | $($(target)_DEPS.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 839 | $($(target)_DEPS.$(bld_trg).$(bld_type)) \
|
---|
| 840 | $($(target)_DEPS.$(bld_trg_arch)) \
|
---|
| 841 | $($(target)_DEPS.$(bld_trg)) \
|
---|
| 842 | $($(target)_DEPS.$(bld_type)) \
|
---|
| 843 | $($(target)_DEPS) \
|
---|
| 844 | $($(target)_LNK_DEPS.$(bld_trg_cpu)) \
|
---|
| 845 | $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
| 846 | $($(target)_LNK_DEPS.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 847 | $($(target)_LNK_DEPS.$(bld_trg).$(bld_type)) \
|
---|
| 848 | $($(target)_LNK_DEPS.$(bld_trg_arch)) \
|
---|
| 849 | $($(target)_LNK_DEPS.$(bld_trg)) \
|
---|
| 850 | $($(target)_LNK_DEPS.$(bld_type)) \
|
---|
| 851 | $($(target)_LNK_DEPS)
|
---|
| 852 | local orderdeps := \
|
---|
| 853 | $($(target)_ORDERDEPS.$(bld_trg_cpu)) \
|
---|
| 854 | $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
| 855 | $($(target)_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 856 | $($(target)_ORDERDEPS.$(bld_trg).$(bld_type)) \
|
---|
| 857 | $($(target)_ORDERDEPS.$(bld_trg_arch)) \
|
---|
| 858 | $($(target)_ORDERDEPS.$(bld_trg)) \
|
---|
| 859 | $($(target)_ORDERDEPS.$(bld_type)) \
|
---|
| 860 | $($(target)_ORDERDEPS) \
|
---|
| 861 | $($(target)_LNK_ORDERDEPS.$(bld_trg_cpu)) \
|
---|
| 862 | $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
| 863 | $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 864 | $($(target)_LNK_ORDERDEPS.$(bld_trg).$(bld_type)) \
|
---|
| 865 | $($(target)_LNK_ORDERDEPS.$(bld_trg_arch)) \
|
---|
| 866 | $($(target)_LNK_ORDERDEPS.$(bld_trg)) \
|
---|
| 867 | $($(target)_LNK_ORDERDEPS.$(bld_type)) \
|
---|
| 868 | $($(target)_LNK_ORDERDEPS)
|
---|
[353] | 869 |
|
---|
[725] | 870 | # Adjust paths if we got a default path.
|
---|
| 871 | ifneq ($(defpath),)
|
---|
[1496] | 872 | local libpath := $(abspathex $(libpath),$(defpath))
|
---|
| 873 | local deps := $(abspathex $(deps),$(defpath))
|
---|
| 874 | local orderdeps := $(abspathex $(orderdeps),$(defpath))
|
---|
[1472] | 875 | othersrc := $(abspathex $(othersrc),$(defpath))
|
---|
[1755] | 876 | # libs are not subject to this because of the the -l<lib> stuff. Use $(<target>_DEFPATH)/lib if relative to current dir!
|
---|
[725] | 877 | endif
|
---|
| 878 |
|
---|
[2523] | 879 | # Debug info.
|
---|
| 880 | local ld_debug := $(evalcall def_fn_prop_get_first_defined,LD_DEBUG)
|
---|
| 881 | local debug_inst := $(evalcall def_fn_prop_get_first_defined,DEBUG_INST)
|
---|
| 882 | local debug_stage := $(evalcall def_fn_prop_get_first_defined,DEBUG_STAGE)
|
---|
| 883 | local debug_nostage := $(evalcall def_fn_prop_get_first_word,DEBUG_NOSTAGE)
|
---|
| 884 |
|
---|
[2475] | 885 | # Custom pre/post-link actions.
|
---|
[2523] | 886 | local pre_cmds := $(evalcall def_fn_prop_get_first_defined,PRE_CMDS)
|
---|
| 887 | local post_cmds := $(evalcall def_fn_prop_get_first_defined,POST_CMDS)
|
---|
[72] | 888 |
|
---|
[1424] | 889 | # eliminate this guy?
|
---|
[2236] | 890 | local objs = $($(target)_2_OBJS)
|
---|
[1424] | 891 |
|
---|
[380] | 892 | # dependency file
|
---|
[1496] | 893 | local dep := $(outbase)$(SUFF_DEP)
|
---|
[524] | 894 | ifndef NO_LINK_CMDS_DEPS
|
---|
[2188] | 895 | _DEPFILES_INCLUDED += $(dep)
|
---|
[1798] | 896 | ifdef KB_HAVE_INCLUDEDEP_QUEUE
|
---|
| 897 | includedep-queue $(dep)
|
---|
[1795] | 898 | else
|
---|
[1798] | 899 | includedep $(dep)
|
---|
[1795] | 900 | endif
|
---|
[380] | 901 | endif
|
---|
[353] | 902 |
|
---|
[380] | 903 | # check that the tool is defined.
|
---|
| 904 | ifndef TOOL_$(tool)_$(tool_do)_CMDS
|
---|
| 905 | $(warning kBuild: tools: \
|
---|
[481] | 906 | 1 $($(target)_$(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 907 | 2 $($(target)_$(source)TOOL.$(bld_trg)) \
|
---|
| 908 | 3 $($(target)_$(source)TOOL) \
|
---|
| 909 | 4 $($(target)_TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 910 | 5 $($(target)_TOOL.$(bld_trg)) \
|
---|
| 911 | 6 $($(target)_TOOL) \
|
---|
| 912 | 7 $($(source)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 913 | 8 $($(source)TOOL.$(bld_trg)) \
|
---|
| 914 | 9 $($(source)TOOL) \
|
---|
| 915 | 10 $(TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
| 916 | 11 $(TOOL.$(bld_trg)) \
|
---|
| 917 | 12 $(TOOL) )
|
---|
[380] | 918 | $(error kBuild: TOOL_$(tool)_$(tool_do)_CMDS isn't defined! target=$(target) )
|
---|
| 919 | endif
|
---|
[353] | 920 |
|
---|
[380] | 921 | # call the tool
|
---|
[1496] | 922 | local cmds := $(TOOL_$(tool)_$(tool_do)_CMDS)
|
---|
[859] | 923 | ifneq ($(pre_cmds),)
|
---|
[1496] | 924 | local cmds := $(TAB)$(pre_cmds)$(NL)$(TAB)$(cmds)
|
---|
[859] | 925 | endif
|
---|
| 926 | ifneq ($(post_cmds),)
|
---|
[1496] | 927 | local cmds := $(cmds)$(NL)$(TAB)$(post_cmds)
|
---|
[859] | 928 | endif
|
---|
[2523] | 929 | $(target)_2_OUTPUT := $(TOOL_$(tool)_$(tool_do)_OUTPUT)
|
---|
| 930 | $(target)_2_OUTPUT_MAYBE := $(TOOL_$(tool)_$(tool_do)_OUTPUT_MAYBE)
|
---|
| 931 | if1of ($(ld_debug), split)
|
---|
| 932 | $(target)_2_OUTPUT_DEBUG_FILES := $(filter-out %/,$(TOOL_$(tool)_$(tool_do)_OUTPUT_DEBUG))
|
---|
| 933 | $(target)_2_OUTPUT_DEBUG_DIRS := $(filter %/,$(TOOL_$(tool)_$(tool_do)_OUTPUT_DEBUG))
|
---|
| 934 | else
|
---|
| 935 | $(target)_2_OUTPUT_DEBUG_FILES :=
|
---|
| 936 | $(target)_2_OUTPUT_DEBUG_DIRS :=
|
---|
| 937 | endif
|
---|
| 938 | $(target)_2_DEPEND := $(TOOL_$(tool)_$(tool_do)_DEPEND) $(deps) $($(target)_2_OBJS)
|
---|
| 939 | $(target)_2_DEPORD := $(TOOL_$(tool)_$(tool_do)_DEPORD) $(dirdep) $(orderdeps)
|
---|
[353] | 940 |
|
---|
[412] | 941 | # generate the link rule.
|
---|
[380] | 942 | $(eval $(def_link_rule))
|
---|
| 943 |
|
---|
[2523] | 944 | # installation targets
|
---|
| 945 | local target_type_mode :=
|
---|
| 946 | $(evalval def_target_install_only)
|
---|
[412] | 947 |
|
---|
[380] | 948 | # Update globals.
|
---|
[2236] | 949 | _OBJS += $($(target)_2_OBJS)
|
---|
[2234] | 950 | _OUT_FILES += $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE) $(out)
|
---|
[905] | 951 | _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))
|
---|
| 952 | _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] | 953 | _INSTALLS_FILES += $(INSTARGET_$(target))
|
---|
[353] | 954 |
|
---|
[1936] | 955 | endef # def_link_common
|
---|
| 956 | $(eval-opt-var def_link_common)
|
---|
[353] | 957 |
|
---|
| 958 |
|
---|
| 959 | #
|
---|
| 960 | # BLDPROGS
|
---|
| 961 | #
|
---|
| 962 |
|
---|
| 963 | # Process build programs.
|
---|
| 964 | EXT := EXE
|
---|
| 965 | EXTPRE := HOST
|
---|
[380] | 966 | tool_do := LINK_PROGRAM
|
---|
[353] | 967 | typevar := _BLDPROGS
|
---|
[380] | 968 | mode := 0755
|
---|
[353] | 969 | bld_trg_base_var := PLATFORM
|
---|
[2475] | 970 | $(foreach target, $(_ALL_BLDPROGS), $(evalval def_link_common))
|
---|
[353] | 971 |
|
---|
[988] | 972 | ifdef KBUILD_PROFILE_SELF
|
---|
[2008] | 973 | $(evalcall def_profile_self, done build program targets)
|
---|
[988] | 974 | endif
|
---|
[353] | 975 |
|
---|
| 976 |
|
---|
| 977 | #
|
---|
| 978 | # DLLS
|
---|
| 979 | #
|
---|
| 980 |
|
---|
[189] | 981 | # Process dlls
|
---|
[353] | 982 | EXT := DLL
|
---|
| 983 | EXTPRE :=
|
---|
[380] | 984 | tool_do := LINK_DLL
|
---|
[353] | 985 | typevar := _DLLS
|
---|
[830] | 986 | mode := 0644
|
---|
[353] | 987 | bld_trg_base_var := TARGET
|
---|
[1648] | 988 | $(foreach target, $(_ALL_DLLS), $(evalval def_link_common))
|
---|
[74] | 989 |
|
---|
[988] | 990 | ifdef KBUILD_PROFILE_SELF
|
---|
[2008] | 991 | $(evalcall def_profile_self, done dll targets)
|
---|
[988] | 992 | endif
|
---|
[74] | 993 |
|
---|
[988] | 994 |
|
---|
[72] | 995 | #
|
---|
[830] | 996 | # IMPORT LIBRARIES
|
---|
[72] | 997 | #
|
---|
[219] | 998 | # - On OS/2 and windows these are libraries.
|
---|
[189] | 999 | # - On other platforms they are fake DLLs.
|
---|
[830] | 1000 | #
|
---|
| 1001 | EXTPRE :=
|
---|
| 1002 | typevar := _IMPORT_LIBS
|
---|
| 1003 | mode := 0644
|
---|
| 1004 | bld_trg_base_var := TARGET
|
---|
[1504] | 1005 | ifeq ($(filter-out nt os2 win win64 win32,$(KBUILD_TARGET)),)
|
---|
[830] | 1006 | EXT := LIB
|
---|
| 1007 | tool_do := LINK_LIBRARY
|
---|
[1648] | 1008 | $(foreach target, $(_ALL_IMPORT_LIBS), $(evalval def_lib))
|
---|
[189] | 1009 | else
|
---|
[830] | 1010 | EXT := DLL
|
---|
| 1011 | tool_do := LINK_DLL
|
---|
[1648] | 1012 | $(foreach target, $(_ALL_IMPORT_LIBS), $(evalval def_link_common))
|
---|
[189] | 1013 | endif
|
---|
[72] | 1014 |
|
---|
[988] | 1015 | ifdef KBUILD_PROFILE_SELF
|
---|
[2008] | 1016 | $(evalcall def_profile_self, done import library targets)
|
---|
[988] | 1017 | endif
|
---|
[189] | 1018 |
|
---|
[988] | 1019 |
|
---|
[189] | 1020 | #
|
---|
| 1021 | # PROGRAMS
|
---|
| 1022 | #
|
---|
| 1023 |
|
---|
[353] | 1024 | # Process programs
|
---|
| 1025 | EXT := EXE
|
---|
| 1026 | EXTPRE :=
|
---|
[380] | 1027 | tool_do := LINK_PROGRAM
|
---|
[353] | 1028 | typevar := _PROGRAMS
|
---|
[380] | 1029 | mode := 0755
|
---|
[353] | 1030 | bld_trg_base_var := TARGET
|
---|
[1648] | 1031 | $(foreach target, $(_ALL_PROGRAMS), $(evalval def_link_common))
|
---|
[130] | 1032 |
|
---|
[988] | 1033 | ifdef KBUILD_PROFILE_SELF
|
---|
[2008] | 1034 | $(evalcall def_profile_self, done program targets)
|
---|
[988] | 1035 | endif
|
---|
[130] | 1036 |
|
---|
[189] | 1037 |
|
---|
[72] | 1038 | #
|
---|
[83] | 1039 | # SYSMODS
|
---|
[72] | 1040 | #
|
---|
| 1041 |
|
---|
[130] | 1042 | # Process sysmods
|
---|
[353] | 1043 | EXT := SYS
|
---|
| 1044 | EXTPRE :=
|
---|
[380] | 1045 | tool_do := LINK_SYSMOD
|
---|
[353] | 1046 | typevar := _SYSMODS
|
---|
[380] | 1047 | mode := 0644
|
---|
[353] | 1048 | bld_trg_base_var := TARGET
|
---|
[1648] | 1049 | $(foreach target, $(_ALL_SYSMODS), $(evalval def_link_common))
|
---|
[83] | 1050 |
|
---|
[988] | 1051 | ifdef KBUILD_PROFILE_SELF
|
---|
[2008] | 1052 | $(evalcall def_profile_self, done sysmod targets)
|
---|
[988] | 1053 | endif
|
---|
[83] | 1054 |
|
---|
[988] | 1055 |
|
---|
[72] | 1056 | #
|
---|
[2084] | 1057 | # MISCBINS
|
---|
| 1058 | #
|
---|
| 1059 |
|
---|
| 1060 | # Process MISCBINS
|
---|
| 1061 | EXT := BIN
|
---|
| 1062 | EXTPRE :=
|
---|
| 1063 | tool_do := LINK_MISCBIN
|
---|
| 1064 | typevar := _MISCBINS
|
---|
| 1065 | mode := 0644
|
---|
| 1066 | bld_trg_base_var := TARGET
|
---|
| 1067 | $(foreach target, $(_ALL_MISCBINS), $(evalval def_link_common))
|
---|
| 1068 |
|
---|
| 1069 | ifdef KBUILD_PROFILE_SELF
|
---|
| 1070 | $(evalcall def_profile_self, done misc binary targets)
|
---|
| 1071 | endif
|
---|
| 1072 |
|
---|