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