1 | # $Id: footer.kmk 185 2004-12-12 04:55:17Z bird $
|
---|
2 | ## @file
|
---|
3 | #
|
---|
4 | # kBuild - File included at top of makefile.
|
---|
5 | #
|
---|
6 | # Copyright (c) source004 knut st. osmundsen <bird-srcspam@anduin.net>
|
---|
7 | #
|
---|
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 typetype0, Boston, MA 0sourcetargettargettarget-targettype07 USA
|
---|
24 | #
|
---|
25 | #
|
---|
26 |
|
---|
27 | ifndef __footer_kmk__
|
---|
28 | # start-of-file-content
|
---|
29 |
|
---|
30 | #
|
---|
31 | # Variables.
|
---|
32 | # (Some of these need initialization before including definitions using them.)
|
---|
33 | #
|
---|
34 |
|
---|
35 | # all targets.
|
---|
36 | ALL_TARGETS := \
|
---|
37 | $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) \
|
---|
38 | $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) \
|
---|
39 | $(DLLS) $(DLLS.$(BUILD_TARGET)) \
|
---|
40 | $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) \
|
---|
41 | $(OTHERS) $(OTHERS.$(BUILD_TARGET))
|
---|
42 |
|
---|
43 | # dependency files.
|
---|
44 | _DEPFILES :=
|
---|
45 |
|
---|
46 | # All kind of output files except for _OBJS and _DEPFILES.
|
---|
47 | # Compiling or linking definition outputting other things that $@ and any
|
---|
48 | # required dependency file must add those output files to this variable.
|
---|
49 | _OUT_FILES :=
|
---|
50 |
|
---|
51 | # all of a type
|
---|
52 | _OBJS :=
|
---|
53 | _LIBS :=
|
---|
54 | _DLLS :=
|
---|
55 | _EXES :=
|
---|
56 | _SYSMODS:=
|
---|
57 | _DIRS :=
|
---|
58 |
|
---|
59 | # all objs of a specific target
|
---|
60 | define def_objs_var
|
---|
61 | _OBJS_$target :=
|
---|
62 | endef
|
---|
63 | $(foreach target, $(ALL_TARGETS), $(eval _OBJS_$(target) := ))
|
---|
64 |
|
---|
65 | #
|
---|
66 | # Basic macros
|
---|
67 | #
|
---|
68 |
|
---|
69 | ## Figure out the tool for a source
|
---|
70 | # @param $target source file
|
---|
71 | # @param $source normalized main target
|
---|
72 | # @param $type tooltype
|
---|
73 | _SOURCE_TOOL = $(strip $(firstword \
|
---|
74 | $($(target)_$(source)_$(type)TOOL.$(BUILD_TARGET)) \
|
---|
75 | $($(target)_$(source)_$(type)TOOL) \
|
---|
76 | $($(target)_$(source)_TOOL.$(BUILD_TARGET)) \
|
---|
77 | $($(target)_$(source)_TOOL) \
|
---|
78 | $($(target)_$(type)TOOL.$(BUILD_TARGET)) \
|
---|
79 | $($(target)_$(type)TOOL) \
|
---|
80 | $($(target)_TOOL.$(BUILD_TARGET)) \
|
---|
81 | $($(target)_TOOL) \
|
---|
82 | $($(source)_$(type)TOOL.$(BUILD_TARGET)) \
|
---|
83 | $($(source)_$(type)TOOL) \
|
---|
84 | $($(source)_TOOL.$(BUILD_TARGET)) \
|
---|
85 | $($(source)_TOOL) \
|
---|
86 | $($(type)TOOL.$(BUILD_TARGET)) \
|
---|
87 | $($(type)TOOL) \
|
---|
88 | $(TOOL.$(BUILD_TARGET)) \
|
---|
89 | $(TOOL) ))
|
---|
90 |
|
---|
91 | _SOURCE_TOOL_OLD = $(strip $(firstword \
|
---|
92 | $($(target)_$(source)_$(type)TOOL.$(BUILD_TARGET)) $($(target)_$(source)_TOOL.$(BUILD_TARGET)) \
|
---|
93 | $($(target)_$(source)_$(type)TOOL) $($target_$source_TOOL) \
|
---|
94 | $($(target)_$(type)TOOL.$(BUILD_TARGET)) $($(target)_TOOL.$(BUILD_TARGET)) \
|
---|
95 | $($(target)_$(type)TOOL) $($target_TOOL) \
|
---|
96 | $($(source)_$(type)TOOL.$(BUILD_TARGET)) $($(source)_TOOL.$(BUILD_TARGET)) \
|
---|
97 | $($(source)_$(type)TOOL) $($(source)_TOOL) \
|
---|
98 | $($(type)TOOL.$(BUILD_TARGET)) $(TOOL.$(BUILD_TARGET)) \
|
---|
99 | $($(type)TOOL) $(TOOL) ))
|
---|
100 |
|
---|
101 | ## Figure out the tool for a target.
|
---|
102 | # @param $target normalized target.
|
---|
103 | # @param $source tooltype.
|
---|
104 | _TARGET_TOOL = $(strip $(firstword \
|
---|
105 | $($(target)_$(source)TOOL.$(BUILD_TARGET)) \
|
---|
106 | $($(target)_$(source)TOOL) \
|
---|
107 | $($(target)_TOOL.$(BUILD_TARGET)) \
|
---|
108 | $($(target)_TOOL) \
|
---|
109 | $($(source)TOOL) \
|
---|
110 | $($(source)TOOL.$(BUILD_TARGET)) \
|
---|
111 | $(TOOL.$(BUILD_TARGET)) \
|
---|
112 | $(TOOL) \
|
---|
113 | ))
|
---|
114 |
|
---|
115 | ## Removes the drive letter from a path (if it has one)
|
---|
116 | # @param $1 the path
|
---|
117 | no-drive=$(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
|
---|
118 |
|
---|
119 | ## Removes the root slash from a path (if it has one)
|
---|
120 | # @param $1 the path
|
---|
121 | no-root-slash=$(patsubst /%,%,$(1))
|
---|
122 |
|
---|
123 | ## Figure out where to put object files.
|
---|
124 | # @param $1 source file
|
---|
125 | # @param $2 normalized main target
|
---|
126 | _OBJECT_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(basename $(patsubst $(PATH_TARGET)/$(2)/%,gen/%,$(1)))))
|
---|
127 |
|
---|
128 | ## Figure out where to put object files.
|
---|
129 | # @param $1 real target name.
|
---|
130 | # @param $2 normalized main target
|
---|
131 | _TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(basename $(1))))
|
---|
132 |
|
---|
133 |
|
---|
134 | #
|
---|
135 | # Check syntax which leads to weird syntax errors.
|
---|
136 | #
|
---|
137 |
|
---|
138 | ## Check
|
---|
139 | # @param $(target) Target name.
|
---|
140 | define def_check_target
|
---|
141 | ifneq ("$($(target)_TEMPLATE)","$(strip $($(target)_TEMPLATE))")
|
---|
142 | $$(error $(target) have an incorrect template name. Remove any tabs!)
|
---|
143 | endif
|
---|
144 | endef
|
---|
145 | $(foreach target, $(ALL_TARGETS),$(eval $(def_check_target)))
|
---|
146 |
|
---|
147 |
|
---|
148 | #
|
---|
149 | # Include templates
|
---|
150 | #
|
---|
151 | _TEMPLATES := $(TEMPLATE)
|
---|
152 | define def_templates
|
---|
153 | ifdef $(target)_TEMPLATE
|
---|
154 | _TEMPLATES += $($(target)_TEMPLATE)
|
---|
155 | endif
|
---|
156 | endef
|
---|
157 | $(foreach target, $(ALL_TARGETS), $(eval $(def_templates)))
|
---|
158 | _TEMPLATES := $(sort $(_TEMPLATES))
|
---|
159 | # $ (warning dbg: _TEMPLATES=$(_TEMPLATES))
|
---|
160 |
|
---|
161 | define def_templates_include
|
---|
162 | ifndef TEMPLATE_$(template)
|
---|
163 | include $(firstword $(wildcard $(PATH_KBUILD)/templates/$(template).kmk))
|
---|
164 | endif
|
---|
165 | endef
|
---|
166 | $(foreach template, $(_TEMPLATES), $(eval $(def_templates)))
|
---|
167 |
|
---|
168 |
|
---|
169 | #
|
---|
170 | # Common Inheritance
|
---|
171 | #
|
---|
172 |
|
---|
173 | ## Inherit defaults property
|
---|
174 | # @param $(prop) Property name
|
---|
175 | # @param $(target) Target name.
|
---|
176 | define def_inherit_defaults_one
|
---|
177 | ifndef $(target)_$(prop)
|
---|
178 | ifndef $(target)_$(prop).$(BUILD_TARGET)
|
---|
179 | ifdef $(prop)
|
---|
180 | $$(eval $(target)_$(prop) := $($(prop)))
|
---|
181 | endif
|
---|
182 | ifdef $(prop).$(BUILD_TARGET)
|
---|
183 | $$(eval $(target)_$(prop).$(BUILD_TARGET) := $($(prop).$(BUILD_TARGET)))
|
---|
184 | endif
|
---|
185 | endif
|
---|
186 | endif
|
---|
187 | endef
|
---|
188 |
|
---|
189 | ## Inherit default properties for one target.
|
---|
190 | # A bit tricky this one, but it depends a bit on whether or not TEMPLATE
|
---|
191 | # is inherited from the default properties.
|
---|
192 | # @param $(target) Target name
|
---|
193 | #
|
---|
194 | define def_inherit_defaults
|
---|
195 | ifdef $(target)_TEMPLATE
|
---|
196 | ifeq ($(strip $(TEMPLATE_$($(target)_TEMPLATE)_TOOL) $(TEMPLATE_$($(target)_TEMPLATE)_TOOL.$(BUILD_TARGET))),)
|
---|
197 | $$(foreach prop,TOOL, $$(eval $$(def_inherit_defaults_one)))
|
---|
198 | endif
|
---|
199 | ifeq ($(strip $(TEMPLATE_$($(target)_TEMPLATE)_SDKS) $(TEMPLATE_$($(target)_TEMPLATE)_SDKS.$(BUILD_TARGET))),)
|
---|
200 | $$(foreach prop,SDKS, $$(eval $$(def_inherit_defaults_one)))
|
---|
201 | endif
|
---|
202 | else
|
---|
203 | $$(foreach prop,TEMPLATE TOOL SDKS, $$(eval $$(def_inherit_defaults_one)))
|
---|
204 | endif
|
---|
205 | endef
|
---|
206 | # Inherit default properties.
|
---|
207 | # !!!!!!THIS IS MESSY AND NOT NECESSARY!!!!!!
|
---|
208 | $(foreach target, $(ALL_TARGETS),$(eval $(def_inherit_defaults)))
|
---|
209 |
|
---|
210 |
|
---|
211 | ## Inherit one template property in a accumulative manner.
|
---|
212 | # @param $(prop) Property name
|
---|
213 | # @param $(target) Target name
|
---|
214 | # @todo fix the precedence order for some properties.
|
---|
215 | define def_inherit_template_one
|
---|
216 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
217 | ifndef $(target)_$(prop)
|
---|
218 | #$$ (warning dbgtarget: $(target)_$(prop):='$(TEMPLATE_$($(target)_TEMPLATE)_$(prop))' TEMPLATE_$($(target)_TEMPLATE)_$(prop))
|
---|
219 | $$(target)_$$(prop) := $$(TEMPLATE_$$($$(target)_TEMPLATE)_$$(prop))
|
---|
220 | endif
|
---|
221 | endif
|
---|
222 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)
|
---|
223 | ifndef $(target)_$(prop).$(BUILD_TARGET)
|
---|
224 | #$$ (warning dbgsource: $(target)_$(prop).$(BUILD_TARGET)="TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)" TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET))
|
---|
225 | $$(target)_$$(prop).$$(BUILD_TARGET) := $$(TEMPLATE_$$($$(target)_TEMPLATE)_$$(prop).$$(BUILD_TARGET))
|
---|
226 | endif
|
---|
227 | endif
|
---|
228 | endef
|
---|
229 |
|
---|
230 | ## Inherit one template property.
|
---|
231 | # @param $(prop) Property name
|
---|
232 | # @param $(target) Target name
|
---|
233 | define def_inherit_template_one_accumulate
|
---|
234 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
|
---|
235 | #$$ (warning dbgtype: TEMPLATE_$($(target)_TEMPLATE)_$(prop) $(target)_$(prop)=$($(target)_$(prop)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop)))
|
---|
236 | $$(eval $(target)_$(prop) := $($(target)_$(prop)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop)))
|
---|
237 | #$$ (warning dbgtype: $(target)_$(prop)=$($(target)_$(prop)))
|
---|
238 | endif
|
---|
239 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)
|
---|
240 | #$$ (warning dbg4: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET))
|
---|
241 | $$(eval $(target)_$(prop).$(BUILD_TARGET) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET)))
|
---|
242 | endif
|
---|
243 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_CPU)
|
---|
244 | #$$ (warning dbg5: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_CPU))
|
---|
245 | $$(eval $(target)_$(prop).$(BUILD_TARGET_CPU) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_CPU)))
|
---|
246 | endif
|
---|
247 | ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_ARCH)
|
---|
248 | #$$ (warning dbg6: TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_ARCH))
|
---|
249 | $$(eval $(target)_$(prop).$(BUILD_TARGET_ARCH) := $($(target)_$(prop).$(BUILD_TARGET)) $(TEMPLATE_$($(target)_TEMPLATE)_$(prop).$(BUILD_TARGET_ARCH)))
|
---|
250 | endif
|
---|
251 | endef
|
---|
252 |
|
---|
253 |
|
---|
254 | ## Inherit template properties for on target.
|
---|
255 | # @param $(target) Target name.
|
---|
256 | define def_inherit_template
|
---|
257 | $$(foreach prop, TOOL ARTOOL CTOOL CXXTOOL ASTOOL LDTOOL\
|
---|
258 | ,$$(eval $$(def_inherit_template_one)))
|
---|
259 | $$(foreach prop,SDKS DEFS INCS COPTS CFLAGS CDEFS CINCS CXXOPTS CXXFLAGS CXXDEFS CXXINCS ASOPTS ASFLAGS ASDEFS ASINCS LDFLAGS LIBS LIBPATH \
|
---|
260 | ,$$(eval $$(def_inherit_template_one_accumulate)))
|
---|
261 | endef
|
---|
262 | # Inherit template properties
|
---|
263 | $(foreach target, $(ALL_TARGETS),$(eval $(def_inherit_template)))
|
---|
264 |
|
---|
265 |
|
---|
266 | #
|
---|
267 | # Include tools
|
---|
268 | #
|
---|
269 | _TOOLS := $(TOOL)
|
---|
270 | define def_tools_target_source
|
---|
271 | $(foreach tool,\
|
---|
272 | $($(source)_TOOL.$(BUILD_TARGET)) $($(target)_$(source)_TOOL.$(BUILD_TARGET))\
|
---|
273 | $($(source)_TOOL) $($(target)_$(source)_TOOL)\
|
---|
274 | $($(source)_CTOOL.$(BUILD_TARGET)) $($(target)_$(source)_CTOOL.$(BUILD_TARGET))\
|
---|
275 | $($(source)_CTOOL) $($(target)_$(source)_CTOOL)\
|
---|
276 | $($(source)_CXXTOOL.$(BUILD_TARGET)) $($(target)_$(source)_CXXTOOL.$(BUILD_TARGET))\
|
---|
277 | $($(source)_CXXTOOL) $($(target)_$(source)_CXXTOOL)\
|
---|
278 | $($(source)_ASTOOL.$(BUILD_TARGET)) $($(target)_$(source)_ASTOOL.$(BUILD_TARGET))\
|
---|
279 | $($(source)_ASTOOL) $($(target)_$(source)_ASTOOL)\
|
---|
280 | $($(source)_ARTOOL.$(BUILD_TARGET)) $($(target)_$(source)_ARTOOL.$(BUILD_TARGET))\
|
---|
281 | $($(source)_ARTOOL) $($(target)_$(source)_ARTOOL)\
|
---|
282 | $($(source)_LDTOOL.$(BUILD_TARGET)) $($(target)_$(source)_LDTOOL.$(BUILD_TARGET))\
|
---|
283 | $($(source)_LDTOOL) $($(target)_$(source)_LDTOOL)\
|
---|
284 | ,$(eval _TOOLS += $(tool)))
|
---|
285 | endef
|
---|
286 | define def_tools_target
|
---|
287 | $(foreach tool,\
|
---|
288 | $($(target)_TOOL.$(BUILD_TARGET))\
|
---|
289 | $($(target)_TOOL)\
|
---|
290 | $($(target)_CTOOL.$(BUILD_TARGET))\
|
---|
291 | $($(target)_CTOOL)\
|
---|
292 | $($(target)_CXXTOOL.$(BUILD_TARGET))\
|
---|
293 | $($(target)_CXXTOOL)\
|
---|
294 | $($(target)_ASTOOL.$(BUILD_TARGET))\
|
---|
295 | $($(target)_ASTOOL)\
|
---|
296 | $($(target)_ARTOOL.$(BUILD_TARGET))\
|
---|
297 | $($(target)_ARTOOL)\
|
---|
298 | $($(target)_LDTOOL.$(BUILD_TARGET))\
|
---|
299 | $($(target)_LDTOOL)\
|
---|
300 | ,$(eval _TOOLS += $(tool)))
|
---|
301 | $(foreach source, $($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE)) \
|
---|
302 | , $(eval $(def_tools_target_source)))
|
---|
303 | endef
|
---|
304 | $(foreach target, $(ALL_TARGETS), $(eval $(def_tools_target)))
|
---|
305 | _TOOLS := $(sort $(_TOOLS))
|
---|
306 |
|
---|
307 | define def_tools_include
|
---|
308 | ifndef TOOL_$(tool)
|
---|
309 | include $(firstword $(wildcard $(PATH_KBUILD)/tools/$(tool).kmk))
|
---|
310 | endif
|
---|
311 | endef
|
---|
312 | $(foreach tool, $(_TOOLS), $(eval $(def_tools_include)))
|
---|
313 |
|
---|
314 |
|
---|
315 | #
|
---|
316 | # Include SDKs
|
---|
317 | #
|
---|
318 | _SDKS := $(SDKS)
|
---|
319 | define def_sdks_target_source
|
---|
320 | $(foreach sdk, $($(source)_SDKS) $($(source)_SDKS.$(BUILD_TARGET)) $($(source)_SDKS.$(BUILD_MODE)) \
|
---|
321 | $($(target)_$(source)_SDKS) $($(target)_$(source)_SDKS.$(BUILD_TARGET)) $($(target)_$(source)_SDKS.$(BUILD_MODE)), \
|
---|
322 | $(eval _SDKS += $(sdk)))
|
---|
323 | endef
|
---|
324 | define def_sdks_target
|
---|
325 | $(foreach sdk, $($(target)_SDKS) $($(target)_SDKS.$(BUILD_TARGET)) $($(target)_SDKS.$(BUILD_MODE))\
|
---|
326 | , $(eval _SDKS += $(sdk)))
|
---|
327 | $(foreach source, $($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE))\
|
---|
328 | , $(eval $(def_sdks_target_source)))
|
---|
329 | endef
|
---|
330 | $(foreach target, $(ALL_TARGETS), $(eval $(def_sdks_target)))
|
---|
331 | _SDKS := $(sort $(_SDKS))
|
---|
332 |
|
---|
333 | define def_sdks_include_one
|
---|
334 | ifndef SDK_$(sdk)
|
---|
335 | include $(firstword $(wildcard $(PATH_KBUILD)/sdks/$(sdk).kmk))
|
---|
336 | endif
|
---|
337 | endef
|
---|
338 | $(foreach sdk, $(_SDKS), $(eval $(def_sdks_include_one)))
|
---|
339 |
|
---|
340 | #
|
---|
341 | # Object processing.
|
---|
342 | #
|
---|
343 |
|
---|
344 | ## Generic macro for processing C, C++ and Assembly sources.
|
---|
345 | # @param $(target) Normalized target name.
|
---|
346 | # @param $(source) Source file name.
|
---|
347 | # @param $(type) Source type. {C,CXX,AS}
|
---|
348 | #
|
---|
349 | # @remark I've no clue why I've to $(eval ..) everything in this define. MAKE bug?
|
---|
350 | # @remark I now have a clue. Have to use $$ if not.
|
---|
351 | define def_target_source_c_cpp_asm
|
---|
352 | #$ (warning dbg: def_target_source_c_cpp_asm: source='$(source)' target='$(target)' type='$(type)')
|
---|
353 |
|
---|
354 | $(eval tool:=$(call _SOURCE_TOOL,$(source),$(target),$(type)))
|
---|
355 | $(eval outbase := $(call _OBJECT_BASE,$(source),$(target)))
|
---|
356 | $(eval PATH_$(target)_$(source) := $(patsubst %/,%,$(dir $(outbase))))
|
---|
357 | $(eval dirdep := $(dir $(outbase)).dir_created)
|
---|
358 | $(eval defs :=\
|
---|
359 | $(TOOL_$(tool)_DEFS)\
|
---|
360 | $(TOOL_$(tool)_DEFS.$(BUILD_TYPE))\
|
---|
361 | $(TOOL_$(tool)_DEFS.$(BUILD_TARGET))\
|
---|
362 | $(TOOL_$(tool)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
363 | $(TOOL_$(tool)_DEFS.$(BUILD_TARGET_CPU))\
|
---|
364 | $(TOOL_$(tool)_$(type)DEFS)\
|
---|
365 | $(TOOL_$(tool)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
366 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
367 | $(SDKS.$(BUILD_TYPE)) \
|
---|
368 | $(SDKS),\
|
---|
369 | $(SDK_$(sdk)_DEFS)\
|
---|
370 | $(SDK_$(sdk)_DEFS.$(BUILD_TYPE))\
|
---|
371 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET))\
|
---|
372 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
373 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_CPU))\
|
---|
374 | $(SDK_$(sdk)_$(type)DEFS)\
|
---|
375 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
376 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
377 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
378 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_CPU)))\
|
---|
379 | $(DEFS)\
|
---|
380 | $(DEFS.$(BUILD_TYPE))\
|
---|
381 | $(DEFS.$(BUILD_TARGET))\
|
---|
382 | $(DEFS.$(BUILD_TARGET_ARCH))\
|
---|
383 | $(DEFS.$(BUILD_TARGET_CPU))\
|
---|
384 | $($(type)DEFS)\
|
---|
385 | $($(type)DEFS.$(BUILD_TYPE))\
|
---|
386 | $($(type)DEFS.$(BUILD_TARGET))\
|
---|
387 | $($(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
388 | $($(type)DEFS.$(BUILD_TARGET_CPU))\
|
---|
389 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
390 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
391 | $($(target)_SDKS),\
|
---|
392 | $(SDK_$(sdk)_DEFS)\
|
---|
393 | $(SDK_$(sdk)_DEFS.$(BUILD_TYPE))\
|
---|
394 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET))\
|
---|
395 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
396 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_CPU))\
|
---|
397 | $(SDK_$(sdk)_$(type)DEFS)\
|
---|
398 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
399 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
400 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
401 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_CPU)))\
|
---|
402 | $($(target)_DEFS)\
|
---|
403 | $($(target)_DEFS.$(BUILD_TYPE))\
|
---|
404 | $($(target)_DEFS.$(BUILD_TARGET))\
|
---|
405 | $($(target)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
406 | $($(target)_DEFS.$(BUILD_TARGET_CPU))\
|
---|
407 | $($(target)_$(type)DEFS)\
|
---|
408 | $($(target)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
409 | $($(target)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
410 | $($(target)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
411 | $($(target)_$(type)DEFS.$(BUILD_TARGET_CPU))\
|
---|
412 | $(foreach sdk, $($(source)_SDKS.$(BUILD_TARGET)) \
|
---|
413 | $($(source)_SDKS.$(BUILD_TYPE)) \
|
---|
414 | $($(source)_SDKS),\
|
---|
415 | $(SDK_$(sdk)_DEFS)\
|
---|
416 | $(SDK_$(sdk)_DEFS.$(BUILD_TYPE))\
|
---|
417 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET))\
|
---|
418 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
419 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_CPU))\
|
---|
420 | $(SDK_$(sdk)_$(type)DEFS)\
|
---|
421 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
422 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
423 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
424 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_CPU)))\
|
---|
425 | $($(source)_DEFS)\
|
---|
426 | $($(source)_DEFS.$(BUILD_TYPE))\
|
---|
427 | $($(source)_DEFS.$(BUILD_TARGET))\
|
---|
428 | $($(source)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
429 | $($(source)_DEFS.$(BUILD_TARGET_CPU))\
|
---|
430 | $($(source)_$(type)DEFS)\
|
---|
431 | $($(source)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
432 | $($(source)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
433 | $($(source)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
434 | $($(source)_$(type)DEFS.$(BUILD_TARGET_CPU))\
|
---|
435 | $(foreach sdk, $($(target)_$(source)_SDKS.$(BUILD_TARGET)) \
|
---|
436 | $($(target)_$(source)_SDKS.$(BUILD_TYPE)) \
|
---|
437 | $($(target)_$(source)_SDKS),\
|
---|
438 | $(SDK_$(sdk)_DEFS)\
|
---|
439 | $(SDK_$(sdk)_DEFS.$(BUILD_TYPE))\
|
---|
440 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET))\
|
---|
441 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
442 | $(SDK_$(sdk)_DEFS.$(BUILD_TARGET_CPU))\
|
---|
443 | $(SDK_$(sdk)_$(type)DEFS)\
|
---|
444 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
445 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
446 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
447 | $(SDK_$(sdk)_$(type)DEFS.$(BUILD_TARGET_CPU)))\
|
---|
448 | $($(target)_$(source)_DEFS)\
|
---|
449 | $($(target)_$(source)_DEFS.$(BUILD_TYPE))\
|
---|
450 | $($(target)_$(source)_DEFS.$(BUILD_TARGET))\
|
---|
451 | $($(target)_$(source)_DEFS.$(BUILD_TARGET_ARCH))\
|
---|
452 | $($(target)_$(source)_DEFS.$(BUILD_TARGET_CPU))\
|
---|
453 | $($(target)_$(source)_$(type)DEFS)\
|
---|
454 | $($(target)_$(source)_$(type)DEFS.$(BUILD_TYPE))\
|
---|
455 | $($(target)_$(source)_$(type)DEFS.$(BUILD_TARGET))\
|
---|
456 | $($(target)_$(source)_$(type)DEFS.$(BUILD_TARGET_ARCH))\
|
---|
457 | $($(target)_$(source)_$(type)DEFS.$(BUILD_TARGET_CPU))\
|
---|
458 | )
|
---|
459 | $(eval incs :=\
|
---|
460 | $($(target)_$(source)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
461 | $($(target)_$(source)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
462 | $($(target)_$(source)_$(type)INCS.$(BUILD_TARGET))\
|
---|
463 | $($(target)_$(source)_$(type)INCS.$(BUILD_TYPE))\
|
---|
464 | $($(target)_$(source)_$(type)INCS)\
|
---|
465 | $($(target)_$(source)_INCS.$(BUILD_TARGET_CPU))\
|
---|
466 | $($(target)_$(source)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
467 | $($(target)_$(source)_INCS.$(BUILD_TARGET))\
|
---|
468 | $($(target)_$(source)_INCS.$(BUILD_TYPE))\
|
---|
469 | $($(target)_$(source)_INCS)\
|
---|
470 | $(foreach sdk, $($(target)_$(source)_SDKS.$(BUILD_TARGET)) \
|
---|
471 | $($(target)_$(source)_SDKS.$(BUILD_TYPE)) \
|
---|
472 | $($(target)_$(source)_SDKS),\
|
---|
473 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
474 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
475 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET))\
|
---|
476 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TYPE))\
|
---|
477 | $(SDK_$(sdk)_$(type)INCS)\
|
---|
478 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_CPU))\
|
---|
479 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
480 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET))\
|
---|
481 | $(SDK_$(sdk)_INCS.$(BUILD_TYPE))\
|
---|
482 | $(SDK_$(sdk)_INCS))\
|
---|
483 | $($(source)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
484 | $($(source)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
485 | $($(source)_$(type)INCS.$(BUILD_TARGET))\
|
---|
486 | $($(source)_$(type)INCS.$(BUILD_TYPE))\
|
---|
487 | $($(source)_$(type)INCS)\
|
---|
488 | $($(source)_INCS.$(BUILD_TARGET_CPU))\
|
---|
489 | $($(source)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
490 | $($(source)_INCS.$(BUILD_TARGET))\
|
---|
491 | $($(source)_INCS.$(BUILD_TYPE))\
|
---|
492 | $($(source)_INCS)\
|
---|
493 | $(foreach sdk, $($(source)_SDKS.$(BUILD_TARGET)) \
|
---|
494 | $($(source)_SDKS.$(BUILD_TYPE)) \
|
---|
495 | $($(source)_SDKS),\
|
---|
496 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
497 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
498 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET))\
|
---|
499 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TYPE))\
|
---|
500 | $(SDK_$(sdk)_$(type)INCS)\
|
---|
501 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_CPU))\
|
---|
502 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
503 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET))\
|
---|
504 | $(SDK_$(sdk)_INCS.$(BUILD_TYPE))\
|
---|
505 | $(SDK_$(sdk)_INCS))\
|
---|
506 | $($(target)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
507 | $($(target)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
508 | $($(target)_$(type)INCS.$(BUILD_TARGET))\
|
---|
509 | $($(target)_$(type)INCS.$(BUILD_TYPE))\
|
---|
510 | $($(target)_$(type)INCS)\
|
---|
511 | $($(target)_INCS.$(BUILD_TARGET_CPU))\
|
---|
512 | $($(target)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
513 | $($(target)_INCS.$(BUILD_TARGET))\
|
---|
514 | $($(target)_INCS.$(BUILD_TYPE))\
|
---|
515 | $($(target)_INCS)\
|
---|
516 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
517 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
518 | $($(target)_SDKS),\
|
---|
519 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
520 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
521 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET))\
|
---|
522 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TYPE))\
|
---|
523 | $(SDK_$(sdk)_$(type)INCS)\
|
---|
524 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_CPU))\
|
---|
525 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
526 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET))\
|
---|
527 | $(SDK_$(sdk)_INCS.$(BUILD_TYPE))\
|
---|
528 | $(SDK_$(sdk)_INCS))\
|
---|
529 | $(INCS.$(BUILD_TARGET_CPU))\
|
---|
530 | $(INCS.$(BUILD_TARGET_ARCH))\
|
---|
531 | $(INCS.$(BUILD_TARGET))\
|
---|
532 | $(INCS.$(BUILD_TYPE))\
|
---|
533 | $(INCS)\
|
---|
534 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
535 | $(SDKS.$(BUILD_TYPE)) \
|
---|
536 | $(SDKS),\
|
---|
537 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
538 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
539 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TARGET))\
|
---|
540 | $(SDK_$(sdk)_$(type)INCS.$(BUILD_TYPE))\
|
---|
541 | $(SDK_$(sdk)_$(type)INCS)\
|
---|
542 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_CPU))\
|
---|
543 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET_ARCH))\
|
---|
544 | $(SDK_$(sdk)_INCS.$(BUILD_TARGET))\
|
---|
545 | $(SDK_$(sdk)_INCS.$(BUILD_TYPE))\
|
---|
546 | $(SDK_$(sdk)_INCS))\
|
---|
547 | $(TOOL_$(tool)_$(type)INCS.$(BUILD_TARGET_CPU))\
|
---|
548 | $(TOOL_$(tool)_$(type)INCS.$(BUILD_TARGET_ARCH))\
|
---|
549 | $(TOOL_$(tool)_$(type)INCS.$(BUILD_TARGET))\
|
---|
550 | $(TOOL_$(tool)_$(type)INCS.$(BUILD_TYPE))\
|
---|
551 | $(TOOL_$(tool)_$(type)INCS)\
|
---|
552 | )
|
---|
553 | $(eval flags :=\
|
---|
554 | $(TOOL_$(tool)_$(type)FLAGS)\
|
---|
555 | $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TYPE))\
|
---|
556 | $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TARGET))\
|
---|
557 | $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TARGET_ARCH))\
|
---|
558 | $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TARGET_CPU))\
|
---|
559 | $($(type)FLAGS)\
|
---|
560 | $($(type)FLAGS.$(BUILD_TYPE))\
|
---|
561 | $($(type)FLAGS.$(BUILD_TARGET))\
|
---|
562 | $($(type)FLAGS.$(BUILD_TARGET_ARCH))\
|
---|
563 | $($(type)FLAGS.$(BUILD_TARGET_CPU))\
|
---|
564 | $($(target)_$(type)FLAGS)\
|
---|
565 | $($(target)_$(type)FLAGS.$(BUILD_TYPE))\
|
---|
566 | $($(target)_$(type)FLAGS.$(BUILD_TARGET))\
|
---|
567 | $($(target)_$(type)FLAGS.$(BUILD_TARGET_ARCH))\
|
---|
568 | $($(target)_$(type)FLAGS.$(BUILD_TARGET_CPU))\
|
---|
569 | $($(source)_$(type)FLAGS)\
|
---|
570 | $($(source)_$(type)FLAGS.$(BUILD_TYPE))\
|
---|
571 | $($(source)_$(type)FLAGS.$(BUILD_TARGET))\
|
---|
572 | $($(source)_$(type)FLAGS.$(BUILD_TARGET_ARCH))\
|
---|
573 | $($(source)_$(type)FLAGS.$(BUILD_TARGET_CPU))\
|
---|
574 | $($(target)_$(source)_$(type)FLAGS)\
|
---|
575 | $($(target)_$(source)_$(type)FLAGS.$(BUILD_TYPE))\
|
---|
576 | $($(target)_$(source)_$(type)FLAGS.$(BUILD_TARGET))\
|
---|
577 | $($(target)_$(source)_$(type)FLAGS.$(BUILD_TARGET_ARCH))\
|
---|
578 | $($(target)_$(source)_$(type)FLAGS.$(BUILD_TARGET_CPU))\
|
---|
579 | )
|
---|
580 | $(eval objsuff := $(firstword \
|
---|
581 | $($(target)_$(source)_OBJSUFF.$(BUILD_TARGET))\
|
---|
582 | $($(target)_$(source)_OBJSUFF)\
|
---|
583 | $($(source)_OBJSUFF.$(BUILD_TARGET))\
|
---|
584 | $($(source)_OBJSUFF)\
|
---|
585 | $($(target)_OBJSUFF.$(BUILD_TARGET))\
|
---|
586 | $($(target)_OBJSUFF)\
|
---|
587 | $(TOOL_$(tool)_$(type)OBJSUFF.$(BUILD_TARGET))\
|
---|
588 | $(TOOL_$(tool)_$(type)OBJSUFF)\
|
---|
589 | $(SUFF_OBJ)\
|
---|
590 | ))
|
---|
591 | $(eval obj := $(outbase)$(objsuff))
|
---|
592 | $(eval dep := $(outbase)$(SUFF_DEP))
|
---|
593 | $(eval deps := \
|
---|
594 | $($(target)_$(source)_DEPS)\
|
---|
595 | $($(target)_$(source)_DEPS.$(BUILD_TYPE))\
|
---|
596 | $($(target)_$(source)_DEPS.$(BUILD_TARGET))\
|
---|
597 | $($(target)_$(source)_DEPS.$(BUILD_TARGET_ARCH))\
|
---|
598 | $($(target)_$(source)_DEPS.$(BUILD_TARGET_CPU))\
|
---|
599 | $($(source)_DEPS)\
|
---|
600 | $($(source)_DEPS.$(BUILD_TYPE))\
|
---|
601 | $($(source)_DEPS.$(BUILD_TARGET))\
|
---|
602 | $($(target)_DEPS)\
|
---|
603 | $($(target)_DEPS.$(BUILD_TARGET_ARCH))\
|
---|
604 | $($(target)_DEPS.$(BUILD_TARGET_CPU)))
|
---|
605 |
|
---|
606 |
|
---|
607 | #$ (warning dbg: target=$(target) source=$(source) tool=$(tool) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff) deps=$(deps))
|
---|
608 | ifndef TOOL_$(tool)_COMPILE_$(type)
|
---|
609 | $$(warning kBuild: TOOL_$(tool)_COMPILE_$(type) is not defined. source=$(source) target=$(target) )
|
---|
610 | $$(warning kBuild: tools: \
|
---|
611 | 1 $($(target)_$(source)_$(type)TOOL.$(BUILD_TARGET)) \
|
---|
612 | 2 $($(target)_$(source)_$(type)TOOL) \
|
---|
613 | 3 $($(target)_$(source)_TOOL.$(BUILD_TARGET)) \
|
---|
614 | 4 $($(target)_$(source)_TOOL) \
|
---|
615 | 5 $($(target)_$(type)TOOL.$(BUILD_TARGET)) \
|
---|
616 | 6 $($(target)_$(type)TOOL) \
|
---|
617 | 7 $($(target)_TOOL.$(BUILD_TARGET)) \
|
---|
618 | 8 $($(target)_TOOL) \
|
---|
619 | 9 $($(source)_$(type)TOOL.$(BUILD_TARGET)) \
|
---|
620 | 10 $($(source)_$(type)TOOL) \
|
---|
621 | 11 $($(source)_TOOL.$(BUILD_TARGET)) \
|
---|
622 | 12 $($(source)_TOOL) \
|
---|
623 | 13 $($(type)TOOL.$(BUILD_TARGET)) \
|
---|
624 | 14 $($(type)TOOL) \
|
---|
625 | 15 $(TOOL.$(BUILD_TARGET)) \
|
---|
626 | 16 $(TOOL) )
|
---|
627 | endif
|
---|
628 | $(eval $(TOOL_$(tool)_COMPILE_$(type)))
|
---|
629 |
|
---|
630 | $(eval _OBJS_$(target) += $(obj))
|
---|
631 | $(eval _DEPFILES += $(dep))
|
---|
632 |
|
---|
633 | endef
|
---|
634 |
|
---|
635 | ## Generic macro for processing all target sources.
|
---|
636 | # @param $(target) Normalized target name.
|
---|
637 | define def_target_sources
|
---|
638 | #$ (warning def_target_sources)
|
---|
639 | # C sources
|
---|
640 | $(foreach type,C,$(foreach source, $(filter %.c, $($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE)))\
|
---|
641 | ,$(eval $(def_target_source_c_cpp_asm)) ))
|
---|
642 |
|
---|
643 | # C++ sources
|
---|
644 | $(foreach type,CXX,$(foreach source, $(filter %.cpp %.cxx %.xx, $($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE)))\
|
---|
645 | ,$(eval $(def_target_source_c_cpp_asm)) ))
|
---|
646 |
|
---|
647 | # ASM sources
|
---|
648 | $(foreach type,AS,$(foreach source, $(filter %.asm %.s %.S, $($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE)))\
|
---|
649 | ,$(eval $(def_target_source_c_cpp_asm)) ))
|
---|
650 | endef
|
---|
651 |
|
---|
652 |
|
---|
653 | #
|
---|
654 | # LIBRARIES
|
---|
655 | #
|
---|
656 |
|
---|
657 | ## Library (one).
|
---|
658 | # @param $(target) Normalized library (target) name.
|
---|
659 | define def_lib
|
---|
660 | # library basics
|
---|
661 | $(eval tool := $(call _TARGET_TOOL,$(target),AR))
|
---|
662 | ifeq ($(tool),)
|
---|
663 | $$(error kBuild: Library target $(target) doesn't have a tool defined!)
|
---|
664 | endif
|
---|
665 | ## @todo prefix
|
---|
666 | $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
|
---|
667 | $(eval PATH_$(target) := $(patsubst %/,%,$(dir $(outbase))))
|
---|
668 | $(eval libsuff := $(firstword\
|
---|
669 | $($(target)_LIBSUFF.$(BUILD_TARGET))\
|
---|
670 | $($(target)_LIBSUFF)\
|
---|
671 | $(TOOL_$(tool)_ARLIBSUFF.$(BUILD_TARGET))\
|
---|
672 | $(TOOL_$(tool)_ARLIBSUFF)\
|
---|
673 | $(SUFF_LIB)\
|
---|
674 | ))
|
---|
675 | $(eval lib := $(outbase)$(libsuff))
|
---|
676 | $(eval TARGET_$(target) := $(lib))
|
---|
677 |
|
---|
678 | # source -> object
|
---|
679 | $(eval $(def_target_sources))
|
---|
680 |
|
---|
681 | # library linking
|
---|
682 | $(eval tool := $(call _TARGET_TOOL,$(target),AR))
|
---|
683 | $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
|
---|
684 | $(eval flags :=\
|
---|
685 | $(TOOL_$(tool)_ARFLAGS)\
|
---|
686 | $(TOOL_$(tool)_ARFLAGS.$(BUILD_TYPE))\
|
---|
687 | $(ARFLAGS)\
|
---|
688 | $(ARFLAGS.$(BUILD_TYPE))\
|
---|
689 | $($(target)_ARFLAGS)\
|
---|
690 | $($(target)_ARFLAGS.$(BUILD_TYPE))\
|
---|
691 | )
|
---|
692 | $(eval objs = $(_OBJS_$(target)))
|
---|
693 | $(eval othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE))))
|
---|
694 | $(eval dirdep := $(dir $(lib)).dir_created)
|
---|
695 | ## @todo fix dependencies on makefiles an such
|
---|
696 | $(eval deps := $($(target)_DEPS))
|
---|
697 |
|
---|
698 | $(eval $(TOOL_$(tool)_LINK_LIBRARY))
|
---|
699 |
|
---|
700 | # publish rule (still need work)
|
---|
701 | ifndef $(target)_NOINST
|
---|
702 | $(eval publib := $(PATH_LIB)/$(notdir $(lib)))
|
---|
703 | $(publib) : $(lib) $(dir $(publib)).dir_created
|
---|
704 | $(CP) $(lib) $(publib)
|
---|
705 |
|
---|
706 | _LIBS += $(publib)
|
---|
707 | _OUT_FILES += $(lib) $(publib)
|
---|
708 | else
|
---|
709 | _LIBS += $(lib)
|
---|
710 | _OUT_FILES += $(lib)
|
---|
711 | endif
|
---|
712 | _OBJS += $(_OBJS_$(target))
|
---|
713 | endef
|
---|
714 |
|
---|
715 | # Process libraries
|
---|
716 | $(foreach target, $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)), $(eval $(def_lib)))
|
---|
717 |
|
---|
718 |
|
---|
719 |
|
---|
720 | #
|
---|
721 | # PROGRAMS
|
---|
722 | #
|
---|
723 |
|
---|
724 | ## Program (one).
|
---|
725 | # @param $(target) Normalized target (program) name.
|
---|
726 | define def_program
|
---|
727 | # basics
|
---|
728 | $(eval tool := $(call _TARGET_TOOL,$(target),LD))
|
---|
729 | $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
|
---|
730 | $(eval PATH_$(target) := $(patsubst %/,%,$(dir $(outbase))))
|
---|
731 | $(eval exesuff := $(firstword $($(target)_EXESUFF) $($(target)_EXESUFF) $(TOOL_$(tool)_LDEXESUFF) $(SUFF_EXE)))
|
---|
732 | $(eval exe := $(outbase)$(exesuff))
|
---|
733 | $(eval TARGET_$(target) := $(exe))
|
---|
734 |
|
---|
735 | # source -> object
|
---|
736 | $(eval $(def_target_sources))
|
---|
737 |
|
---|
738 | # more library stuff.
|
---|
739 | $(eval tool := $(call _TARGET_TOOL,$(target),LD))
|
---|
740 | $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
|
---|
741 | $(eval objs = $(_OBJS_$(target)))
|
---|
742 | $(eval flags :=\
|
---|
743 | $(TOOL_$(tool)_LDFLAGS)\
|
---|
744 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TYPE))\
|
---|
745 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET))\
|
---|
746 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
747 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
748 | $(LDFLAGS)\
|
---|
749 | $(LDFLAGS.$(BUILD_TYPE))\
|
---|
750 | $(LDFLAGS.$(BUILD_TARGET))\
|
---|
751 | $(LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
752 | $(LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
753 | $($(target)_LDFLAGS)\
|
---|
754 | $($(target)_LDFLAGS.$(BUILD_TYPE))\
|
---|
755 | $($(target)_LDFLAGS.$(BUILD_TARGET))\
|
---|
756 | $($(target)_LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
757 | $($(target)_LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
758 | )
|
---|
759 | $(eval libs :=\
|
---|
760 | $($(target)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
761 | $($(target)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
762 | $($(target)_LIBS.$(BUILD_TARGET))\
|
---|
763 | $($(target)_LIBS.$(BUILD_TYPE))\
|
---|
764 | $($(target)_LIBS)\
|
---|
765 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
766 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
767 | $($(target)_SDKS),\
|
---|
768 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
769 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
770 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\
|
---|
771 | $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\
|
---|
772 | $(SDK_$(sdk)_LIBS))\
|
---|
773 | $(LIBS.$(BUILD_TARGET_CPU))\
|
---|
774 | $(LIBS.$(BUILD_TARGET_ARCH))\
|
---|
775 | $(LIBS.$(BUILD_TARGET))\
|
---|
776 | $(LIBS.$(BUILD_TYPE))\
|
---|
777 | $(LIBS)\
|
---|
778 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
779 | $(SDKS.$(BUILD_TYPE)) \
|
---|
780 | $(SDKS),\
|
---|
781 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
782 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
783 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\
|
---|
784 | $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\
|
---|
785 | $(SDK_$(sdk)_LIBS))\
|
---|
786 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
787 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
788 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET))\
|
---|
789 | $(TOOL_$(tool)_LIBS.$(BUILD_TYPE))\
|
---|
790 | $(TOOL_$(tool)_LIBS)\
|
---|
791 | )
|
---|
792 | $(eval libpath :=\
|
---|
793 | $($(target)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
794 | $($(target)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
795 | $($(target)_LIBPATH.$(BUILD_TARGET))\
|
---|
796 | $($(target)_LIBPATH.$(BUILD_TYPE))\
|
---|
797 | $($(target)_LIBPATH)\
|
---|
798 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
799 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
800 | $($(target)_SDKS),\
|
---|
801 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
802 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
803 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\
|
---|
804 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\
|
---|
805 | $(SDK_$(sdk)_LIBPATH))\
|
---|
806 | $(LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
807 | $(LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
808 | $(LIBPATH.$(BUILD_TARGET))\
|
---|
809 | $(LIBPATH.$(BUILD_TYPE))\
|
---|
810 | $(LIBPATH)\
|
---|
811 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
812 | $(SDKS.$(BUILD_TYPE)) \
|
---|
813 | $(SDKS),\
|
---|
814 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
815 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
816 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\
|
---|
817 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\
|
---|
818 | $(SDK_$(sdk)_LIBPATH))\
|
---|
819 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
820 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
821 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET))\
|
---|
822 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TYPE))\
|
---|
823 | $(TOOL_$(tool)_LIBPATH)\
|
---|
824 | )
|
---|
825 | $(eval dirdep := $(dir $(exe)).dir_created)
|
---|
826 | ## @todo fix dependencies
|
---|
827 | $(eval deps := $($(target)_DEPS))
|
---|
828 | #
|
---|
829 | $(eval custom_pre := $(strip $(firstword
|
---|
830 | $($(target)_CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
831 | $($(target)_CUSTOM_PRE.$(BUILD_TARGET))\
|
---|
832 | $($(target)_CUSTOM_PRE.$(BUILD_TYPE))\
|
---|
833 | $($(target)_CUSTOM_PRE)\
|
---|
834 | $(CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
835 | $(CUSTOM_PRE.$(BUILD_TARGET))\
|
---|
836 | $(CUSTOM_PRE.$(BUILD_TYPE))\
|
---|
837 | $(CUSTOM_PRE)\
|
---|
838 | )))
|
---|
839 | $(eval custom_post := $(strip $(firstword
|
---|
840 | $($(target)_CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
841 | $($(target)_CUSTOM_POST.$(BUILD_TARGET))\
|
---|
842 | $($(target)_CUSTOM_POST.$(BUILD_TYPE))\
|
---|
843 | $($(target)_CUSTOM_POST)\
|
---|
844 | $(CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
845 | $(CUSTOM_POST.$(BUILD_TARGET))\
|
---|
846 | $(CUSTOM_POST.$(BUILD_TYPE))\
|
---|
847 | $(CUSTOM_POST)\
|
---|
848 | )))
|
---|
849 | $(eval othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE))))
|
---|
850 |
|
---|
851 | $(eval $(TOOL_$(tool)_LINK_PROGRAM))
|
---|
852 | # publish rule (still need work)
|
---|
853 | ifndef $(target)_NOINST
|
---|
854 | $(eval pubexe := $(PATH_BIN)/$(notdir $(exe)))
|
---|
855 | $(pubexe) : $(exe) $(dir $(pubexe)).dir_created
|
---|
856 | $(CP) $(exe) $(pubexe)
|
---|
857 |
|
---|
858 | _DLLS += $(pubexe)
|
---|
859 | _OUT_FILES += $(exe) $(pubexe)
|
---|
860 | else
|
---|
861 | _DLLS += $(exe)
|
---|
862 | _OUT_FILES += $(exe)
|
---|
863 | endif
|
---|
864 | _OBJS += $(_OBJS_$(target))
|
---|
865 | endef
|
---|
866 |
|
---|
867 | # Process libraries
|
---|
868 | $(foreach target, $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)), $(eval $(def_program)))
|
---|
869 |
|
---|
870 |
|
---|
871 |
|
---|
872 | #
|
---|
873 | # DLLS
|
---|
874 | #
|
---|
875 |
|
---|
876 | ## DLL (one).
|
---|
877 | # @param $(target) Normalized target (program) name.
|
---|
878 | define def_dll
|
---|
879 | # dllmod basics
|
---|
880 | $(eval tool := $(call _TARGET_TOOL,$(target),LD))
|
---|
881 | $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
|
---|
882 | $(eval PATH_$(target) := $(patsubst %/,%,$(dir $(outbase))))
|
---|
883 | $(eval dllsuff := $(firstword $($(target)_DLLSUFF) $($(target)_DLLSUFF) $(TOOL_$(tool)_LDDLLSUFF) $(SUFF_DLL)))
|
---|
884 | $(eval dll := $(outbase)$(dllsuff))
|
---|
885 | $(eval TARGET_$(target) := $(dll))
|
---|
886 |
|
---|
887 | # source -> object
|
---|
888 | $(eval $(def_target_sources))
|
---|
889 |
|
---|
890 | # dllmod linking.
|
---|
891 | $(eval tool := $(call _TARGET_TOOL,$(target),LD))
|
---|
892 | $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
|
---|
893 | $(eval objs = $(_OBJS_$(target)))
|
---|
894 | $(eval flags :=\
|
---|
895 | $(TOOL_$(tool)_LDFLAGS)\
|
---|
896 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TYPE))\
|
---|
897 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET))\
|
---|
898 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
899 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
900 | $(LDFLAGS)\
|
---|
901 | $(LDFLAGS.$(BUILD_TYPE))\
|
---|
902 | $(LDFLAGS.$(BUILD_TARGET))\
|
---|
903 | $(LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
904 | $(LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
905 | $($(target)_LDFLAGS)\
|
---|
906 | $($(target)_LDFLAGS.$(BUILD_TYPE))\
|
---|
907 | $($(target)_LDFLAGS.$(BUILD_TARGET))\
|
---|
908 | $($(target)_LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
909 | $($(target)_LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
910 | )
|
---|
911 | $(eval libs :=\
|
---|
912 | $($(target)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
913 | $($(target)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
914 | $($(target)_LIBS.$(BUILD_TARGET))\
|
---|
915 | $($(target)_LIBS.$(BUILD_TYPE))\
|
---|
916 | $($(target)_LIBS)\
|
---|
917 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
918 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
919 | $($(target)_SDKS),\
|
---|
920 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
921 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
922 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\
|
---|
923 | $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\
|
---|
924 | $(SDK_$(sdk)_LIBS))\
|
---|
925 | $(LIBS.$(BUILD_TARGET_CPU))\
|
---|
926 | $(LIBS.$(BUILD_TARGET_ARCH))\
|
---|
927 | $(LIBS.$(BUILD_TARGET))\
|
---|
928 | $(LIBS.$(BUILD_TYPE))\
|
---|
929 | $(LIBS)\
|
---|
930 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
931 | $(SDKS.$(BUILD_TYPE)) \
|
---|
932 | $(SDKS),\
|
---|
933 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
934 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
935 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\
|
---|
936 | $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\
|
---|
937 | $(SDK_$(sdk)_LIBS))\
|
---|
938 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
939 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
940 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET))\
|
---|
941 | $(TOOL_$(tool)_LIBS.$(BUILD_TYPE))\
|
---|
942 | $(TOOL_$(tool)_LIBS)\
|
---|
943 | )
|
---|
944 | $(eval libpath :=\
|
---|
945 | $($(target)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
946 | $($(target)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
947 | $($(target)_LIBPATH.$(BUILD_TARGET))\
|
---|
948 | $($(target)_LIBPATH.$(BUILD_TYPE))\
|
---|
949 | $($(target)_LIBPATH)\
|
---|
950 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
951 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
952 | $($(target)_SDKS),\
|
---|
953 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
954 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
955 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\
|
---|
956 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\
|
---|
957 | $(SDK_$(sdk)_LIBPATH))\
|
---|
958 | $(LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
959 | $(LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
960 | $(LIBPATH.$(BUILD_TARGET))\
|
---|
961 | $(LIBPATH.$(BUILD_TYPE))\
|
---|
962 | $(LIBPATH)\
|
---|
963 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
964 | $(SDKS.$(BUILD_TYPE)) \
|
---|
965 | $(SDKS),\
|
---|
966 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
967 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
968 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\
|
---|
969 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\
|
---|
970 | $(SDK_$(sdk)_LIBPATH))\
|
---|
971 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
972 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
973 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET))\
|
---|
974 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TYPE))\
|
---|
975 | $(TOOL_$(tool)_LIBPATH)\
|
---|
976 | )
|
---|
977 | $(eval dirdep := $(dir $(dll)).dir_created)
|
---|
978 | ## @todo fix dependencies
|
---|
979 | $(eval deps := $($(target)_DEPS))
|
---|
980 | #
|
---|
981 | $(eval custom_pre := $(strip $(firstword
|
---|
982 | $($(target)_CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
983 | $($(target)_CUSTOM_PRE.$(BUILD_TARGET))\
|
---|
984 | $($(target)_CUSTOM_PRE.$(BUILD_TYPE))\
|
---|
985 | $($(target)_CUSTOM_PRE)\
|
---|
986 | $(CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
987 | $(CUSTOM_PRE.$(BUILD_TARGET))\
|
---|
988 | $(CUSTOM_PRE.$(BUILD_TYPE))\
|
---|
989 | $(CUSTOM_PRE)\
|
---|
990 | )))
|
---|
991 | $(eval custom_post := $(strip $(firstword
|
---|
992 | $($(target)_CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
993 | $($(target)_CUSTOM_POST.$(BUILD_TARGET))\
|
---|
994 | $($(target)_CUSTOM_POST.$(BUILD_TYPE))\
|
---|
995 | $($(target)_CUSTOM_POST)\
|
---|
996 | $(CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
997 | $(CUSTOM_POST.$(BUILD_TARGET))\
|
---|
998 | $(CUSTOM_POST.$(BUILD_TYPE))\
|
---|
999 | $(CUSTOM_POST)\
|
---|
1000 | )))
|
---|
1001 | $(eval othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE))))
|
---|
1002 |
|
---|
1003 | ifndef TOOL_$(tool)_LINK_DLL
|
---|
1004 | $$(warning kBuild: TOOL_$(tool)_LINK_DLL is not defined. target=$(target) )
|
---|
1005 | $$(warning kBuild: tools: \
|
---|
1006 | 1 $($(target)_$(source)TOOL.$(BUILD_TARGET)) \
|
---|
1007 | 2 $($(target)_$(source)TOOL) \
|
---|
1008 | 3 $($(target)_TOOL.$(BUILD_TARGET)) \
|
---|
1009 | 4 $($(target)_TOOL) \
|
---|
1010 | 5 $($(source)TOOL) \
|
---|
1011 | 6 $($(source)TOOL.$(BUILD_TARGET)) \
|
---|
1012 | 7 $(TOOL.$(BUILD_TARGET)) \
|
---|
1013 | 8 $(TOOL) )
|
---|
1014 | endif
|
---|
1015 |
|
---|
1016 | $(eval $(TOOL_$(tool)_LINK_DLL))
|
---|
1017 |
|
---|
1018 |
|
---|
1019 | # publish rule (still need work)
|
---|
1020 | ifndef $(target)_NOINST
|
---|
1021 | $(eval pubdll := $(PATH_BIN)/$(notdir $(dll)))
|
---|
1022 | $(pubdll) : $(dll) $(dir $(pubdll)).dir_created
|
---|
1023 | $(CP) $(dll) $(pubdll)
|
---|
1024 |
|
---|
1025 | _DLLS += $(pubdll)
|
---|
1026 | _OUT_FILES += $(dll) $(pubdll)
|
---|
1027 | else
|
---|
1028 | _DLLS += $(dll)
|
---|
1029 | _OUT_FILES += $(dll)
|
---|
1030 | endif
|
---|
1031 | _OBJS += $(_OBJS_$(target))
|
---|
1032 | endef
|
---|
1033 |
|
---|
1034 | # Process dlls
|
---|
1035 | $(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)), $(eval $(def_dll)))
|
---|
1036 |
|
---|
1037 |
|
---|
1038 | #
|
---|
1039 | # SYSMODS
|
---|
1040 | #
|
---|
1041 |
|
---|
1042 | ## System module (one).
|
---|
1043 | # @param $(target) Normalized target (program) name.
|
---|
1044 | define def_sysmod
|
---|
1045 | # sysmod basics
|
---|
1046 | $(eval tool := $(call _TARGET_TOOL,$(target),LD))
|
---|
1047 | $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
|
---|
1048 | $(eval PATH_$(target) := $(patsubst %/,%,$(dir $(outbase))))
|
---|
1049 | $(eval syssuff := $(firstword $($(target)_SYSSUFF) $($(target)_SYSSUFF) $(TOOL_$(tool)_LDSYSSUFF) $(SUFF_SYS)))
|
---|
1050 | $(eval sys := $(outbase)$(syssuff))
|
---|
1051 | $(eval TARGET_$(target) := $(sys))
|
---|
1052 |
|
---|
1053 | # source -> object
|
---|
1054 | $(eval $(def_target_sources))
|
---|
1055 |
|
---|
1056 | # sysmod linking
|
---|
1057 | $(eval tool := $(call _TARGET_TOOL,$(target),LD))
|
---|
1058 | $(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
|
---|
1059 | $(eval objs = $(_OBJS_$(target)))
|
---|
1060 | $(eval flags :=\
|
---|
1061 | $(TOOL_$(tool)_LDFLAGS)\
|
---|
1062 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TYPE))\
|
---|
1063 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET))\
|
---|
1064 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
1065 | $(TOOL_$(tool)_LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
1066 | $(LDFLAGS)\
|
---|
1067 | $(LDFLAGS.$(BUILD_TYPE))\
|
---|
1068 | $(LDFLAGS.$(BUILD_TARGET))\
|
---|
1069 | $(LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
1070 | $(LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
1071 | $($(target)_LDFLAGS)\
|
---|
1072 | $($(target)_LDFLAGS.$(BUILD_TYPE))\
|
---|
1073 | $($(target)_LDFLAGS.$(BUILD_TARGET))\
|
---|
1074 | $($(target)_LDFLAGS.$(BUILD_TARGET_ARCH))\
|
---|
1075 | $($(target)_LDFLAGS.$(BUILD_TARGET_CPU))\
|
---|
1076 | )
|
---|
1077 | $(eval libs :=\
|
---|
1078 | $($(target)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
1079 | $($(target)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
1080 | $($(target)_LIBS.$(BUILD_TARGET))\
|
---|
1081 | $($(target)_LIBS.$(BUILD_TYPE))\
|
---|
1082 | $($(target)_LIBS)\
|
---|
1083 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
1084 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
1085 | $($(target)_SDKS),\
|
---|
1086 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
1087 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
1088 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\
|
---|
1089 | $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\
|
---|
1090 | $(SDK_$(sdk)_LIBS))\
|
---|
1091 | $(LIBS.$(BUILD_TARGET_CPU))\
|
---|
1092 | $(LIBS.$(BUILD_TARGET_ARCH))\
|
---|
1093 | $(LIBS.$(BUILD_TARGET))\
|
---|
1094 | $(LIBS.$(BUILD_TYPE))\
|
---|
1095 | $(LIBS)\
|
---|
1096 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
1097 | $(SDKS.$(BUILD_TYPE)) \
|
---|
1098 | $(SDKS),\
|
---|
1099 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
1100 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
1101 | $(SDK_$(sdk)_LIBS.$(BUILD_TARGET))\
|
---|
1102 | $(SDK_$(sdk)_LIBS.$(BUILD_TYPE))\
|
---|
1103 | $(SDK_$(sdk)_LIBS))\
|
---|
1104 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_CPU))\
|
---|
1105 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET_ARCH))\
|
---|
1106 | $(TOOL_$(tool)_LIBS.$(BUILD_TARGET))\
|
---|
1107 | $(TOOL_$(tool)_LIBS.$(BUILD_TYPE))\
|
---|
1108 | $(TOOL_$(tool)_LIBS)\
|
---|
1109 | )
|
---|
1110 | $(eval libpath :=\
|
---|
1111 | $($(target)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
1112 | $($(target)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
1113 | $($(target)_LIBPATH.$(BUILD_TARGET))\
|
---|
1114 | $($(target)_LIBPATH.$(BUILD_TYPE))\
|
---|
1115 | $($(target)_LIBPATH)\
|
---|
1116 | $(foreach sdk, $($(target)_SDKS.$(BUILD_TARGET)) \
|
---|
1117 | $($(target)_SDKS.$(BUILD_TYPE)) \
|
---|
1118 | $($(target)_SDKS),\
|
---|
1119 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
1120 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
1121 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\
|
---|
1122 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\
|
---|
1123 | $(SDK_$(sdk)_LIBPATH))\
|
---|
1124 | $(LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
1125 | $(LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
1126 | $(LIBPATH.$(BUILD_TARGET))\
|
---|
1127 | $(LIBPATH.$(BUILD_TYPE))\
|
---|
1128 | $(LIBPATH)\
|
---|
1129 | $(foreach sdk, $(SDKS.$(BUILD_TARGET)) \
|
---|
1130 | $(SDKS.$(BUILD_TYPE)) \
|
---|
1131 | $(SDKS),\
|
---|
1132 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
1133 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
1134 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TARGET))\
|
---|
1135 | $(SDK_$(sdk)_LIBPATH.$(BUILD_TYPE))\
|
---|
1136 | $(SDK_$(sdk)_LIBPATH))\
|
---|
1137 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_CPU))\
|
---|
1138 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET_ARCH))\
|
---|
1139 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TARGET))\
|
---|
1140 | $(TOOL_$(tool)_LIBPATH.$(BUILD_TYPE))\
|
---|
1141 | $(TOOL_$(tool)_LIBPATH)\
|
---|
1142 | )
|
---|
1143 | $(eval dirdep := $(dir $(sys)).dir_created)
|
---|
1144 | ## @todo fix dependencies
|
---|
1145 | $(eval deps := $($(target)_DEPS))
|
---|
1146 | #
|
---|
1147 | $(eval custom_pre := $(strip $(firstword
|
---|
1148 | $($(target)_CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
1149 | $($(target)_CUSTOM_PRE.$(BUILD_TARGET))\
|
---|
1150 | $($(target)_CUSTOM_PRE.$(BUILD_TYPE))\
|
---|
1151 | $($(target)_CUSTOM_PRE)\
|
---|
1152 | $(CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
1153 | $(CUSTOM_PRE.$(BUILD_TARGET))\
|
---|
1154 | $(CUSTOM_PRE.$(BUILD_TYPE))\
|
---|
1155 | $(CUSTOM_PRE)\
|
---|
1156 | )))
|
---|
1157 | $(eval custom_post := $(strip $(firstword
|
---|
1158 | $($(target)_CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
1159 | $($(target)_CUSTOM_POST.$(BUILD_TARGET))\
|
---|
1160 | $($(target)_CUSTOM_POST.$(BUILD_TYPE))\
|
---|
1161 | $($(target)_CUSTOM_POST)\
|
---|
1162 | $(CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
|
---|
1163 | $(CUSTOM_POST.$(BUILD_TARGET))\
|
---|
1164 | $(CUSTOM_POST.$(BUILD_TYPE))\
|
---|
1165 | $(CUSTOM_POST)\
|
---|
1166 | )))
|
---|
1167 | $(eval othersrc := $(filter-out %.c %.cpp %.cxx %.cc %.s %.S %.asm,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_MODE))))
|
---|
1168 |
|
---|
1169 | ifndef TOOL_$(tool)_LINK_SYSMOD
|
---|
1170 | $$(warning kBuild: TOOL_$(tool)_LINK_SYSMOD is not defined. target=$(target) )
|
---|
1171 | $$(warning kBuild: tools: \
|
---|
1172 | 1 $($(target)_$(source)TOOL.$(BUILD_TARGET)) \
|
---|
1173 | 2 $($(target)_$(source)TOOL) \
|
---|
1174 | 3 $($(target)_TOOL.$(BUILD_TARGET)) \
|
---|
1175 | 4 $($(target)_TOOL) \
|
---|
1176 | 5 $($(source)TOOL) \
|
---|
1177 | 6 $($(source)TOOL.$(BUILD_TARGET)) \
|
---|
1178 | 7 $(TOOL.$(BUILD_TARGET)) \
|
---|
1179 | 8 $(TOOL) )
|
---|
1180 | endif
|
---|
1181 |
|
---|
1182 | $(eval $(TOOL_$(tool)_LINK_SYSMOD))
|
---|
1183 |
|
---|
1184 | # publish rule (still need work)
|
---|
1185 | ifndef $(target)_NOINST
|
---|
1186 | $(eval pubsys := $(PATH_BIN)/$(notdir $(sys)))
|
---|
1187 | $(pubsys): $(sys) $(dir $(pubsys)).dir_created
|
---|
1188 | $(CP) $(sys) $(pubsys)
|
---|
1189 |
|
---|
1190 | $(eval _SYSMODS += $(pubsys))
|
---|
1191 | $(eval _OUT_FILES += $(sys) $(pubsys))
|
---|
1192 | else
|
---|
1193 | $(eval _SYSMODS += $(sys))
|
---|
1194 | $(eval _OUT_FILES += $(sys))
|
---|
1195 | endif
|
---|
1196 | _OBJS += $(_OBJS_$(target))
|
---|
1197 | endef
|
---|
1198 |
|
---|
1199 | # Process sysmods
|
---|
1200 | $(foreach target, $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)), $(eval $(def_sysmod)))
|
---|
1201 |
|
---|
1202 |
|
---|
1203 |
|
---|
1204 | #
|
---|
1205 | # OTHERS
|
---|
1206 | #
|
---|
1207 | _OTHERS = $(OTHERS)
|
---|
1208 |
|
---|
1209 |
|
---|
1210 |
|
---|
1211 | #
|
---|
1212 | # DOCS
|
---|
1213 | #
|
---|
1214 |
|
---|
1215 |
|
---|
1216 | #
|
---|
1217 | # Directories.
|
---|
1218 | #
|
---|
1219 | _DIRFILES := $(sort $(addsuffix /.dir_created,$(_DIRS)) $(addsuffix .dir_created,$(sort $(dir $(_OUT_FILES) $(_OBJS)))))
|
---|
1220 |
|
---|
1221 | define def_createdir
|
---|
1222 | $(dirfile):
|
---|
1223 | $(call MSG_Ltarget,Creating directory $$(@D))
|
---|
1224 | $(MKDIR) -p $$(@D)
|
---|
1225 | @echo dir_created > $$@
|
---|
1226 | endef
|
---|
1227 |
|
---|
1228 | $(foreach dirfile,$(_DIRFILES),$(eval $(def_createdir)))
|
---|
1229 |
|
---|
1230 |
|
---|
1231 | #
|
---|
1232 | # Include dependency files.
|
---|
1233 | #
|
---|
1234 | $(foreach dep,$(wildcard $(_DEPFILES)),$(eval include $(dep)))
|
---|
1235 |
|
---|
1236 |
|
---|
1237 | #
|
---|
1238 | # PASSES (including directory and makefile walking)
|
---|
1239 | #
|
---|
1240 | # Do all the default passes if it's unspecified.
|
---|
1241 |
|
---|
1242 | #PASSES ?= needed libraries binaries others publish
|
---|
1243 | PASSES ?= libraries binaries others
|
---|
1244 |
|
---|
1245 | ## Proritized list of the default makefile when walking subdirectories.
|
---|
1246 | # The user can overload this list.
|
---|
1247 | DEFAULT_MAKEFILE ?= Makefile.kmk makefile.kmk Makefile makefile
|
---|
1248 |
|
---|
1249 | ## Subdir
|
---|
1250 | # @param $(pass) Lowercase pass name.
|
---|
1251 | # @param $(PASS) Uppercase pass name.
|
---|
1252 | # @param $(subdir) Subdirectory
|
---|
1253 | # @param $(tag) tag to attach to the rule name.
|
---|
1254 | define def_pass_subdir
|
---|
1255 | pass_$(pass)$(tag)::
|
---|
1256 | $(QUIET)$$(MAKE) -C $(subdir) -f $$(notdir $$(firstword $$(wildcard $$(addprefix $(subdir)/,$$(DEFAULT_MAKEFILE))))) pass_$(pass)
|
---|
1257 | endef
|
---|
1258 |
|
---|
1259 | ## Submakefile
|
---|
1260 | # @param $(pass) Lowercase pass name.
|
---|
1261 | # @param $(PASS) Uppercase pass name.
|
---|
1262 | # @param $(makefile) Makefile.
|
---|
1263 | # @param $(tag) tag to attach to the rule name.
|
---|
1264 | define def_pass_makefile
|
---|
1265 | pass_$(pass)$(tag)::
|
---|
1266 | $(QUIET)$$(MAKE) -C $(patsubst %/,%,$(dir $(makefile))) -f $(notdir $(makefile)) pass_$(pass)
|
---|
1267 | endef
|
---|
1268 |
|
---|
1269 |
|
---|
1270 | ## Execute a pass.
|
---|
1271 | # @param $(pass) Lowercase pass name.
|
---|
1272 | # @param $(PASS) Uppercase pass name.
|
---|
1273 | define def_pass
|
---|
1274 | $(eval SUBDIRS_$(PASS) ?= $(SUBDIRS) $(SUBDIRS.$(BUILD_TARGET)))
|
---|
1275 | $(eval SUBDIRS_AFTER_$(PASS) ?= $(SUBDIRS_AFTER) $(SUBDIRS_AFTER.$(BUILD_TARGET)))
|
---|
1276 | $(eval MAKEFILES_BEFORE_$(PASS) ?= $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(BUILD_TARGET)))
|
---|
1277 | $(eval MAKEFILES_AFTER_$(PASS) ?= $(MAKEFILES_AFTER) $(MAKEFILES_AFTER.$(BUILD_TARGET)))
|
---|
1278 |
|
---|
1279 | $(eval tag:=_before)
|
---|
1280 | $(foreach subdir,$(SUBDIRS_$(PASS)) $(SUBDIRS_$(PASS).$(BUILD_TARGET)) ,$(eval $(def_pass_subdir)))
|
---|
1281 | $(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)) $(MAKEFILES_BEFORE_$(PASS).$(BUILD_TARGET)),$(eval $(def_pass_makefile)))
|
---|
1282 |
|
---|
1283 | $(eval tag:=_after)
|
---|
1284 | $(foreach subdir,$(SUBDIRS_AFTER_$(PASS)) $(SUBDIRS_AFTER_$(PASS).$(BUILD_TARGET)) ,$(eval $(def_pass_subdir)))
|
---|
1285 | $(foreach makefile,$(MAKEFILES_AFTER_$(PASS)) $(MAKEFILES_AFTER_$(PASS).$(BUILD_TARGET)) ,$(eval $(def_pass_makefile)))
|
---|
1286 |
|
---|
1287 | .NOTPARALLEL: pass_$(pass)_before pass_$(pass)_after
|
---|
1288 | .PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_doit pass_$(pass)_after
|
---|
1289 | pass_$(pass): \
|
---|
1290 | pass_$(pass)_before \
|
---|
1291 | pass_$(pass)_doit \
|
---|
1292 | pass_$(pass)_after
|
---|
1293 |
|
---|
1294 | endef
|
---|
1295 |
|
---|
1296 |
|
---|
1297 | ## PASS: needed
|
---|
1298 | # This pass builds targets which are required for building the rest.
|
---|
1299 | pass_needed_doit: $(_NEEDEDS)
|
---|
1300 | pass := needed
|
---|
1301 | PASS := NEEDED
|
---|
1302 | $(eval $(def_pass))
|
---|
1303 |
|
---|
1304 | ## PASS: libraries
|
---|
1305 | # This pass builds library targets.
|
---|
1306 | pass_libraries_doit: $(_LIBS) $(_IMPORT_LIBS) $(_OTHER_LIBRARIES)
|
---|
1307 | pass := libraries
|
---|
1308 | PASS := LIBRARIES
|
---|
1309 | $(eval $(def_pass))
|
---|
1310 |
|
---|
1311 | ## PASS: binaries
|
---|
1312 | # This pass builds binary targets, i.e. programs, dlls, system modules and stuff.
|
---|
1313 | pass_binaries_doit: $(_DLLS) $(_EXES) $(_SYSMODS) $(_OTHER_BINARIES)
|
---|
1314 | pass := binaries
|
---|
1315 | PASS := BINARIES
|
---|
1316 | $(eval $(def_pass))
|
---|
1317 |
|
---|
1318 | ## PASS: others
|
---|
1319 | # This pass builds other targets.
|
---|
1320 | pass_others_doit: $(_OTHERS)
|
---|
1321 | pass := others
|
---|
1322 | PASS := OTHERS
|
---|
1323 | $(eval $(def_pass))
|
---|
1324 |
|
---|
1325 | ## PASS: publish
|
---|
1326 | # This pass installs the built entities to a sandbox area.
|
---|
1327 | pass_publish_doit: publish
|
---|
1328 | publish::
|
---|
1329 | pass := publish
|
---|
1330 | PASS := PUBLISH
|
---|
1331 | # $(sort).. not nice.
|
---|
1332 | SUBDIRS_PUBLISH ?= $(sort $(SUBDIRS) $(SUBDIRS.$(BUILD_TARGET)) $(SUBDIRS_LIBRARIES) $(SUBDIRS_LIBRARIES.$(BUILD_TARGET)) $(SUBDIRS_BINARIES) $(SUBDIRS_BINARIES.$(BUILD_TARGET)) $(SUBDIRS_OTHERS) $(SUBDIRS_OTHERS.$(BUILD_TARGET)))
|
---|
1333 | SUBDIRS_AFTER_PUBLISH ?= $(sort $(SUBDIRS_AFTER) $(SUBDIRS_AFTER.$(BUILD_TARGET)) $(SUBDIRS_AFTER_LIBRARIES) $(SUBDIRS_AFTER_LIBRARIES.$(BUILD_TARGET)) $(SUBDIRS_AFTER_BINARIES) $(SUBDIRS_AFTER_BINARIES.$(BUILD_TARGET)) $(SUBDIRS_AFTER_OTHERS) $(SUBDIRS_AFTER_OTHERS.$(BUILD_TARGET)))
|
---|
1334 | MAKEFILES_BEFORE_PUBLISH?= $(sort $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE.$(BUILD_TARGET)) $(MAKEFILES_BEFORE_LIBRARIES) $(MAKEFILES_BEFORE_LIBRARIES.$(BUILD_TARGET)) $(MAKEFILES_BEFORE_BINARIES) $(MAKEFILES_BEFORE_BINARIES.$(BUILD_TARGET)) $(MAKEFILES_BEFORE_OTHERS) $(MAKEFILES_BEFORE_OTHERS.$(BUILD_TARGET)))
|
---|
1335 | MAKEFILES_AFTER_PUBLISH ?= $(sort $(MAKEFILES_AFTER) $(MAKEFILES_AFTER.$(BUILD_TARGET)) $(MAKEFILES_AFTER_LIBRARIES) $(MAKEFILES_AFTER_LIBRARIES.$(BUILD_TARGET)) $(MAKEFILES_AFTER_BINARIES) $(MAKEFILES_AFTER_BINARIES.$(BUILD_TARGET)) $(MAKEFILES_AFTER_OTHERS) $(MAKEFILES_AFTER_OTHERS.$(BUILD_TARGET)))
|
---|
1336 | $(eval $(def_pass))
|
---|
1337 |
|
---|
1338 | ## PASS: packing
|
---|
1339 | # This pass processes custom packing rules.
|
---|
1340 | pass_packing_doit: packing
|
---|
1341 | packing::
|
---|
1342 | pass := packing
|
---|
1343 | PASS := PACKING
|
---|
1344 | $(eval $(def_pass))
|
---|
1345 |
|
---|
1346 | ## PASS: clean
|
---|
1347 | # This pass removes all generated files.
|
---|
1348 | pass_clean_doit:
|
---|
1349 | $(RM) -f $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_DIRFILES) $(OTHER_CLEAN)
|
---|
1350 | pass := clean
|
---|
1351 | PASS := CLEAN
|
---|
1352 | $(eval $(def_pass))
|
---|
1353 | clean: pass_clean
|
---|
1354 |
|
---|
1355 | ## PASS: nothing
|
---|
1356 | # This pass just walks the tree.
|
---|
1357 | pass_nothing_doit:
|
---|
1358 | $(call MSG_Ltarget,Did nothing in $(CURDIR))
|
---|
1359 | pass := nothing
|
---|
1360 | PASS := NOTHING
|
---|
1361 | $(eval $(def_pass))
|
---|
1362 | nothing: pass_nothing
|
---|
1363 |
|
---|
1364 |
|
---|
1365 |
|
---|
1366 | #
|
---|
1367 | # THE MAIN RULES
|
---|
1368 | #
|
---|
1369 | all_recursive: $(foreach pass,$(PASSES),pass_$(pass))
|
---|
1370 |
|
---|
1371 | rebuild: clean
|
---|
1372 | $(MAKE) -f $(firstword $(MAKEFILE_LIST)) all_recursive
|
---|
1373 |
|
---|
1374 |
|
---|
1375 | # misc shortcuts.
|
---|
1376 | target: needed libraries binaries others
|
---|
1377 | objects: $(_OBJS)
|
---|
1378 | programs: $(_EXES)
|
---|
1379 | dlls: $(_DLLS)
|
---|
1380 | sysmods: $(_SYSMODS)
|
---|
1381 |
|
---|
1382 |
|
---|
1383 | # end-of-file-content
|
---|
1384 | __footer_kmk__ := target
|
---|
1385 | endif # __footer_kmk__
|
---|