source: trunk/kBuild/footer.kmk@ 76

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

...

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 17.5 KB
RevLine 
[72]1# $Id: footer.kmk 76 2004-05-31 08:12:08Z bird $
2## @file
3#
4# kBuild - File included at top of makefile.
5#
6# Copyright (c) 2004 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 2 of the License, or
14# (at your option) any later version.
15#
16# kBuild is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with kBuild; if not, write to the Free Software
23# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24#
25#
26
27ifndef __footer_kmk__
28# start-of-file-content
29
30#
31# Variables.
[73]32# (Some of these need initialization before including definitions using them.)
[72]33#
34
35# all targets.
36ALL_TARGETS := $(LIBRARIES) $(PROGRAMS) $(DLLS) $(DRIVERS) $(OTHERS)
37
[75]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
[72]46# all of a type
47_OBJS :=
48_LIBS :=
49_DLLS :=
50_EXES :=
51_DIRS :=
52
53# all objs of a specific target
54define def_objs_var
55_OBJS_$1 :=
56endef
57$(foreach target, $(ALL_TARGETS), $(eval _OBJS_$(target) := ))
58
[73]59
[72]60#
[73]61# Basic macros
62#
63
64## Figure out the tool for a source
65# @param $1 source file
66# @param $2 normalized main target
[74]67_SOURCE_TOOL = $(firstword $($1_$2_TOOL) $($1_TOOL) $($2_TOOL) $(TOOL))
[73]68
69## Figure out where to put object files.
70# @param $1 source file
71# @param $2 normalized main target
72_OBJECT_BASE = $(PATH_TARGET)/$(2)/$(basename $(1))
73
74## Figure out where to put object files.
75# @param $1 real target name.
76# @param $2 normalized main target
77_TARGET_BASE = $(PATH_TARGET)/$(2)/$(basename $(1))
78
79
80#
[72]81# Include templates
82#
83_TEMPLATES := $(TEMPLATE)
84define def_templates
85ifdef $(target)_TEMPLATE
86_TEMPLATES += $($(target)_TEMPLATE)
87endif
88endef
89$(foreach target, $(ALL_TARGETS), $(eval $(def_templates)))
90_TEMPLATES := $(sort $(_TEMPLATES))
91# $ (warning dbg: _TEMPLATES=$(_TEMPLATES))
92
93define def_templates_include
94ifndef TEMPLATE_$(template)
95include $(firstword $(wildcard $(PATH_KBUILD)/templates/$(template).kmk))
96endif
97endef
98$(foreach template, $(_TEMPLATES), $(eval $(def_templates)))
99
[74]100
[72]101#
102# Common Inheritance
103#
104
105## Inherit defaults property
106# @param $(prop) Property name
107# @param $(target) Target name.
108define def_inherit_defaults_one
[74]109ifndef $(target)_$(prop)
[72]110ifdef $(prop)
[74]111$(target)_$(prop) := $($(prop))
[72]112endif
113endif
114endef
115
116## Inherit default properties for one target.
117# A bit tricky this one, but it depends a bit on whether or not TEMPLATE
118# is inherited from the default properties.
119# @param $(target) Target name
120define def_inherit_defaults
121ifdef $(target)_TEMPLATE
122ifndef TEMPLATE_$($(target)_TEMPLATE)_TOOL
123$(foreach prop, TOOL, $(eval $(def_inherit_defaults_one)))
124endif
125ifndef TEMPLATE_$($(target)_TEMPLATE)_SDKS
126$(foreach prop, SDKS, $(eval $(def_inherit_defaults_one)))
127endif
128else
129$(foreach prop, TEMPLATE TOOL SDKS, $(eval $(def_inherit_defaults_one)))
130endif
131endef
132# Inherit default properties.
133$(foreach target, $(ALL_TARGETS), $(eval $(def_inherit_defaults)))
134
135
136## Inherit one template property.
137# @param $(prop) Property name
138# @param $(target) Target name
139define def_inherit_template_one
140ifndef $(target)_$(prop)
141ifdef TEMPLATE_$($(target)_TEMPLATE)_$(prop)
142$(target)_$(prop) := $(TEMPLATE_$($(target)_TEMPLATE)_$(prop))
143endif
144endif
145endef
146
147## Inherit template properties for on target.
148# @param $(target) Target name.
149define def_inherit_template
150$(foreach prop,TOOL SDKS DEFS INCS COPTS CFLAGS CDEFS CINCS CXXOPTS CXXFLAGS CXXDEFS CXXINCS ASOPTS ASFLAGS ASDEFS ASINCS, \
151 $(eval $(def_inherit_template_one)))
152endef
153# Inherit template properties
154$(foreach target, $(ALL_TARGETS), $(eval $(def_inherit_template)))
155
156
157
158#
159# Include tools
160#
161_TOOLS := $(TOOL)
162define def_tools_target_source
163#$ (warning dbg: src=$(source))
164$(foreach tool,$($(source)_TOOL) $($(target)_$(source)_TOOL),\
165 $(eval _TOOLS += $(tool)))
166endef
167define def_tools_target
168#$ (warning dbg: trg=$(target))
169$(foreach tool, $($(target)_TOOL), $(eval _TOOLS += $(tool)))
170$(foreach source, $($(target)_SOURCES), $(eval $(def_tools_target_source)))
171endef
172$(foreach target, $(ALL_TARGETS), $(eval $(def_tools_target)))
173_TOOLS := $(sort $(_TOOLS))
174#$ (warning dbg: _TOOLS=$(_TOOLS))
175
176define def_tools_include
177ifndef TOOL_$(tool)
178include $(firstword $(wildcard $(PATH_KBUILD)/tools/$(tool).kmk))
179endif
180endef
181$(foreach tool, $(_TOOLS), $(eval $(def_tools_include)))
182
183
184#
185# Include SDKs
[73]186#
[72]187_SDKS := $(SDKS)
188define def_sdks_target_source
189$(foreach sdk, $($(source)_SDKS) $($(target)_$(source)_SDKS), \
190 $(eval _SDKS += $(sdk)))
191endef
192define def_sdks_target
193$(foreach sdk, $($(target)_SDKS), $(eval _SDKS += $(sdk)))
194$(foreach source, $($(target)_SOURCES), $(eval $(def_sdks_target_source)))
195endef
196$(foreach target, $(ALL_TARGETS), $(eval $(def_sdks_target)))
197_SDKS := $(sort $(_SDKS))
198#$ (warning dbg: _SDKS=$(_SDKS))
199
200define def_sdks_include
201ifndef SDK_$(sdk)
202include $(firstword $(wildcard $(PATH_KBUILD)/sdks/$(sdk).kmk))
203endif
204endef
205$(foreach sdk, $(_SDKS), $(eval $(def_sdk)))
206
[73]207#
208# Object processing.
209#
[72]210
[73]211## Generic macro for processing C, C++ and Assembly sources.
212# @param $(target) Normalized target name.
213# @param $(source) Source file name.
214# @param $(type) Source type. {C,CXX,AS}
[72]215#
[73]216# @remark I've no clue why I've to $(eval ..) everything in this define. MAKE bug?
217define def_target_source_c_cpp_asm
218#$ (warning dbg: def_target_source_c_cpp_asm: source=$(source) target=$(target) type=$(type))
219
220$(eval tool:=$(call _SOURCE_TOOL,$(source),$(target)))
221$(eval defs :=\
[74]222 $(TOOL_$(tool)_$(type)DEFS)\
223 $(TOOL_$(tool)_$(type)DEFS.$(BUILD_TYPE))\
224 $(DEFS)\
225 $(DEFS.$(BUILD_TYPE))\
226 $($(target)_DEFS)\
227 $($(target)_DEFS.$(BUILD_TYPE))\
228 $($(target)_DEFS.$(BUILD_TARGET))\
229 $($(source)_DEFS)\
230 $($(source)_DEFS.$(BUILD_TYPE))\
231 $($(source)_DEFS.$(BUILD_TARGET))\
[73]232 $($(source)_$(type)DEFS)\
[74]233 $($(source)_$(type)DEFS.$(BUILD_TYPE))\
234 $($(source)_$(type)DEFS.$(BUILD_TARGET))\
[73]235 $($(target)_$(type)DEFS)\
[74]236 $($(target)_$(type)DEFS.$(BUILD_TYPE))\
237 $($(target)_$(type)DEFS.$(BUILD_TARGET))\
238 $($(target)_$(source)_DEFS)\
239 $($(target)_$(source)_DEFS.$(BUILD_TYPE))\
240 $($(target)_$(source)_DEFS.$(BUILD_TARGET))\
241 $($(target)_$(source)_$(type)DEFS)\
242 $($(target)_$(source)_$(type)DEFS.$(BUILD_TYPE))\
243 $($(target)_$(source)_$(type)DEFS.$(BUILD_TARGET))\
[73]244 )
245$(eval incs :=\
[74]246 $($(target)_$(source)_$(type)INCS.$(BUILD_TARGET))\
247 $($(target)_$(source)_$(type)INCS.$(BUILD_TYPE))\
[73]248 $($(target)_$(source)_$(type)INCS)\
[74]249 $($(target)_$(source)_INCS.$(BUILD_TARGET))\
250 $($(target)_$(source)_INCS.$(BUILD_TYPE))\
[73]251 $($(target)_$(source)_INCS)\
[74]252 $($(source)_$(type)INCS.$(BUILD_TARGET))\
253 $($(source)_$(type)INCS.$(BUILD_TYPE))\
[73]254 $($(source)_$(type)INCS)\
[74]255 $($(source)_INCS.$(BUILD_TARGET))\
256 $($(source)_INCS.$(BUILD_TYPE))\
[73]257 $($(source)_INCS)\
[74]258 $($(target)_$(type)INCS.$(BUILD_TARGET))\
259 $($(target)_$(type)INCS.$(BUILD_TYPE))\
[73]260 $($(target)_$(type)INCS)\
[74]261 $($(target)_INCS.$(BUILD_TARGET))\
262 $($(target)_INCS.$(BUILD_TYPE))\
[73]263 $($(target)_INCS)\
[74]264 $(INCS.$(BUILD_TARGET))\
265 $(INCS.$(BUILD_TYPE))\
[73]266 $(INCS)\
[74]267 $(TOOL_$(tool)_$(type)INCS.$(BUILD_TARGET))\
268 $(TOOL_$(tool)_$(type)INCS.$(BUILD_TYPE))\
[73]269 $(TOOL_$(tool)_$(type)INCS)\
270 )
271$(eval flags :=\
272 $(TOOL_$(tool)_$(type)FLAGS)\
273 $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TYPE))\
[74]274 $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TARGET))\
[73]275 $($(type)FLAGS)\
276 $($(type)FLAGS.$(BUILD_TYPE))\
[74]277 $($(type)FLAGS.$(BUILD_TARGET))\
[73]278 $($(target)_$(type)FLAGS)\
279 $($(target)_$(type)FLAGS.$(BUILD_TYPE))\
[74]280 $($(target)_$(type)FLAGS.$(BUILD_TARGET))\
[73]281 $($(source)_$(type)FLAGS)\
282 $($(source)_$(type)FLAGS.$(BUILD_TYPE))\
[74]283 $($(source)_$(type)FLAGS.$(BUILD_TARGET))\
[73]284 $($(target)_$(source)_$(type)FLAGS)\
285 $($(target)_$(source)_$(type)FLAGS.$(BUILD_TYPE))\
[74]286 $($(target)_$(source)_$(type)FLAGS.$(BUILD_TARGET))\
[73]287 )
288$(eval outbase := $(call _OBJECT_BASE,$(source),$(target)))
289$(eval dirdep := $(dir $(outbase)).dir_created)
[74]290$(eval objsuff := $(firstword \
291 $($(target)_$(source)_OBJSUFF.$(BUILD_TARGET))\
292 $($(target)_$(source)_OBJSUFF)\
293 $($(source)_OBJSUFF.$(BUILD_TARGET))\
294 $($(source)_OBJSUFF)\
295 $($(target)_OBJSUFF.$(BUILD_TARGET))\
296 $($(target)_OBJSUFF)\
297 $(TOOL_$(tool)_$(type)OBJSUFF.$(BUILD_TARGET))\
298 $(TOOL_$(tool)_$(type)OBJSUFF)\
299 $(SUFF_OBJ)\
300 ))
[73]301$(eval obj := $(outbase)$(objsuff))
[74]302$(eval dep := $(outbase)$(SUFF_DEP))
[73]303
304#$ (warning dbg: target=$(target) source=$(source) tool=$(tool) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff))
305$(eval $(TOOL_$(tool)_COMPILE_$(type)))
306
307$(eval _OBJS_$(target) += $(obj))
308$(eval _DEPFILES += $(dep))
309
310endef
311
312## Generic macro for processing all target sources.
[74]313# @param $(target) Normalized target name.
[73]314define def_target_sources
315#$ (warning def_target_sources)
316# C sources
317$(foreach type,C,$(foreach source, $(filter %.c, $($(target)_SOURCES))\
318 ,$(eval $(def_target_source_c_cpp_asm)) ))
319
320# C++ sources
321$(foreach type,CXX,$(foreach source, $(filter %.cpp, $($(target)_SOURCES)) $(filter %.cxx, $($(target)_SOURCES)) $(filter %.cc, $($(target)_SOURCES))\
322 ,$(eval $(def_target_source_c_cpp_asm)) ))
323
324# ASM sources
325$(foreach type,AS,$(foreach source, $(filter %.asm, $($(target)_SOURCES)) $(filter %.s, $($(target)_SOURCES)) $(filter %.S, $($(target)_SOURCES))\
326 ,$(eval $(def_target_source_c_cpp_asm)) ))
327endef
328
329
330#
[72]331# LIBRARIES
[73]332#
[72]333
334## Library (one).
[74]335# @param $(target) Normalized library (target) name.
[72]336define def_lib
[73]337# source -> object
338$(eval $(def_target_sources))
[72]339
[73]340# library
341$(eval tool := $(firstword $($(target)_TOOL) $(TOOL)))
[74]342$(eval flags :=\
343 $(TOOL_$(tool)_ARFLAGS)\
344 $(TOOL_$(tool)_ARFLAGS.$(BUILD_TYPE))\
345 $(ARFLAGS)\
346 $(ARFLAGS.$(BUILD_TYPE))\
347 $($(target)_ARFLAGS)\
348 $($(target)_ARFLAGS.$(BUILD_TYPE))\
349 )
350$(eval libsuff := $(firstword\
351 $($(target)_LIBSUFF.$(BUILD_TARGET))\
352 $($(target)_LIBSUFF)\
353 $(TOOL_$(tool)_ARLIBSUFF.$(BUILD_TARGET))\
354 $(TOOL_$(tool)_ARLIBSUFF)\
355 $(SUFF_LIB)\
356))
[73]357## @todo prefix
358$(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
359$(eval lib := $(outbase)$(libsuff))
360$(eval objs = $(_OBJS_$(target)))
361$(eval dirdep := $(dir $(lib)).dir_created)
362## @todo fix dependencies
363$(eval deps := )
[72]364
[73]365$(eval $(TOOL_$(tool)_LINK_LIBRARY))
[72]366
[73]367_OBJS += $(_OBJS_$(target))
368_LIBS += $(lib)
[75]369_OUT_FILES += $(lib)
[72]370endef
371
372# Process libraries
373$(foreach target, $(LIBRARIES), $(eval $(def_lib)))
374
375
376
377#
378# PROGRAMS
379#
380
[74]381## Program (one).
382# @param $(target) Normalized target (program) name.
383define def_program
384# source -> object
385$(eval $(def_target_sources))
[72]386
[74]387# library
388$(eval tool := $(firstword $($(target)_TOOL) $(TOOL)))
389$(eval flags :=\
390 $(TOOL_$(tool)_LDFLAGS)\
391 $(TOOL_$(tool)_LDFLAGS.$(BUILD_TYPE))\
392 $(LDFLAGS)\
393 $(LDFLAGS.$(BUILD_TYPE))\
394 $($(target)_LDFLAGS)\
395 $($(target)_LDFLAGS.$(BUILD_TYPE))\
396)
397$(eval exesuff := $(firstword $($(target)_EXESUFF) $($(target)_EXESUFF) $(TOOL_$(tool)_LDEXESUFF) $(SUFF_EXE)))
398$(eval outbase := $(call _TARGET_BASE,$(target),$(target)))
399$(eval exe := $(outbase)$(exesuff))
400$(eval objs = $(_OBJS_$(target)))
401$(eval libs :=\
402 $($(target)_LIBS.$(BUILD_TYPE))\
403 $($(target)_LIBS)\
404 $(LIBS.$(BUILD_TYPE))\
405 $(LIBS)\
406 $(TOOL_$(tool)_LIBS.$(BUILD_TYPE))\
407 $(TOOL_$(tool)_LIBS)\
408)
409$(eval libpath :=\
410 $($(target)_LIBPATH.$(BUILD_TYPE))\
411 $($(target)_LIBPATH)\
412 $(LIBPATH.$(BUILD_TYPE))\
413 $(LIBPATH)\
414 $(TOOL_$(tool)_LIBPATH.$(BUILD_TYPE))\
415 $(TOOL_$(tool)_LIBPATH)\
416)
417$(eval dirdep := $(dir $(exe)).dir_created)
418## @todo fix dependencies
419$(eval deps := )
420#
421$(eval deffile := $(strip $(firstword
422 $($(target)_DEFFILE.$(BUILD_TARGET).$(BUILD_TYPE))\
423 $($(target)_DEFFILE.$(BUILD_TARGET))\
424 $($(target)_DEFFILE.$(BUILD_TYPE))\
425 $($(target)_DEFFILE)\
426 $(DEFFILE.$(BUILD_TARGET).$(BUILD_TYPE))\
427 $(DEFFILE.$(BUILD_TARGET))\
428 $(DEFFILE.$(BUILD_TYPE))\
429 $(DEFFILE)\
430)))
431$(eval custom_pre := $(strip $(firstword
432 $($(target)_CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
433 $($(target)_CUSTOM_PRE.$(BUILD_TARGET))\
434 $($(target)_CUSTOM_PRE.$(BUILD_TYPE))\
435 $($(target)_CUSTOM_PRE)\
436 $(CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
437 $(CUSTOM_PRE.$(BUILD_TARGET))\
438 $(CUSTOM_PRE.$(BUILD_TYPE))\
439 $(CUSTOM_PRE)\
440)))
441$(eval custom_post := $(strip $(firstword
442 $($(target)_CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
443 $($(target)_CUSTOM_POST.$(BUILD_TARGET))\
444 $($(target)_CUSTOM_POST.$(BUILD_TYPE))\
445 $($(target)_CUSTOM_POST)\
446 $(CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
447 $(CUSTOM_POST.$(BUILD_TARGET))\
448 $(CUSTOM_POST.$(BUILD_TYPE))\
449 $(CUSTOM_POST)\
450)))
[72]451
[74]452$(eval $(TOOL_$(tool)_LINK_PROGRAM))
453
454_OBJS += $(_OBJS_$(target))
455_EXES += $(exe)
[75]456_OUT_FILES += $(exe)
[74]457endef
458
459# Process libraries
460$(foreach target, $(PROGRAMS), $(eval $(def_program)))
461
462
463
[72]464#
465# DLLS
466#
467
468
469
470#
471# DRIVERS
472#
473
474
475
476#
477# OTHERS
478#
479
480
481
482#
483# DOCS
484#
485
486
487#
488# Directories.
489#
[75]490_OUTPUT_FILES := $(_OBJS) $(_LIBS) $(_EXES) $(_DLLS)
491_DIRFILES := $(sort $(addsuffix /.dir_created,$(_DIRS)) $(addsuffix .dir_created,$(dir $(_OUTPUT_FILES))))
[72]492
493define def_createdir
494$(dirfile):
[73]495 $(call MSG_L1,Creating directory $$(@D))
[72]496 $(MKDIR) -p $$(@D)
[73]497 @echo dir_created > $$@
[72]498endef
499
500$(foreach dirfile,$(_DIRFILES),$(eval $(def_createdir)))
501
[75]502
[72]503#
[75]504# Include dependency files.
[72]505#
[75]506$(foreach dep,$(wildcard $(_DEPFILES)),$(eval include $(dep)))
[72]507
[75]508
509#
510# PASSES (including directory and makefile walking)
511#
512# Do all the default passes if it's unspecified.
513PASSES ?= needed libraries binaries others publish
[72]514
[75]515## Proritized list of the default makefile when walking subdirectories.
516# The user can overload this list.
517DEFAULT_MAKEFILE ?= Makefile.kmk makefile.kmk Makefile makefile
[72]518
[75]519## Subdir
520# @param $(pass) Lowercase pass name.
521# @param $(PASS) Uppercase pass name.
522# @param $(subdir) Subdirectory
523# @param $(tag) tag to attach to the rule name.
524define def_pass_subdir
525pass_$(pass)$(tag)::
526 $(QUIET)$$(MAKE) -C $(subdir) -f $$(notdir $$(firstword $$(wildcard $$(addprefix $(subdir)/,$$(DEFAULT_MAKEFILE))))) pass_$(pass)
527endef
[72]528
[75]529## Submakefile
530# @param $(pass) Lowercase pass name.
531# @param $(PASS) Uppercase pass name.
532# @param $(makefile) Makefile.
533# @param $(tag) tag to attach to the rule name.
534define def_pass_makefile
535pass_$(pass)$(tag)::
536 $(QUIET)$$(MAKE) -C $(patsubst %/,%,$(dir $(makefile))) -f $(notdir $(makefile)) pass_$(pass)
537endef
[73]538
[74]539
[75]540## Execute a pass.
541# @param $(pass) Lowercase pass name.
542# @param $(PASS) Uppercase pass name.
543define def_pass
544$(eval SUBDIRS_$(PASS) ?= $(SUBDIRS))
545$(eval SUBDIRS_AFTER_$(PASS) ?= $(SUBDIRS_AFTER))
546$(eval MAKEFILES_BEFORE_$(PASS) ?= $(MAKEFILES_BEFORE))
547$(eval MAKEFILES_AFTER_$(PASS) ?= $(MAKEFILES_AFTER))
548
549$(eval tag:=_before)
550$(foreach subdir,$(SUBDIRS_$(PASS)),$(eval $(def_pass_subdir)))
551$(foreach makefile,$(MAKEFILES_BEFORE_$(PASS)),$(eval $(def_pass_makefile)))
552
553$(eval tag:=_after)
554$(foreach subdir,$(SUBDIRS_AFTER_$(PASS)),$(eval $(def_pass_subdir)))
555$(foreach makefile,$(MAKEFILES_AFTER_$(PASS)),$(eval $(def_pass_makefile)))
556
557.NOTPARALLEL: pass_$(pass)_before pass_$(pass)_after
558.PHONY: pass_$(pass) pass_$(pass)_before pass_$(pass)_doit pass_$(pass)_after
559pass_$(pass): \
560 pass_$(pass)_before \
561 pass_$(pass)_doit \
562 pass_$(pass)_after
563
564endef
565
[76]566
[75]567## PASS: needed
568# This pass builds targets which are required for building the rest.
569pass_needed_doit: $(_NEEDEDS)
570pass := needed
571PASS := NEEDED
572$(eval $(def_pass))
573
574## PASS: libraries
575# This pass builds library targets.
576pass_libraries_doit: $(_LIBS) $(_IMPORT_LIBS) $(_OTHER_LIBRARIES)
577pass := libraries
578PASS := LIBRARIES
579$(eval $(def_pass))
580
581## PASS: binaries
582# This pass builds binary targets, i.e. programs, dlls, drivers and stuff.
583pass_binaries_doit: $(_DLLS) $(_EXES) $(_KMODS) $(_OTHER_BINARIES)
584pass := binaries
585PASS := BINARIES
586$(eval $(def_pass))
587
588## PASS: others
589# This pass builds binary targets, i.e. programs, dlls, drivers and stuff.
590pass_others_doit: $(_OTHERS)
591pass := others
592PASS := OTHERS
593$(eval $(def_pass))
594
595## PASS: publish
596# This pass installs the built entities to a sandbox area.
597pass_publish_doit: publish
598publish::
599pass := publish
600PASS := PUBLISH
[76]601# $(sort).. not nice.
[75]602SUBDIRS_PUBLISH ?= $(sort $(SUBDIRS) $(SUBDIRS_LIBRARIES) $(SUBDIRS_BINARIES) $(SUBDIRS_OTHERS))
603SUBDIRS_AFTER_PUBLISH ?= $(sort $(SUBDIRS_AFTER) $(SUBDIRS_AFTER_LIBRARIES) $(SUBDIRS_AFTER_BINARIES) $(SUBDIRS_AFTER_OTHERS))
604MAKEFILES_BEFORE_PUBLISH?= $(sort $(MAKEFILES_BEFORE) $(MAKEFILES_BEFORE_LIBRARIES) $(MAKEFILES_BEFORE_BINARIES) $(MAKEFILES_BEFORE_OTHERS))
605MAKEFILES_AFTER_PUBLISH ?= $(sort $(MAKEFILES_AFTER) $(MAKEFILES_AFTER_LIBRARIES) $(MAKEFILES_AFTER_BINARIES) $(MAKEFILES_AFTER_OTHERS))
606$(eval $(def_pass))
607
608## PASS: packing
609# This pass processes custom packing rules.
610pass_packing_doit: packing
611packing::
612pass := packing
613PASS := PACKING
614$(eval $(def_pass))
615
616## PASS: clean
617# This pass removes all generated files.
618pass_clean_doit:
619 $(RM) -f $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_DIRFILES)
620pass := clean
621PASS := CLEAN
622$(eval $(def_pass))
623clean: pass_clean
624
625## PASS: nothing
626# This pass just walks the tree.
627pass_nothing_doit:
628 $(call MSG_L1,Did nothing in $(CURDIR))
629pass := nothing
630PASS := NOTHING
631$(eval $(def_pass))
632nothing: pass_nothing
633
634
635
636#
637# THE MAIN RULES
638#
639all_recursive: $(foreach pass,$(PASSES),pass_$(pass))
640
641# misc shortcuts.
642target: needed libraries binaries others
643objects: $(_OBJS)
644programs: $(_EXES)
645dlls: $(_DLLS)
646kernelmodules: $(_KMODS)
647
648
[72]649# end-of-file-content
650__footer_kmk__ := 1
651endif # __footer_kmk__
Note: See TracBrowser for help on using the repository browser.