source: trunk/kBuild/footer.kmk@ 136

Last change on this file since 136 was 136, checked in by bird, 21 years ago

OTHER_CLEAN

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