1 | # $Id: footer.kmk 2521 2011-07-26 18:18:19Z bird $
|
---|
2 | ## @file
|
---|
3 | # kBuild - File included at bottom of a makefile.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (c) 2004-2011 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
|
---|
8 | #
|
---|
9 | # This file is part of kBuild.
|
---|
10 | #
|
---|
11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
12 | # it under the terms of the GNU General Public License as published by
|
---|
13 | # the Free Software Foundation; either version source of the License, or
|
---|
14 | # (at your option) any later version.
|
---|
15 | #
|
---|
16 | # kBuild is distributed in the hope that it will be useful,
|
---|
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | # GNU General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with kBuild; if not, write to the Free Software
|
---|
23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
24 | #
|
---|
25 | #
|
---|
26 | # As a special exception you are granted permission to include this file, via
|
---|
27 | # the kmk include directive, as you wish without this in itself causing the
|
---|
28 | # resulting makefile, program or whatever to be covered by the GPL license.
|
---|
29 | # This exception does not however invalidate any other reasons why the makefile,
|
---|
30 | # program, whatever should not be covered the GPL.
|
---|
31 | #
|
---|
32 | #
|
---|
33 |
|
---|
34 | ifndef __footer_kmk__
|
---|
35 | # start-of-file-content
|
---|
36 | ifdef KBUILD_PROFILE_SELF
|
---|
37 | $(evalcall def_profile_self, start of footer.kmk)
|
---|
38 | _KBUILD_TS_FOOTER_START := $(_KBUILD_TS_PREV)
|
---|
39 | endif
|
---|
40 |
|
---|
41 | #
|
---|
42 | # Variables.
|
---|
43 | # (Some of these need initialization before including definitions using them.)
|
---|
44 | #
|
---|
45 |
|
---|
46 | # All targets of each types.
|
---|
47 | _ALL_BLDPROGS := $(BLDPROGS) $(BLDPROGS.$(KBUILD_HOST)) $(BLDPROGS.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) $(BLDPROGS.$(KBUILD_HOST_ARCH)) $(BLDPROGS.$(KBUILD_HOST_CPU)) $(BLDPROGS.$(KBUILD_TYPE))
|
---|
48 | _ALL_LIBRARIES := $(LIBRARIES) $(LIBRARIES.$(KBUILD_TARGET)) $(LIBRARIES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(LIBRARIES.$(KBUILD_TARGET_ARCH)) $(LIBRARIES.$(KBUILD_TARGET_CPU)) $(LIBRARIES.$(KBUILD_TYPE))
|
---|
49 | _ALL_IMPORT_LIBS := $(IMPORT_LIBS) $(IMPORT_LIBS.$(KBUILD_TARGET)) $(IMPORT_LIBS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(KBUILD_TARGET_ARCH)) $(IMPORT_LIBS.$(KBUILD_TARGET_CPU)) $(IMPORT_LIBS.$(KBUILD_TYPE))
|
---|
50 | _ALL_DLLS := $(DLLS) $(DLLS.$(KBUILD_TARGET)) $(DLLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(DLLS.$(KBUILD_TARGET_ARCH)) $(DLLS.$(KBUILD_TARGET_CPU)) $(DLLS.$(KBUILD_TYPE))
|
---|
51 | _ALL_PROGRAMS := $(PROGRAMS) $(PROGRAMS.$(KBUILD_TARGET)) $(PROGRAMS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(PROGRAMS.$(KBUILD_TARGET_ARCH)) $(PROGRAMS.$(KBUILD_TARGET_CPU)) $(PROGRAMS.$(KBUILD_TYPE))
|
---|
52 | _ALL_SYSMODS := $(SYSMODS) $(SYSMODS.$(KBUILD_TARGET)) $(SYSMODS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(SYSMODS.$(KBUILD_TARGET_ARCH)) $(SYSMODS.$(KBUILD_TARGET_CPU)) $(SYSMODS.$(KBUILD_TYPE))
|
---|
53 | _ALL_MISCBINS := $(MISCBINS) $(MISCBINS.$(KBUILD_TARGET)) $(MISCBINS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(MISCBINS.$(KBUILD_TARGET_ARCH)) $(MISCBINS.$(KBUILD_TARGET_CPU)) $(MISCBINS.$(KBUILD_TYPE))
|
---|
54 | _ALL_OTHERS := $(OTHERS) $(OTHERS.$(KBUILD_TARGET)) $(OTHERS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(OTHERS.$(KBUILD_TARGET_ARCH)) $(OTHERS.$(KBUILD_TARGET_CPU)) $(OTHERS.$(KBUILD_TYPE))
|
---|
55 | _ALL_INSTALLS := $(INSTALLS) $(INSTALLS.$(KBUILD_TARGET)) $(INSTALLS.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(INSTALLS.$(KBUILD_TARGET_ARCH)) $(INSTALLS.$(KBUILD_TARGET_CPU)) $(INSTALLS.$(KBUILD_TYPE))
|
---|
56 | _ALL_FETCHES := $(FETCHES) $(FETCHES.$(KBUILD_TARGET)) $(FETCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(FETCHES.$(KBUILD_TARGET_ARCH)) $(FETCHES.$(KBUILD_TARGET_CPU)) $(FETCHES.$(KBUILD_TYPE))
|
---|
57 | _ALL_PATCHES := $(PATCHES) $(PATCHES.$(KBUILD_TARGET)) $(PATCHES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(PATCHES.$(KBUILD_TARGET_ARCH)) $(PATCHES.$(KBUILD_TARGET_CPU)) $(PATCHES.$(KBUILD_TYPE))
|
---|
58 |
|
---|
59 | # all targets.
|
---|
60 | _ALL_TARGETS = \
|
---|
61 | $(_ALL_FETCHES) \
|
---|
62 | $(_ALL_PATCHES) \
|
---|
63 | $(_ALL_BLDPROGS) \
|
---|
64 | $(_ALL_LIBRARIES) \
|
---|
65 | $(_ALL_IMPORT_LIBS) \
|
---|
66 | $(_ALL_DLLS) \
|
---|
67 | $(_ALL_PROGRAMS) \
|
---|
68 | $(_ALL_SYSMODS) \
|
---|
69 | $(_ALL_MISCBINS) \
|
---|
70 | $(_ALL_INSTALLS) \
|
---|
71 | $(_ALL_OTHERS)
|
---|
72 |
|
---|
73 | # all $(KBUILD_TARGET) targets.
|
---|
74 | _ALL_TARGET_TARGETS = \
|
---|
75 | $(_ALL_FETCHES) \
|
---|
76 | $(_ALL_PATCHES) \
|
---|
77 | $(_ALL_LIBRARIES) \
|
---|
78 | $(_ALL_IMPORT_LIBS) \
|
---|
79 | $(_ALL_DLLS) \
|
---|
80 | $(_ALL_PROGRAMS) \
|
---|
81 | $(_ALL_SYSMODS) \
|
---|
82 | $(_ALL_MISCBINS) \
|
---|
83 | $(_ALL_INSTALLS) \
|
---|
84 | $(_ALL_OTHERS)
|
---|
85 |
|
---|
86 | # all $(KBUILD_HOST) targets.
|
---|
87 | _ALL_HOST_TARGETS = \
|
---|
88 | $(_ALL_BLDPROGS)
|
---|
89 |
|
---|
90 | # all targets making use of srcname.
|
---|
91 | _ALL_SRCNAME_TARGETS = \
|
---|
92 | $(_ALL_FETCHES) \
|
---|
93 | $(_ALL_PATCHES)
|
---|
94 |
|
---|
95 | # Dependency files. (currently not on target level, only this global stuff)
|
---|
96 | _DEPFILES := $(DEPFILES) $(DEPFILES.$(KBUILD_TARGET)) $(DEPFILES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(DEPFILES.$(KBUILD_TARGET_ARCH)) $(DEPFILES.$(KBUILD_TARGET_CPU)) $(DEPFILES.$(KBUILD_TYPE))
|
---|
97 |
|
---|
98 | # included dependency files.
|
---|
99 | _DEPFILES_INCLUDED :=
|
---|
100 |
|
---|
101 |
|
---|
102 | # All kind of output files except for _OBJS and _DEPFILES.
|
---|
103 | # Compiling or linking definition outputting other things that $@ and any
|
---|
104 | # required dependency file must add those output files to this variable.
|
---|
105 | _OUT_FILES :=
|
---|
106 |
|
---|
107 | # Files which only requires cleaning up.
|
---|
108 | _CLEAN_FILES :=
|
---|
109 |
|
---|
110 | # all of a type
|
---|
111 | _OBJS :=
|
---|
112 | _FETCHES :=
|
---|
113 | _DOWNLOADS:=
|
---|
114 | _UNPACKS :=
|
---|
115 | _PATCHES :=
|
---|
116 | _UNFETCHES:=
|
---|
117 | _BLDPROGS :=
|
---|
118 | _LIBS :=
|
---|
119 | _DLLS :=
|
---|
120 | _PROGRAMS :=
|
---|
121 | _SYSMODS :=
|
---|
122 | _MISCBINS :=
|
---|
123 | _STAGE_FILES :=
|
---|
124 | _STAGE_DIRS :=
|
---|
125 | _INSTALLS :=
|
---|
126 | _INSTALLS_FILES :=
|
---|
127 | _INSTALLS_DIRS :=
|
---|
128 | _OTHERS :=
|
---|
129 | _PACKING :=
|
---|
130 | _DIRS := $(PATH_TARGET)/ $(PATH_TARGET) $(BLDDIRS)
|
---|
131 | _IMPORT_LIBS :=
|
---|
132 |
|
---|
133 | # Implicit targets added while processing other targets (usually by units).
|
---|
134 | _ALL_INSTALLS_IMPLICIT :=
|
---|
135 |
|
---|
136 | # misc
|
---|
137 | pass_prev :=
|
---|
138 |
|
---|
139 |
|
---|
140 |
|
---|
141 | #
|
---|
142 | # Footer macros
|
---|
143 | #
|
---|
144 |
|
---|
145 | ## Figure out the tool for a target.
|
---|
146 | # @param $1 normalized target.
|
---|
147 | # @param $2 tooltype.
|
---|
148 | # @param bld_trg build target.
|
---|
149 | # @param bld_trg_arch build target architecture.
|
---|
150 | # @param bld_type build target type.
|
---|
151 | if 0
|
---|
152 | _TARGET_TOOL = $(strip $(firstword \
|
---|
153 | $($(1)_$(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
154 | $($(1)_$(2)TOOL.$(bld_trg)) \
|
---|
155 | $($(1)_$(2)TOOL) \
|
---|
156 | $($(1)_TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
157 | $($(1)_TOOL.$(bld_trg)) \
|
---|
158 | $($(1)_TOOL) \
|
---|
159 | $($(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
160 | $($(2)TOOL.$(bld_trg)) \
|
---|
161 | $($(2)TOOL) \
|
---|
162 | $(TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
163 | $(TOOL.$(bld_trg)) \
|
---|
164 | $(TOOL) \
|
---|
165 | ))
|
---|
166 | else
|
---|
167 | _TARGET_TOOL = $(strip $(firstword \
|
---|
168 | $($(1)_$(2)TOOL.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
169 | $($(1)_$(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
170 | $($(1)_$(2)TOOL.$(bld_trg).$(bld_type)) \
|
---|
171 | $($(1)_$(2)TOOL.$(bld_trg_arch)) \
|
---|
172 | $($(1)_$(2)TOOL.$(bld_trg)) \
|
---|
173 | $($(1)_$(2)TOOL.$(bld_type)) \
|
---|
174 | $($(1)_$(2)TOOL) \
|
---|
175 | $($(1)_TOOL.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
176 | $($(1)_TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
177 | $($(1)_TOOL.$(bld_trg).$(bld_type)) \
|
---|
178 | $($(1)_TOOL.$(bld_trg_arch)) \
|
---|
179 | $($(1)_TOOL.$(bld_trg)) \
|
---|
180 | $($(1)_TOOL.$(bld_type)) \
|
---|
181 | $($(1)_TOOL) \
|
---|
182 | $($(2)TOOL.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
183 | $($(2)TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
184 | $($(2)TOOL.$(bld_trg).$(bld_type)) \
|
---|
185 | $($(2)TOOL.$(bld_trg_arch)) \
|
---|
186 | $($(2)TOOL.$(bld_trg)) \
|
---|
187 | $($(2)TOOL.$(bld_type)) \
|
---|
188 | $($(2)TOOL) \
|
---|
189 | $(TOOL.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
|
---|
190 | $(TOOL.$(bld_trg).$(bld_trg_arch)) \
|
---|
191 | $(TOOL.$(bld_trg).$(bld_type)) \
|
---|
192 | $(TOOL.$(bld_trg_arch)) \
|
---|
193 | $(TOOL.$(bld_trg)) \
|
---|
194 | $(TOOL.$(bld_type)) \
|
---|
195 | $(TOOL) \
|
---|
196 | ))
|
---|
197 | endif
|
---|
198 |
|
---|
199 | ## Figure out the actual name of an installed file.
|
---|
200 | # @param $1 The file to install.
|
---|
201 | # @param $2 The target name.
|
---|
202 | # @param $3 The _INST value (can be empty).
|
---|
203 | # @param $4 The installation root directory.
|
---|
204 | _INSTALL_FILE = $(patsubst %/,%/$(notdir $(1)),$(if $(3),$(4)/$(3),$(4)/))
|
---|
205 |
|
---|
206 |
|
---|
207 |
|
---|
208 | include $(KBUILD_PATH)/footer-inherit-uses-tools.kmk
|
---|
209 | include $(KBUILD_PATH)/footer-pass1.kmk
|
---|
210 | include $(KBUILD_PATH)/footer-pass2-fetches.kmk
|
---|
211 | include $(KBUILD_PATH)/footer-pass2-patches.kmk
|
---|
212 | include $(KBUILD_PATH)/footer-pass2-compiling-targets.kmk
|
---|
213 | include $(KBUILD_PATH)/footer-misc.kmk
|
---|
214 | include $(KBUILD_PATH)/footer-passes.kmk
|
---|
215 |
|
---|
216 | #
|
---|
217 | # THE MAIN RULES
|
---|
218 | #
|
---|
219 | all_recursive: $(pass_prev)
|
---|
220 |
|
---|
221 | rebuild: clean
|
---|
222 | + $(MAKE) -f $(firstword $(MAKEFILE_LIST)) all_recursive
|
---|
223 |
|
---|
224 | # @todo make this a non-default pass!
|
---|
225 | uninstall::
|
---|
226 | $(RM) -f -- $(_INSTALLS_FILES)
|
---|
227 |
|
---|
228 | install:: pass_installs
|
---|
229 |
|
---|
230 | # misc shortcuts (use secondary expansion here to save strcache[file] space).
|
---|
231 | targets: bldprogs libraries dlls programs sysmods miscbins others installs
|
---|
232 | objects: $$(_OBJS)
|
---|
233 | bldprogs: $$(_BLDPROGS)
|
---|
234 | libraries: $$(_LIBS) $$(_IMPORT_LIBS) $$(_OTHER_LIBRARIES)
|
---|
235 | dlls: $$(_DLLS)
|
---|
236 | programs: $$(_PROGRAMS)
|
---|
237 | sysmods: $$(_SYSMODS)
|
---|
238 | miscbins: $$(_MISCBINS)
|
---|
239 | others: $$(_OTHERS)
|
---|
240 | stagings: $$(_INSTALLS) $$(_STAGE_DIRS) $$(_STAGE_FILES)
|
---|
241 | installs: $$(_INSTALLS_DIRS) $$(_INSTALLS_FILES)
|
---|
242 |
|
---|
243 |
|
---|
244 |
|
---|
245 | #
|
---|
246 | # kBuild debugging stuff.
|
---|
247 | #
|
---|
248 | ## @todo this doesn't work. Move to a debug unit and expand it.
|
---|
249 | show_targets:
|
---|
250 | @$(foreach target, $(_ALL_TARGETS),\
|
---|
251 | @$(ECHO) "target: $(target)" $(NLTAB)\
|
---|
252 | @$(ECHO) " $(target)_0_OUTDIR=$($(target)_0_OUTDIR)" $(NLTAB)\
|
---|
253 | @$(ECHO) " $(target)_1_TARGET=$($(target)_1_TARGET)" $(NLTAB)\
|
---|
254 | @$(ECHO) " INSTARGET_$(target)=$(INSTARGET_$(target))" $(NLTAB)\
|
---|
255 | $(foreach prop,$(PROPS_SINGLE) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R) 2_OBJS CLEAN, \
|
---|
256 | $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))) \
|
---|
257 | $(if $($(target)_$(prop).$(_tmp)),\
|
---|
258 | @$(ECHO) " $(target)_$(prop).$(_tmp)=$($(target)_$(prop).$(_tmp))" $(NLTAB)) \
|
---|
259 | $(if $($(target)_$(prop)), $(NLTAB)@$(ECHO) " $(target)_$(prop)=$($(target)_$(prop))" $(NLTAB)) \
|
---|
260 | )\
|
---|
261 | $(foreach prop,$(PROPS_DEFERRED), \
|
---|
262 | $(eval _tmp:=$(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))) \
|
---|
263 | $(if $(value $(target)_$(prop).$(_tmp)),\
|
---|
264 | @$(ECHO) ' $(target)_$(prop).$(_tmp)=$(value $(TARGET)_$(prop).$(_tmp))' $(NLTAB)) \
|
---|
265 | $(if $(value $(target)_$(prop)), $(NLTAB)@$(ECHO) ' $(target)_$(prop)=$(value $(target)_$(prop))' $(NLTAB)) \
|
---|
266 | ))
|
---|
267 |
|
---|
268 |
|
---|
269 |
|
---|
270 | #
|
---|
271 | # Include dependency files.
|
---|
272 | #
|
---|
273 | ifdef _DEPFILES
|
---|
274 | # TODO: first works the second doesn't, provided _KB_INCLUDE_DEPS is undefined:
|
---|
275 | # if "$(_KB_INCLUDE_DEPS)" == "1"
|
---|
276 | # if $(_KB_INCLUDE_DEPS) == "1"
|
---|
277 |
|
---|
278 | ifdef KB_HAVE_INCLUDEDEP_QUEUE
|
---|
279 | includedep-queue $(_DEPFILES)
|
---|
280 | else
|
---|
281 | $(foreach dep, $(_DEPFILES), $(eval includedep $(dep)))
|
---|
282 | endif
|
---|
283 | endif
|
---|
284 |
|
---|
285 |
|
---|
286 | ifdef KBUILD_PROFILE_SELF
|
---|
287 | $(evalcall def_profile_self, end of footer.kmk)
|
---|
288 | _KBUILD_TS_FOOTER_END := $(_KBUILD_TS_PREV)
|
---|
289 |
|
---|
290 | ifneq ($(KBUILD_PROFILE_SELF),0)
|
---|
291 | $(info prof: ALL=$(words $(_ALL_TARGETS)) BLDPROGS=$(words $(_ALL_BLDPROGS)) LIBRARIES=$(words $(_ALL_LIBRARIES)) IMPORT_LIBS=$(words $(IMPORT_LIBS)) DLLS=$(words $(DLLS)) PROGRAMS=$(words $(_ALL_PROGRAMS)) )
|
---|
292 | $(info prof: SYSMODS=$(words $(_ALL_SYSMODS)) MISCBINS=$(words $(_ALL_MISCBINS)) OTHERS=$(words $(_ALL_OTHERS)) INSTALLS=$(words $(_ALL_INSTALLS)) FETCHES=$(words $(_ALL_FETCHES)) PACKING=$(words $(_PACKING)) TESTING=$(words $(TESTING)) )
|
---|
293 | $(info prof: DIRS=$(words $(_DIR_ALL)) TOOLS=$(words $(_TOOLS)) SDKS=$(words $(_SDKS)) USES=$(words $(_USES)) OUT_FILES=$(words $(_OUT_FILES)) OBJS=$(words $(_OBJS)) CLEAN_FILES=$(words $(CLEAN_FILES) $(OTHER_CLEAN)) )
|
---|
294 | $(info prof: DEPFILES_INCLUDED=$(words $(_DEPFILES_INCLUDED)) DEPFILES=$(words $(_DEPFILES)) MAKEFILES=$(words $(MAKEFILE_LIST)) )
|
---|
295 | endif
|
---|
296 | endif
|
---|
297 |
|
---|
298 |
|
---|
299 | # end-of-file-content
|
---|
300 | __footer_kmk__ := target
|
---|
301 | endif # !defined(__footer_kmk__)
|
---|
302 |
|
---|