1 | # $Id: header.kmk 2237 2009-01-09 03:02:49Z bird $
|
---|
2 | ## @file
|
---|
3 | # kBuild - File included at top of a makefile.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (c) 2004-2009 knut st. osmundsen <bird-kBuild-spam@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 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 | # 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 __header_kmk__
|
---|
35 | # start-of-file-content
|
---|
36 | ifdef KBUILD_PROFILE_SELF
|
---|
37 | _KBUILD_TS_HEADER_START := $(nanots ) # just a dummy warm up query
|
---|
38 | $(info prof: since start - since previous -- event description)
|
---|
39 | ifeq ($(KBUILD_PROFILE_SELF),2)
|
---|
40 | $(info stat: $(make-stats ))
|
---|
41 | endif
|
---|
42 | _KBUILD_TS_HEADER_START := $(nanots )
|
---|
43 | _KBUILD_TS_PREV := $(_KBUILD_TS_HEADER_START)
|
---|
44 |
|
---|
45 | _KBUILD_FMT_ELAPSED_EX = $(int-div $(int-add $(int-sub $1, $2),500000),1000000)ms
|
---|
46 | _KBUILD_FMT_ELAPSED = $(call _KBUILD_FMT_ELAPSED_EX,$(_KBUILD_TS_NOW),$1)
|
---|
47 |
|
---|
48 | define def_profile_self
|
---|
49 | _KBUILD_TS_NOW := $(nanots )
|
---|
50 | $(info prof: $(call _KBUILD_FMT_ELAPSED,$(_KBUILD_TS_HEADER_START)) - $(call _KBUILD_FMT_ELAPSED, $(_KBUILD_TS_PREV)) -- $(strip $1))
|
---|
51 | ifeq ($(KBUILD_PROFILE_SELF),2)
|
---|
52 | $(info stat: $(make-stats ))
|
---|
53 | endif
|
---|
54 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
|
---|
55 | endef
|
---|
56 |
|
---|
57 | endif
|
---|
58 |
|
---|
59 |
|
---|
60 | #
|
---|
61 | # Check make version before we do anything else.
|
---|
62 | #
|
---|
63 | ifndef KMK_VERSION
|
---|
64 | $(error kBuild: The kmk default variable KMK_VERSION isn't defined! Make sure you are using 'kmk' and not 'make', 'gmake', 'kmk_gmake', 'dmake' or any other make program)
|
---|
65 | endif
|
---|
66 | ifneq ($(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR),0.1)
|
---|
67 | ifneq ($(KBUILD_VERSION_MAJOR),0)
|
---|
68 | $(warning kBuild: kmk major version mismatch! Expected '0' but found '$(KBUILD_VERSION_MAJOR)'!)
|
---|
69 | else
|
---|
70 | $(warning kBuild: kmk minor version mismatch! Expected '1' but found '$(KBUILD_VERSION_MINOR)'!)
|
---|
71 | endif
|
---|
72 | else
|
---|
73 | ifneq ($(int-ge $(KBUILD_VERSION_PATCH),4),1)
|
---|
74 | $(warning kBuild: kmk version mismatch! Expected 0.1.4 or later. Actual version is $(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR).$(KBUILD_VERSION_PATCH).)
|
---|
75 | endif
|
---|
76 | endif
|
---|
77 |
|
---|
78 | #
|
---|
79 | # The revision in which this file was last modified.
|
---|
80 | # This can be useful when using development versions of kBuild.
|
---|
81 | #
|
---|
82 | KMK_REVISION := $(patsubst %:,, $Rev: 2237 $ )
|
---|
83 |
|
---|
84 |
|
---|
85 | #
|
---|
86 | # Define the default goal.
|
---|
87 | #
|
---|
88 | .PHONY: all all_recursive
|
---|
89 | all: all_recursive
|
---|
90 |
|
---|
91 | #
|
---|
92 | # The phony FORCE target.
|
---|
93 | #
|
---|
94 | .PHONY: FORCE
|
---|
95 | FORCE:
|
---|
96 |
|
---|
97 |
|
---|
98 | #
|
---|
99 | # Enable delete on error and second expansion of prerequisites and targets.
|
---|
100 | #
|
---|
101 | .DELETE_ON_ERROR:
|
---|
102 |
|
---|
103 | .SECONDEXPANSION:
|
---|
104 |
|
---|
105 | .SECONDTARGETEXPANSION:
|
---|
106 |
|
---|
107 |
|
---|
108 | #
|
---|
109 | # General purpose macros.
|
---|
110 | #
|
---|
111 |
|
---|
112 | ##
|
---|
113 | # Newline character(s).
|
---|
114 | define NL
|
---|
115 |
|
---|
116 |
|
---|
117 | endef
|
---|
118 |
|
---|
119 | ##
|
---|
120 | # Tab character.
|
---|
121 | TAB := $(subst ., ,.)
|
---|
122 |
|
---|
123 | ##
|
---|
124 | # Newline + tab characters (for generating commands).
|
---|
125 | NLTAB = $(NL)$(TAB)
|
---|
126 |
|
---|
127 | ##
|
---|
128 | # Space character.
|
---|
129 | SP := $(subst ., ,.)
|
---|
130 |
|
---|
131 | ##
|
---|
132 | # Hash character.
|
---|
133 | define HASH
|
---|
134 | #
|
---|
135 | endef
|
---|
136 |
|
---|
137 | ##
|
---|
138 | # Colon character.
|
---|
139 | COLON := :
|
---|
140 |
|
---|
141 | ##
|
---|
142 | # Semicolon character.
|
---|
143 | SEMICOLON := ;
|
---|
144 |
|
---|
145 | ##
|
---|
146 | # Comma character.
|
---|
147 | COMMA := ,
|
---|
148 |
|
---|
149 | ##
|
---|
150 | # Dot character.
|
---|
151 | DOT := .
|
---|
152 |
|
---|
153 | ##
|
---|
154 | # Dollar character.
|
---|
155 | DOLLAR := $$
|
---|
156 |
|
---|
157 | ##
|
---|
158 | # Equal character.
|
---|
159 | EQUAL := =
|
---|
160 |
|
---|
161 |
|
---|
162 | #
|
---|
163 | # The list of standard build types in kBuild.
|
---|
164 | #
|
---|
165 | # This list can be extended in Config.kmk and it's possible to extend
|
---|
166 | # (inherit) another build type.
|
---|
167 | #
|
---|
168 | KBUILD_BLD_TYPES := release profile debug
|
---|
169 |
|
---|
170 |
|
---|
171 | #
|
---|
172 | # The OSes, Architectures and CPUs that kBuild recognizes.
|
---|
173 | #
|
---|
174 | # When kBuild is ported to a new OS or architecture a unique keyword needs
|
---|
175 | # to be assigned to it and added here. This strictness is required because
|
---|
176 | # this keyword namespace is shared between OSes, architectures, cpus and
|
---|
177 | # build types. (PORTME)
|
---|
178 | #
|
---|
179 | KBUILD_OSES := darwin dos dragonfly freebsd l4 linux netbsd nt openbsd os2 solaris win os-agnostic
|
---|
180 | KBUILD_ARCHES := x86 amd64 sparc32 sparc64 s390 s390x ppc32 ppc64 mips32 mips64 ia64 hppa32 hppa64 arm alpha
|
---|
181 |
|
---|
182 |
|
---|
183 | #
|
---|
184 | # Set default build type.
|
---|
185 | #
|
---|
186 | ifndef KBUILD_TYPE
|
---|
187 | ifdef BUILD_TYPE
|
---|
188 | KBUILD_TYPE := $(BUILD_TYPE)
|
---|
189 | endif
|
---|
190 | else ifdef BUILD_TYPE
|
---|
191 | ifneq ($(KBUILD_TYPE),$(BUILD_TYPE))
|
---|
192 | ifeq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),environment:command line)
|
---|
193 | KBUILD_TYPE := $(BUILD_TYPE)
|
---|
194 | else ifneq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),command line:environment)
|
---|
195 | $(error kBuild: KBUILD_TYPE and BUILD_TYPE disagree.)
|
---|
196 | endif
|
---|
197 | endif
|
---|
198 | endif
|
---|
199 | override BUILD_TYPE = $(KBUILD_TYPE)
|
---|
200 |
|
---|
201 | ifndef KBUILD_TYPE
|
---|
202 | KBUILD_TYPE := release
|
---|
203 | else
|
---|
204 | if1of ($(KBUILD_TYPE), $(KBUILD_OSES) $(KBUILD_ARCHES))
|
---|
205 | $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' is an OS or architecture!)
|
---|
206 | endif
|
---|
207 | ifneq (.$(words $(KBUILD_TYPE)).$(KBUILD_TYPE).,.1.$(strip $(KBUILD_TYPE)).)
|
---|
208 | $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' contains spaces/tabs!)
|
---|
209 | endif
|
---|
210 | endif
|
---|
211 |
|
---|
212 |
|
---|
213 | #
|
---|
214 | # Host platform legacy
|
---|
215 | # kmk deals with this, so this is only temporary until I've rebuilt everything.
|
---|
216 | #
|
---|
217 | ifndef KBUILD_HOST
|
---|
218 | KBUILD_HOST := $(BUILD_PLATFORM)
|
---|
219 | endif
|
---|
220 | ifndef KBUILD_HOST_ARCH
|
---|
221 | KBUILD_HOST_ARCH := $(BUILD_PLATFORM_ARCH)
|
---|
222 | endif
|
---|
223 | ifndef KBUILD_HOST_CPU
|
---|
224 | KBUILD_HOST_CPU := $(BUILD_PLATFORM_CPU)
|
---|
225 | endif
|
---|
226 |
|
---|
227 |
|
---|
228 | #
|
---|
229 | # Assert valid build platform variables.
|
---|
230 | #
|
---|
231 | # All these are set by kmk so they shouldn't be any trouble
|
---|
232 | # unless the user starts messing about with environment variables.
|
---|
233 | #
|
---|
234 | ifneq (.$(words $(KBUILD_HOST)).$(KBUILD_HOST).,.1.$(strip $(KBUILD_HOST)).)
|
---|
235 | $(error kBuild: The KBUILD_HOST value '$(KBUILD_HOST)' contains spaces/tabs!)
|
---|
236 | endif
|
---|
237 | ifneq ($(words $(filter $(KBUILD_HOST),$(KBUILD_OSES))),1)
|
---|
238 | $(error kBuild: KBUILD_HOST value '$(KBUILD_HOST)' is not recognized (valid: $(KBUILD_OSES)))
|
---|
239 | endif
|
---|
240 |
|
---|
241 | ifneq (.$(words $(KBUILD_HOST_ARCH)).$(KBUILD_HOST_ARCH).,.1.$(strip $(KBUILD_HOST_ARCH)).)
|
---|
242 | $(error kBuild: The KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' contains spaces/tabs!)
|
---|
243 | endif
|
---|
244 | ifneq ($(words $(filter $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES))),1)
|
---|
245 | $(error kBuild: KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
|
---|
246 | endif
|
---|
247 |
|
---|
248 | ifeq ($(strip $(KBUILD_HOST_CPU)),)
|
---|
249 | KBUILD_HOST_CPU := blend
|
---|
250 | else
|
---|
251 | ifneq (.$(words $(KBUILD_HOST_CPU)).$(KBUILD_HOST_CPU).,.1.$(strip $(KBUILD_HOST_CPU)).)
|
---|
252 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' contains spaces/tabs!)
|
---|
253 | endif
|
---|
254 | if1of ($(KBUILD_HOST_CPU), $(KBUILD_OSES) $(BUILD_ARCHES))
|
---|
255 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' was found in the OS or architecture keywords!)
|
---|
256 | endif
|
---|
257 | ifeq ($(KBUILD_HOST_CPU),$(KBUILD_TYPE))
|
---|
258 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' is the same as the KBUILD_TYPE!)
|
---|
259 | endif
|
---|
260 | endif
|
---|
261 |
|
---|
262 |
|
---|
263 | #
|
---|
264 | # Deal with target platform legacy.
|
---|
265 | #
|
---|
266 | ifndef KBUILD_TARGET
|
---|
267 | ifdef BUILD_TARGET
|
---|
268 | KBUILD_TARGET := $(BUILD_TARGET)
|
---|
269 | endif
|
---|
270 | else ifdef BUILD_TARGET
|
---|
271 | ifneq ($(KBUILD_TARGET),$(BUILD_TARGET))
|
---|
272 | ifeq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),environment:command line)
|
---|
273 | KBUILD_TARGET := $(BUILD_TARGET)
|
---|
274 | else ifneq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),command line:environment)
|
---|
275 | $(error kBuild: KBUILD_TARGET and BUILD_TARGET disagree)
|
---|
276 | endif
|
---|
277 | endif
|
---|
278 | endif
|
---|
279 | override BUILD_TARGET = $(KBUILD_TARGET)
|
---|
280 |
|
---|
281 | ifndef KBUILD_TARGET_ARCH
|
---|
282 | ifdef BUILD_TARGET_ARCH
|
---|
283 | KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
|
---|
284 | endif
|
---|
285 | else ifdef BUILD_TARGET_ARCH
|
---|
286 | ifneq ($(KBUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH))
|
---|
287 | ifeq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),environment:command line)
|
---|
288 | KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
|
---|
289 | else ifneq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),command line:environment)
|
---|
290 | $(error kBuild: KBUILD_TARGET_ARCH and BUILD_TARGET_ARCH disagree)
|
---|
291 | endif
|
---|
292 | endif
|
---|
293 | endif
|
---|
294 | override BUILD_TARGET_ARCH = $(KBUILD_TARGET_ARCH)
|
---|
295 |
|
---|
296 | ifndef KBUILD_TARGET_CPU
|
---|
297 | ifdef BUILD_TARGET_CPU
|
---|
298 | KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
|
---|
299 | endif
|
---|
300 | else ifdef BUILD_TARGET_CPU
|
---|
301 | ifneq ($(KBUILD_TARGET_CPU),$(BUILD_TARGET_CPU))
|
---|
302 | ifeq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),environment:command line)
|
---|
303 | KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
|
---|
304 | else ifneq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),command line:environment)
|
---|
305 | $(error kBuild: KBUILD_TARGET_CPU and BUILD_TARGET_CPU disagree)
|
---|
306 | endif
|
---|
307 | endif
|
---|
308 | endif
|
---|
309 | override BUILD_TARGET_CPU = $(KBUILD_TARGET_CPU)
|
---|
310 |
|
---|
311 |
|
---|
312 | #
|
---|
313 | # Assert or set default target platform.
|
---|
314 | # When not defined use the corresponding KBUILD_HOST value.
|
---|
315 | #
|
---|
316 | ifndef KBUILD_TARGET
|
---|
317 | KBUILD_TARGET := $(KBUILD_HOST)
|
---|
318 | else
|
---|
319 | ifneq (.$(words $(KBUILD_TARGET)).$(KBUILD_TARGET).,.1.$(strip $(KBUILD_TARGET)).)
|
---|
320 | $(error kBuild: The KBUILD_TARGET value '$(KBUILD_TARGET)' contains spaces/tabs!)
|
---|
321 | endif
|
---|
322 | ifneq ($(words $(filter $(KBUILD_TARGET),$(KBUILD_OSES))),1)
|
---|
323 | $(error kBuild: KBUILD_TARGET value '$(KBUILD_TARGET)' is not recognized (valid: $(KBUILD_OSES)))
|
---|
324 | endif
|
---|
325 | endif
|
---|
326 |
|
---|
327 | ifndef KBUILD_TARGET_ARCH
|
---|
328 | KBUILD_TARGET_ARCH := $(KBUILD_HOST_ARCH)
|
---|
329 | else
|
---|
330 | ifneq (.$(words $(KBUILD_TARGET_ARCH)).$(KBUILD_TARGET_ARCH).,.1.$(strip $(KBUILD_TARGET_ARCH)).)
|
---|
331 | $(error kBuild: The KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' contains spaces/tabs!)
|
---|
332 | endif
|
---|
333 | ifneq ($(words $(filter $(KBUILD_TARGET_ARCH),$(KBUILD_ARCHES))),1)
|
---|
334 | $(error kBuild: KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
|
---|
335 | endif
|
---|
336 | endif
|
---|
337 |
|
---|
338 | ifndef KBUILD_TARGET_CPU
|
---|
339 | KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
|
---|
340 | else ifeq ($(strip $(KBUILD_TARGET_CPU)),)
|
---|
341 | ifeq ($(KBUILD_TARGET_ARCH),$(KBUILD_HOST_ARCH))
|
---|
342 | KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
|
---|
343 | else
|
---|
344 | KBUILD_TARGET_CPU := blend
|
---|
345 | endif
|
---|
346 | else
|
---|
347 | ifneq (.$(words $(KBUILD_TARGET_CPU)).$(KBUILD_TARGET_CPU).,.1.$(strip $(KBUILD_TARGET_CPU)).)
|
---|
348 | $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' contains spaces/tabs!)
|
---|
349 | endif
|
---|
350 | if1of ($(KBUILD_TARGET_CPU), $(KBUILD_OSES) $(BUILD_ARCHES))
|
---|
351 | $(error kBuild: The KBUILD_TARGET_CPU value was found in the OS or architecture keywords!)
|
---|
352 | endif
|
---|
353 | ifeq ($(KBUILD_TARGET_CPU),$(KBUILD_TYPE))
|
---|
354 | $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' is the same as the KBUILD_TYPE!)
|
---|
355 | endif
|
---|
356 | endif
|
---|
357 |
|
---|
358 |
|
---|
359 | #
|
---|
360 | # Paths and stuff.
|
---|
361 | #
|
---|
362 |
|
---|
363 | # Adjust DEPTH first.
|
---|
364 | DEPTH := $(strip $(DEPTH))
|
---|
365 | ifeq ($(DEPTH),)
|
---|
366 | DEPTH := .
|
---|
367 | endif
|
---|
368 |
|
---|
369 | ## PATH_CURRENT is the current directory (getcwd).
|
---|
370 | PATH_CURRENT := $(abspath $(CURDIR))
|
---|
371 | ## PATH_SUB_CURRENT points to current directory of the current makefile.
|
---|
372 | # Meaning that it will change value as we enter and exit sub-makefiles.
|
---|
373 | PATH_SUB_CURRENT := $(PATH_CURRENT)
|
---|
374 | ## PATH_ROOT points to the project root directory.
|
---|
375 | PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
|
---|
376 | ## PATH_SUB_ROOT points to the directory of the top-level makefile.
|
---|
377 | ifneq ($(strip $(SUB_DEPTH)),)
|
---|
378 | SUB_DEPTH := $(strip $(SUB_DEPTH))
|
---|
379 | PATH_SUB_ROOT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
|
---|
380 | else
|
---|
381 | PATH_SUB_ROOT := $(PATH_CURRENT)
|
---|
382 | endif
|
---|
383 |
|
---|
384 | ## CURSUBDIR is PATH_SUB_ROOT described relative to PATH_ROOT.
|
---|
385 | # This variable is used to determin where the object files and other output goes.
|
---|
386 | ifneq ($(PATH_ROOT),$(PATH_SUB_ROOT))
|
---|
387 | CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_ROOT))
|
---|
388 | else
|
---|
389 | CURSUBDIR := .
|
---|
390 | endif
|
---|
391 |
|
---|
392 | # Output directories.
|
---|
393 | ifndef PATH_OUT_BASE
|
---|
394 | PATH_OUT_BASE := $(PATH_ROOT)/out
|
---|
395 | endif
|
---|
396 | ifndef PATH_OUT
|
---|
397 | ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places - obsolete)
|
---|
398 | PATH_OUT = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(KBUILD_TYPE)
|
---|
399 | else
|
---|
400 | PATH_OUT = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/$(KBUILD_TYPE)
|
---|
401 | endif
|
---|
402 | endif # !define PATH_OUT
|
---|
403 | PATH_OBJCACHE = $(PATH_OUT_BASE)/kObjCache
|
---|
404 | PATH_OBJ = $(PATH_OUT)/obj
|
---|
405 | PATH_TARGET = $(PATH_OBJ)/$(CURSUBDIR)
|
---|
406 | PATH_INS = $(PATH_OUT)
|
---|
407 | PATH_BIN = $(PATH_INS)/bin
|
---|
408 | PATH_DLL = $(PATH_INS)/bin
|
---|
409 | PATH_SYS = $(PATH_INS)/bin
|
---|
410 | PATH_LIB = $(PATH_INS)/lib
|
---|
411 | PATH_DOC = $(PATH_INS)/doc
|
---|
412 |
|
---|
413 | # KBUILD_PATH / PATH_KBUILD is determined by kmk.
|
---|
414 | ifndef KBUILD_PATH
|
---|
415 | KBUILD_PATH := $(PATH_KBUILD)
|
---|
416 | endif
|
---|
417 | ifeq ($(strip $(KBUILD_PATH)),)
|
---|
418 | $(error kBuild: KBUILD_PATH is missing or empty! kmk is supposed to set it.)
|
---|
419 | endif
|
---|
420 | # KBUILD_BIN_PATH / PATH_KBUILD_BIN is determined by kmk.
|
---|
421 | ifndef KBUILD_BIN_PATH
|
---|
422 | KBUILD_BIN_PATH := $(PATH_KBUILD_BIN)
|
---|
423 | endif
|
---|
424 | ifeq ($(strip $(KBUILD_BIN_PATH)),)
|
---|
425 | $(error kBuild: KBUILD_BIN_PATH is missing or empty! kmk is supposed to set it.)
|
---|
426 | endif
|
---|
427 |
|
---|
428 | # kBuild files which might be of interest.
|
---|
429 | FILE_KBUILD_HEADER := $(KBUILD_PATH)/header.kmk
|
---|
430 | #FILE_KBUILD_CONFIG := $(KBUILD_PATH)/config.kmk
|
---|
431 | FILE_KBUILD_FOOTER := $(KBUILD_PATH)/footer.kmk
|
---|
432 | FILE_KBUILD_SUB_HEADER := $(KBUILD_PATH)/subheader.kmk
|
---|
433 | FILE_KBUILD_SUB_FOOTER := $(KBUILD_PATH)/subfooter.kmk
|
---|
434 |
|
---|
435 | ## MAKEFILE is the name of the main makefile.
|
---|
436 | MAKEFILE := $(firstword $(MAKEFILE_LIST))
|
---|
437 | ## MAKEFILE_CURRENT is the name of the current makefile.
|
---|
438 | # This is updated everything a sub-makefile is included.
|
---|
439 | MAKEFILE_CURRENT := $(MAKEFILE)
|
---|
440 |
|
---|
441 |
|
---|
442 | ## @todo this should be done via SUFF_XYZ.target/host...
|
---|
443 |
|
---|
444 | #
|
---|
445 | # Build platform setup.
|
---|
446 | # (PORTME)
|
---|
447 | #
|
---|
448 | if1of ($(KBUILD_HOST), win nt)
|
---|
449 | # Win, Win32, Win64, NT.
|
---|
450 | EXEC_X86_WIN32 :=
|
---|
451 | HOSTSUFF_EXE := .exe
|
---|
452 |
|
---|
453 | # OS/2.
|
---|
454 | else ifeq ($(KBUILD_HOST),os2)
|
---|
455 | EXEC_X86_WIN32 := innopec.exe
|
---|
456 | HOSTSUFF_EXE := .exe
|
---|
457 |
|
---|
458 | else if1of ($(KBUILD_HOST), freebsd dragonfly linux openbsd netbsd)
|
---|
459 | # Unix (like) systems with wine.
|
---|
460 | EXEC_X86_WIN32 := wine
|
---|
461 | HOSTSUFF_EXE :=
|
---|
462 |
|
---|
463 | else
|
---|
464 | # Unix (like) systems without wine.
|
---|
465 | EXEC_X86_WIN32 := false
|
---|
466 | HOSTSUFF_EXE :=
|
---|
467 | endif
|
---|
468 |
|
---|
469 |
|
---|
470 | #
|
---|
471 | # Build target setup.
|
---|
472 | # (PORTME)
|
---|
473 | #
|
---|
474 | SUFF_DEP := .dep
|
---|
475 | SUFF_BIN :=
|
---|
476 | if1of ($(KBUILD_TARGET), win nt os2)
|
---|
477 | SUFF_OBJ := .obj
|
---|
478 | SUFF_LIB := .lib
|
---|
479 | SUFF_DLL := .dll
|
---|
480 | SUFF_EXE := .exe
|
---|
481 | SUFF_SYS := .sys
|
---|
482 | SUFF_RES := .res
|
---|
483 | else ifeq ($(KBUILD_TARGET),l4)
|
---|
484 | SUFF_OBJ := .o
|
---|
485 | SUFF_LIB := .a
|
---|
486 | SUFF_DLL := .s.so
|
---|
487 | SUFF_EXE :=
|
---|
488 | SUFF_SYS := .a
|
---|
489 | SUFF_RES :=
|
---|
490 | else ifeq ($(KBUILD_TARGET),darwin)
|
---|
491 | SUFF_OBJ := .o
|
---|
492 | SUFF_LIB := .a
|
---|
493 | SUFF_DLL := .dylib
|
---|
494 | SUFF_EXE :=
|
---|
495 | SUFF_SYS :=
|
---|
496 | SUFF_RES :=
|
---|
497 | else
|
---|
498 | SUFF_OBJ := .o
|
---|
499 | SUFF_LIB := .a
|
---|
500 | SUFF_DLL := .so
|
---|
501 | SUFF_EXE :=
|
---|
502 | if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd) ## @todo check netbsd and openbsd.
|
---|
503 | SUFF_SYS := .ko
|
---|
504 | else
|
---|
505 | SUFF_SYS :=
|
---|
506 | endif
|
---|
507 | SUFF_RES :=
|
---|
508 | endif
|
---|
509 |
|
---|
510 | #
|
---|
511 | # Standard kBuild tools.
|
---|
512 | #
|
---|
513 | ifeq ($(KMK),kmk)
|
---|
514 | KMK := $(KBUILD_BIN_PATH)/kmk$(HOSTSUFF_EXE)
|
---|
515 | endif
|
---|
516 | MAKE := $(KMK)
|
---|
517 |
|
---|
518 | GMAKE := $(KBUILD_BIN_PATH)/kmk_gmake$(HOSTSUFF_EXE)
|
---|
519 |
|
---|
520 | #DEP_EXT := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
|
---|
521 | #DEP_INT := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
|
---|
522 | #DEP := $(DEP_INT)
|
---|
523 |
|
---|
524 | DEP_IDB_EXT := $(KBUILD_BIN_PATH)/kDepIDB$(HOSTSUFF_EXE)
|
---|
525 | DEP_IDB_INT := kmk_builtin_kDepIDB
|
---|
526 | DEP_IDB := $(DEP_IDB_INT)
|
---|
527 |
|
---|
528 | DEP_PRE := $(KBUILD_BIN_PATH)/kDepPre$(HOSTSUFF_EXE)
|
---|
529 |
|
---|
530 | KOBJCACHE_EXT := $(KBUILD_BIN_PATH)/kObjCache$(HOSTSUFF_EXE)
|
---|
531 | KOBJCACHE := $(KOBJCACHE_EXT)
|
---|
532 |
|
---|
533 | APPEND_EXT := $(KBUILD_BIN_PATH)/kmk_append$(HOSTSUFF_EXE)
|
---|
534 | APPEND_INT := kmk_builtin_append
|
---|
535 | APPEND := $(APPEND_INT)
|
---|
536 |
|
---|
537 | CAT_EXT := $(KBUILD_BIN_PATH)/kmk_cat$(HOSTSUFF_EXE)
|
---|
538 | CAT_INT := kmk_builtin_cat
|
---|
539 | CAT := $(CAT_INT)
|
---|
540 |
|
---|
541 | CHMOD_EXT := $(KBUILD_BIN_PATH)/kmk_chmod$(HOSTSUFF_EXE)
|
---|
542 | CHMOD_INT := kmk_builtin_chmod
|
---|
543 | CHMOD := $(CHMOD_INT)
|
---|
544 |
|
---|
545 | CMP_EXT := $(KBUILD_BIN_PATH)/kmk_cmp$(HOSTSUFF_EXE)
|
---|
546 | CMP_INT := kmk_builtin_cmp
|
---|
547 | CMP := $(CMP_INT)
|
---|
548 |
|
---|
549 | CP_EXT := $(KBUILD_BIN_PATH)/kmk_cp$(HOSTSUFF_EXE)
|
---|
550 | CP_INT := kmk_builtin_cp
|
---|
551 | CP := $(CP_INT)
|
---|
552 |
|
---|
553 | ECHO_EXT := $(KBUILD_BIN_PATH)/kmk_echo$(HOSTSUFF_EXE)
|
---|
554 | ECHO_INT := kmk_builtin_echo
|
---|
555 | ECHO := $(ECHO_INT)
|
---|
556 |
|
---|
557 | EXPR_EXT := $(KBUILD_BIN_PATH)/kmk_expr$(HOSTSUFF_EXE)
|
---|
558 | EXPR_INT := kmk_builtin_expr
|
---|
559 | EXPR := $(EXPR_INT)
|
---|
560 |
|
---|
561 | INSTALL_EXT := $(KBUILD_BIN_PATH)/kmk_install$(HOSTSUFF_EXE)
|
---|
562 | INSTALL_INT := kmk_builtin_install
|
---|
563 | INSTALL := $(INSTALL_INT)
|
---|
564 |
|
---|
565 | LN_EXT := $(KBUILD_BIN_PATH)/kmk_ln$(HOSTSUFF_EXE)
|
---|
566 | LN_INT := kmk_builtin_ln
|
---|
567 | LN := $(LN_INT)
|
---|
568 |
|
---|
569 | MD5SUM_EXT := $(KBUILD_BIN_PATH)/kmk_md5sum$(HOSTSUFF_EXE)
|
---|
570 | MD5SUM_INT := kmk_builtin_md5sum
|
---|
571 | MD5SUM := $(MD5SUM_INT)
|
---|
572 |
|
---|
573 | MKDIR_EXT := $(KBUILD_BIN_PATH)/kmk_mkdir$(HOSTSUFF_EXE)
|
---|
574 | MKDIR_INT := kmk_builtin_mkdir
|
---|
575 | MKDIR := $(MKDIR_INT)
|
---|
576 |
|
---|
577 | MV_EXT := $(KBUILD_BIN_PATH)/kmk_mv$(HOSTSUFF_EXE)
|
---|
578 | MV_INT := kmk_builtin_mv
|
---|
579 | MV := $(MV_INT)
|
---|
580 |
|
---|
581 | PRINTF_EXT := $(KBUILD_BIN_PATH)/kmk_printf$(HOSTSUFF_EXE)
|
---|
582 | PRINTF_INT := kmk_builtin_printf
|
---|
583 | PRINTF := $(PRINTF_INT)
|
---|
584 |
|
---|
585 | REDIRECT_EXT:= $(KBUILD_BIN_PATH)/kmk_redirect$(HOSTSUFF_EXE)
|
---|
586 | REDIRECT_INT:= $(REDIRECT_EXT)
|
---|
587 | REDIRECT := $(REDIRECT_INT)
|
---|
588 |
|
---|
589 | RM_EXT := $(KBUILD_BIN_PATH)/kmk_rm$(HOSTSUFF_EXE)
|
---|
590 | RM_INT := kmk_builtin_rm
|
---|
591 | RM := $(RM_INT)
|
---|
592 |
|
---|
593 | RMDIR_EXT := $(KBUILD_BIN_PATH)/kmk_rmdir$(HOSTSUFF_EXE)
|
---|
594 | RMDIR_INT := kmk_builtin_rmdir
|
---|
595 | RMDIR := $(RMDIR_INT)
|
---|
596 |
|
---|
597 | SED_EXT := $(KBUILD_BIN_PATH)/kmk_sed$(HOSTSUFF_EXE)
|
---|
598 | SED_INT := $(SED_EXT)
|
---|
599 | SED := $(SED_EXT)
|
---|
600 |
|
---|
601 | SLEEP_INT := kmk_builtin_sleep
|
---|
602 | SLEEP_EXT := $(KBUILD_BIN_PATH)/kmk_sleep$(HOSTSUFF_EXE)
|
---|
603 | SLEEP := $(SLEEP_EXT)
|
---|
604 |
|
---|
605 | TEST_EXT := $(KBUILD_BIN_PATH)/kmk_test$(HOSTSUFF_EXE)
|
---|
606 | TEST_INT := kmk_builtin_test
|
---|
607 | TEST := $(TEST_INT)
|
---|
608 |
|
---|
609 | TIME_EXT := $(KBUILD_BIN_PATH)/kmk_time$(HOSTSUFF_EXE)
|
---|
610 | TIME_INT := $(TIME_EXT)
|
---|
611 | TIME := $(TIME_INT)
|
---|
612 |
|
---|
613 | # Our default shell is the Almquist shell from *BSD.
|
---|
614 | ASH := $(KBUILD_BIN_PATH)/kmk_ash$(HOSTSUFF_EXE)
|
---|
615 | MAKESHELL := $(ASH)
|
---|
616 | SHELL := $(ASH)
|
---|
617 | export SHELL MAKESHELL
|
---|
618 |
|
---|
619 | # Symlinking is problematic on some platforms...
|
---|
620 | LN_SYMLINK := $(LN) -s
|
---|
621 |
|
---|
622 |
|
---|
623 | #
|
---|
624 | # Some Functions.
|
---|
625 | # The lower cased ones are either fallbacks or candidates for functions.c.
|
---|
626 | #
|
---|
627 |
|
---|
628 | ## ABSPATH - make paths absolute.
|
---|
629 | # This implementation is clumsy and doesn't resolve '..' and '.' components.
|
---|
630 | #
|
---|
631 | # @param $1 The paths to make absolute.
|
---|
632 | # @obsolete Use the GNU make function $(abspath) directly now.
|
---|
633 | ABSPATH = $(abspath $(1))$(warning ABSPATH is deprecated, use abspath directly!)
|
---|
634 |
|
---|
635 | ## DIRDEP - make create directory dependencies.
|
---|
636 | #
|
---|
637 | # @param $1 The paths to the directories which must be created.
|
---|
638 | DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
|
---|
639 |
|
---|
640 | ## Cygwin kludge.
|
---|
641 | # This converts /cygdrive/x/% to x:%.
|
---|
642 | #
|
---|
643 | # @param $1 The paths to make native.
|
---|
644 | # @remark This macro is pretty much obsolete since we don't use cygwin base make.
|
---|
645 | ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
|
---|
646 | CYGPATHMIXED = $(foreach path,$(1)\
|
---|
647 | ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
|
---|
648 | else
|
---|
649 | CYGPATHMIXED = $(1)
|
---|
650 | endif
|
---|
651 |
|
---|
652 | ## Removes the drive letter from a path (if it has one)
|
---|
653 | # @param $1 the path
|
---|
654 | no-drive = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
|
---|
655 |
|
---|
656 | ## Removes the root slash from a path (if it has one)
|
---|
657 | # @param $1 the path
|
---|
658 | no-root-slash = $(patsubst /%,%,$(1))
|
---|
659 |
|
---|
660 | ## Figure out where to put object files.
|
---|
661 | # @param $1 real target name.
|
---|
662 | # @param $2 normalized main target
|
---|
663 | TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(1)))
|
---|
664 |
|
---|
665 | ## Figure out where to put object files.
|
---|
666 | # @param $1 normalized main target
|
---|
667 | TARGET_PATH = $(PATH_TARGET)/$(1)
|
---|
668 |
|
---|
669 | ##
|
---|
670 | # Checks if the specified short option ($1) is found in the flags ($2),
|
---|
671 | # assuming getopt style options.
|
---|
672 | #
|
---|
673 | # @returns $3 if present, $4 not.
|
---|
674 | #
|
---|
675 | # @param $1 The option (single char!).
|
---|
676 | # @param $2 The option arguments.
|
---|
677 | # @param $3 Eval and return if present.
|
---|
678 | # @param $4 Eval and return if not present.
|
---|
679 | #
|
---|
680 | # @todo May confuse option values starting with '-' for options.
|
---|
681 | # @remarks Invoke like this: $(evalcall KB_FN_OPT_TEST_SHORT,d,$(flags),present,not-present)
|
---|
682 | #
|
---|
683 | define KB_FN_OPT_TEST_SHORT
|
---|
684 | local options := $(translate $(strip $(filter -%,$(filter-out --%,$2))),$(SP)-,)
|
---|
685 | local .RETURN := $(if-expr $(pos $1,$(options)) != 0,$3,$4)
|
---|
686 | endef
|
---|
687 |
|
---|
688 | ##
|
---|
689 | # Checks if the specified long option ($1) is found in the flags ($2),
|
---|
690 | # assuming getopt style options.
|
---|
691 | #
|
---|
692 | # @returns $3 if present, $4 not.
|
---|
693 | #
|
---|
694 | # @param $1 The long option, dashes included. No % chars.
|
---|
695 | # @param $2 The option arguments.
|
---|
696 | # @param $3 Eval and return if present.
|
---|
697 | # @param $4 Eval and return if not present.
|
---|
698 | #
|
---|
699 | # @todo May confuse option values starting with '--' for options.
|
---|
700 | # @remarks Invoke like this: $(evalcall KBFN_OPT_TEST_SHORT,--defined,$(flags),present,not-present)
|
---|
701 | #
|
---|
702 | define KB_FN_OPT_TEST_LONG
|
---|
703 | local options := $(filter-out =delete=%,$(subst :, =delete=,$(subst =, =delete=,$2)))
|
---|
704 | local .RETURN := $(if-expr "$(filter $1,$(options))" != "",$3,$4)
|
---|
705 | endef
|
---|
706 |
|
---|
707 | ##
|
---|
708 | # Checks if the specified short ($1) or long ($2) option is found in the flags ($2),
|
---|
709 | # assuming getopt style options.
|
---|
710 | #
|
---|
711 | # @returns $4 if present, $5 not.
|
---|
712 | #
|
---|
713 | # @param $1 The short option (single char!).
|
---|
714 | # @param $2 The long option, dashes included. No % chars.
|
---|
715 | # @param $3 The option arguments.
|
---|
716 | # @param $4 Eval and return if present.
|
---|
717 | # @param $5 Eval and return if not present.
|
---|
718 | #
|
---|
719 | # @todo May confuse option values starting with '--' for options.
|
---|
720 | # @remarks Invoke like this: $(evalcall KB_FN_OPT_TEST_SHORT_LONG,d,--defined,$(flags),present,not-present)
|
---|
721 | #
|
---|
722 | define KB_FN_OPT_TEST_SHORT_LONG
|
---|
723 | local short_options := $(translate $(strip $(filter -%,$(filter-out --%,$3))),$(SP)-,)
|
---|
724 | local long_options := $(filter-out =delete=%,$(subst :, =delete=,$(subst =, =delete=,$3)))
|
---|
725 | local .RETURN := $(if-expr $(pos $1,$(short_options)) != 0 || "$(filter $2,$(long_options))" != "",$4,$5)
|
---|
726 | endef
|
---|
727 |
|
---|
728 |
|
---|
729 |
|
---|
730 | #
|
---|
731 | # Initialize some of the globals which the Config.kmk and
|
---|
732 | # others can add stuff to if they like for processing in the footer.
|
---|
733 | #
|
---|
734 |
|
---|
735 | ## KBUILD_TEMPLATE_PATHS
|
---|
736 | # List a paths (separated by space) where templates can be found.
|
---|
737 | KBUILD_TEMPLATE_PATHS :=
|
---|
738 |
|
---|
739 | ## KBUILD_TOOL_PATHS
|
---|
740 | # List of paths (separated by space) where tools can be found.
|
---|
741 | KBUILD_TOOL_PATHS :=
|
---|
742 |
|
---|
743 | ## KBUILD_SDK_PATHS
|
---|
744 | # List of paths (separated by space) where SDKs can be found.
|
---|
745 | KBUILD_SDK_PATHS :=
|
---|
746 |
|
---|
747 | ## KBUILD_UNIT_PATHS
|
---|
748 | # List of paths (separated by space) where units (USES) can be found.
|
---|
749 | KBUILD_UNIT_PATHS :=
|
---|
750 |
|
---|
751 | ## KBUILD_DEFAULT_PATHS
|
---|
752 | # List of paths (separated by space) to search for stuff as a last resort.
|
---|
753 | KBUILD_DEFAULT_PATHS :=
|
---|
754 |
|
---|
755 | ## Proritized list of the default makefile when walking subdirectories.
|
---|
756 | # The user can overload this list.
|
---|
757 | DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
|
---|
758 |
|
---|
759 | ## KBUILD_SRC_HANDLERS
|
---|
760 | # The list of source handlers, pair of extension and handler.
|
---|
761 | # The user can overload this list to provide additional or custom
|
---|
762 | # handlers. On a per-target/template see SRC_HANDLERS.
|
---|
763 | KBUILD_SRC_HANDLERS := \
|
---|
764 | .c:def_src_handler_c \
|
---|
765 | .C:def_src_handler_c \
|
---|
766 | .cxx:def_src_handler_cxx \
|
---|
767 | .CXX:def_src_handler_cxx \
|
---|
768 | .cpp:def_src_handler_cxx \
|
---|
769 | .CPP:def_src_handler_cxx \
|
---|
770 | .cc:def_src_handler_cxx \
|
---|
771 | .CC:def_src_handler_cxx \
|
---|
772 | .m:def_src_handler_objc \
|
---|
773 | .asm:def_src_handler_asm \
|
---|
774 | .ASM:def_src_handler_asm \
|
---|
775 | .s:def_src_handler_asm \
|
---|
776 | .S:def_src_handler_asm \
|
---|
777 | .rc:def_src_handler_rc \
|
---|
778 | .obj:def_src_handler_obj \
|
---|
779 | .o:def_src_handler_obj \
|
---|
780 | .res:def_src_handler_obj
|
---|
781 |
|
---|
782 | ## PROPS_TOOLS
|
---|
783 | # This is a subset of PROPS_SINGLE.
|
---|
784 | PROPS_TOOLS := TOOL CTOOL CXXTOOL OBJCTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
|
---|
785 |
|
---|
786 | ## PROPS_SINGLE
|
---|
787 | # The list of non-accumulative target properties.
|
---|
788 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
789 | # will do the necessary inheritance for templates, sdks, tools and targets.
|
---|
790 | PROPS_SINGLE := $(PROPS_TOOLS) TEMPLATE INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
|
---|
791 | OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF BINSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF \
|
---|
792 | MODE UID GID
|
---|
793 | ## PROPS_SINGLE_LNK
|
---|
794 | # Subset of PROPS_SINGLE which applies to all linkable targets.
|
---|
795 | PROPS_SINGLE_LNK := TOOL TEMPLATE CTOOL CXXTOOL OBJCTOOL ASTOOL RCTOOL \
|
---|
796 | INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU \
|
---|
797 | OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF ASOBJSUFF RCOBJSUFF \
|
---|
798 | MODE UID GID
|
---|
799 |
|
---|
800 | ## PROPS_DEFERRED
|
---|
801 | # This list of non-accumulative target properties which are or may be
|
---|
802 | # functions, and thus should not be expanded until the very last moment.
|
---|
803 | PROPS_DEFERRED := INSTFUN INSTALLER PRE_CMDS POST_CMDS NAME SONAME
|
---|
804 |
|
---|
805 | ## PROPS_ACCUMULATE_R
|
---|
806 | # The list of accumulative target properties where the right most value/flag
|
---|
807 | # is the 'most significant'.
|
---|
808 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
809 | # will do the necessary inheritance from templates to targets.
|
---|
810 | PROPS_ACCUMULATE_R := \
|
---|
811 | DEPS LNK_DEPS ORDERDEPS LNK_ORDERDEPS DEFS \
|
---|
812 | ARFLAGS \
|
---|
813 | CFLAGS CDEFS \
|
---|
814 | CXXFLAGS CXXDEFS \
|
---|
815 | OBJCFLAGS OBJCDEFS \
|
---|
816 | ASFLAGS ASDEFS \
|
---|
817 | RCFLAGS RCDEFS \
|
---|
818 | LDFLAGS \
|
---|
819 | IDFLAGS IFDLAGS ISFLAGS \
|
---|
820 | FETCHFLAGS UNPACKFLAGS PATCHFLAGS
|
---|
821 | ## PROPS_ACCUMULATE_R_LNK
|
---|
822 | # Subset of PROPS_ACCUMULATE_R which applies to all linkable targets.
|
---|
823 | PROPS_ACCUMULATE_R_LNK := \
|
---|
824 | DEPS LNK_DEPS ORDERDEPS LNK_ORDERDEPS DEFS \
|
---|
825 | CFLAGS CDEFS \
|
---|
826 | CXXFLAGS CXXDEFS \
|
---|
827 | OBJCFLAGS OBJCDEFS \
|
---|
828 | ASFLAGS ASDEFS \
|
---|
829 | RCFLAGS RCDEFS \
|
---|
830 | IDFLAGS IFDLAGS ISFLAGS
|
---|
831 |
|
---|
832 | ## PROPS_ACCUMULATE
|
---|
833 | # The list of accumulative target properties where the left most value/flag
|
---|
834 | # is the 'most significant'.
|
---|
835 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
836 | # will do the necessary inheritance from templates to targets.
|
---|
837 | PROPS_ACCUMULATE_L := \
|
---|
838 | SDKS USES SOURCES SRC_HANDLERS INTERMEDIATES \
|
---|
839 | INCS CINCS CXXINCS OBJCINCS ASINCS RCINCS \
|
---|
840 | LIBS LIBPATH \
|
---|
841 | DIRS BLDDIRS CLEAN
|
---|
842 | ## PROPS_ACCUMULATE_L_LNK
|
---|
843 | # Subset of PROPS_ACCUMULATE_L which applies to all linkable targets.
|
---|
844 | PROPS_ACCUMULATE_L_LNK := \
|
---|
845 | SDKS SOURCES SRC_HANDLERS \
|
---|
846 | INCS CINCS CXXINCS OBJCINCS ASINCS RCINCS \
|
---|
847 | BLDDIRS CLEAN
|
---|
848 |
|
---|
849 | ## PROPS_ALL
|
---|
850 | # List of all the properties.
|
---|
851 | PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
|
---|
852 |
|
---|
853 |
|
---|
854 | ## @name Properties valid on programs (BLDPROGS and PROGRAMS)
|
---|
855 | ## @{
|
---|
856 | PROPS_PROGRAMS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL EXESUFF
|
---|
857 | PROPS_PROGRAMS_DEFERRED := $(PROPS_DEFERRED)
|
---|
858 | PROPS_PROGRAMS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
859 | PROPS_PROGRAMS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
860 | ## @}
|
---|
861 |
|
---|
862 | ## @name Properties valid on libraries (LIBRARIES and IMPORT_LIBS)
|
---|
863 | ## @{
|
---|
864 | PROPS_LIBRARIES_SINGLE := $(PROPS_SINGLE_LNK) ARTOOL LIBSUFF ARLIBSUFF LIBSUFF
|
---|
865 | PROPS_LIBRARIES_DEFERRED := $(filter-out SONAME,$(PROPS_DEFERRED))
|
---|
866 | PROPS_LIBRARIES_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) ARFLAGS
|
---|
867 | PROPS_LIBRARIES_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK)
|
---|
868 | ## @}
|
---|
869 |
|
---|
870 | ## @name Properties valid on dlls (DLLS)
|
---|
871 | ## @{
|
---|
872 | PROPS_DLLS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL DLLSUFF LIBSUFF
|
---|
873 | PROPS_DLLS_DEFERRED := $(PROPS_DEFERRED)
|
---|
874 | PROPS_DLLS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
875 | PROPS_DLLS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
876 | ## @}
|
---|
877 |
|
---|
878 | ## @name Properties valid on system modules (SYSMODS)
|
---|
879 | ## @{
|
---|
880 | PROPS_SYSMODS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL SYSSUFF
|
---|
881 | PROPS_SYSMODS_DEFERRED := $(PROPS_DEFERRED)
|
---|
882 | PROPS_SYSMODS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
883 | PROPS_SYSMODS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
884 | ## @}
|
---|
885 |
|
---|
886 | ## @name Properties valid on misc binaries (MISCBINS)
|
---|
887 | ## @{
|
---|
888 | PROPS_MISCBINS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL BINSUFF
|
---|
889 | PROPS_MISCBINS_DEFERRED := $(PROPS_DEFERRED)
|
---|
890 | PROPS_MISCBINS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
891 | PROPS_MISCBINS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
892 | ## @}
|
---|
893 |
|
---|
894 | ## @name Properties valid on installs (INSTALLS)
|
---|
895 | ## @{
|
---|
896 | PROPS_INSTALLS_SINGLE := TOOL TEMPLATE INST NOINST
|
---|
897 | PROPS_INSTALLS_DEFERRED := INSTFUN INSTALLER
|
---|
898 | PROPS_INSTALLS_ACCUMULATE_R := DEPS ORDERDEPS
|
---|
899 | PROPS_INSTALLS_ACCUMULATE_L := SOURCES DIRS CLEAN
|
---|
900 | ## @}
|
---|
901 |
|
---|
902 | ## @name Properties valid on fetches (INSTALLS)
|
---|
903 | ## @{
|
---|
904 | PROPS_FETCHES_SINGLE := TOOL TEMPLATE FETCHTOOL UNPACKTOOL PATCHTOOL INST FETCHDIR
|
---|
905 | PROPS_FETCHES_DEFERRED :=
|
---|
906 | PROPS_FETCHES_ACCUMULATE_R := FETCHFLAGS UNPACKFLAGS PATCHFLAGS
|
---|
907 | PROPS_FETCHES_ACCUMULATE_L := SOURCES CLEAN
|
---|
908 | ## @}
|
---|
909 |
|
---|
910 |
|
---|
911 | #
|
---|
912 | # Here is a special 'hack' to prevent innocent environment variables being
|
---|
913 | # picked up and treated as properties. (The most annoying example of why
|
---|
914 | # this is necessary is the Visual C++ commandline with it's LIBPATH.)
|
---|
915 | #
|
---|
916 | # Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to
|
---|
917 | # disable this 'hack'.
|
---|
918 | #
|
---|
919 | ifndef KBUILD_DONT_KILL_ENV_PROPS
|
---|
920 |
|
---|
921 | define def_nuke_environment_prop
|
---|
922 | ifeq ($(origin $(prop)),environment)
|
---|
923 | $(prop) =
|
---|
924 | endif
|
---|
925 | endef
|
---|
926 | $(foreach prop, $(PROPS_ALL) \
|
---|
927 | FETCHES PATCHES BLDPROGS LIBRARIES IMPORT_LIBS DLLS PROGRAMS SYSMODS MISCBINS INSTALLS OTHERS \
|
---|
928 | SUBDIRS MAKEFILES BLDDIRS \
|
---|
929 | ,$(eval $(value def_nuke_environment_prop)))
|
---|
930 |
|
---|
931 | endif # KBUILD_DONT_KILL_ENV_PROPS
|
---|
932 |
|
---|
933 |
|
---|
934 | #
|
---|
935 | # Pass configuration.
|
---|
936 | #
|
---|
937 | # The PASS_<passname>_trgs variable is listing the targets.
|
---|
938 | # The PASS_<passname>_vars variable is listing the target variables.
|
---|
939 | # The PASS_<passname>_pass variable is the lowercased passname.
|
---|
940 | #
|
---|
941 |
|
---|
942 | ## PASS: fetches
|
---|
943 | # This pass fetches and unpacks things needed to complete the build.
|
---|
944 | PASS_FETCHES := Fetches
|
---|
945 | PASS_FETCHES_trgs :=
|
---|
946 | PASS_FETCHES_vars := _FETCHES
|
---|
947 | PASS_FETCHES_pass := fetches
|
---|
948 |
|
---|
949 | ## PASS: patches
|
---|
950 | # This pass applies patches.
|
---|
951 | PASS_PATCHES := Patches
|
---|
952 | PASS_PATCHES_trgs :=
|
---|
953 | PASS_PATCHES_vars := _PATCHES
|
---|
954 | PASS_PATCHES_pass := patches
|
---|
955 |
|
---|
956 | ## PASS: bldprogs
|
---|
957 | # This pass builds targets which are required for building the rest.
|
---|
958 | PASS_BLDPROGS := Build Programs
|
---|
959 | PASS_BLDPROGS_trgs :=
|
---|
960 | PASS_BLDPROGS_vars := _BLDPROGS
|
---|
961 | PASS_BLDPROGS_pass := bldprogs
|
---|
962 |
|
---|
963 | ## PASS: libraries
|
---|
964 | # This pass builds library targets.
|
---|
965 | PASS_LIBRARIES := Libraries
|
---|
966 | PASS_LIBRARIES_trgs :=
|
---|
967 | PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
|
---|
968 | PASS_LIBRARIES_pass := libraries
|
---|
969 |
|
---|
970 | ## PASS: binaries
|
---|
971 | # This pass builds dll targets.
|
---|
972 | PASS_DLLS := DLLs
|
---|
973 | PASS_DLLS_trgs :=
|
---|
974 | PASS_DLLS_vars := _DLLS _OTHER_DLLS
|
---|
975 | PASS_DLLS_pass := dlls
|
---|
976 |
|
---|
977 | ## PASS: binaries
|
---|
978 | # This pass builds binary targets, i.e. programs, system modules and stuff.
|
---|
979 | PASS_BINARIES := Programs
|
---|
980 | PASS_BINARIES_trgs :=
|
---|
981 | PASS_BINARIES_vars := _PROGRAMS _SYSMODS _MISC_BINS _OTHER_BINARIES
|
---|
982 | PASS_BINARIES_pass := binaries
|
---|
983 |
|
---|
984 | ## PASS: others
|
---|
985 | # This pass builds other targets.
|
---|
986 | PASS_OTHERS := Other Stuff
|
---|
987 | PASS_OTHERS_trgs :=
|
---|
988 | PASS_OTHERS_vars := _OTHERS
|
---|
989 | PASS_OTHERS_pass := others
|
---|
990 |
|
---|
991 | ## PASS: install
|
---|
992 | # This pass installs the built entities to a sandbox area.
|
---|
993 | ## @todo split this up into build install (to sandbox) and real installation.
|
---|
994 | PASS_INSTALLS := Install
|
---|
995 | PASS_INSTALLS_trgs :=
|
---|
996 | PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS _INSTALLS_FILES
|
---|
997 | PASS_INSTALLS_pass := installs
|
---|
998 |
|
---|
999 | ## PASS: testing
|
---|
1000 | # This pass processes custom rules for executing tests.
|
---|
1001 | PASS_TESTING := Tests
|
---|
1002 | PASS_TESTING_trgs :=
|
---|
1003 | PASS_TESTING_vars := _TESTING
|
---|
1004 | PASS_TESTING_pass := testing
|
---|
1005 |
|
---|
1006 | ## PASS: packing
|
---|
1007 | # This pass processes custom packing rules.
|
---|
1008 | PASS_PACKING := Packing
|
---|
1009 | PASS_PACKING_trgs :=
|
---|
1010 | PASS_PACKING_vars := _PACKING
|
---|
1011 | PASS_PACKING_pass := packing
|
---|
1012 |
|
---|
1013 | ## PASS: clean
|
---|
1014 | # This pass removes all generated files.
|
---|
1015 | PASS_CLEAN := Clean
|
---|
1016 | PASS_CLEAN_trgs := do-clean
|
---|
1017 | PASS_CLEAN_vars :=
|
---|
1018 | PASS_CLEAN_pass := clean
|
---|
1019 |
|
---|
1020 | ## PASS: nothing
|
---|
1021 | # This pass just walks the tree.
|
---|
1022 | PASS_NOTHING := Nothing
|
---|
1023 | PASS_NOTHING_trgs := do-nothing
|
---|
1024 | PASS_NOTHING_vars :=
|
---|
1025 | PASS_NOTHING_pass := nothing
|
---|
1026 |
|
---|
1027 | ## DEFAULT_PASSES
|
---|
1028 | # The default passes and their order.
|
---|
1029 | DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS INSTALLS
|
---|
1030 |
|
---|
1031 | ## PASSES
|
---|
1032 | # The passes that should be defined. This must include
|
---|
1033 | # all passes mentioned by DEFAULT_PASSES.
|
---|
1034 | PASSES := FETCHES PATCHES $(DEFAULT_PASSES) TESTING PACKING CLEAN NOTHING
|
---|
1035 |
|
---|
1036 |
|
---|
1037 | #
|
---|
1038 | # Check for --pretty-command-printing before including the Config.kmk
|
---|
1039 | # so that anyone overriding the message macros can take the implied
|
---|
1040 | # verbosity level change into account.
|
---|
1041 | #
|
---|
1042 | ifndef KBUILD_VERBOSE
|
---|
1043 | ifndef KBUILD_QUIET
|
---|
1044 | ifeq ($(KMK_OPTS_PRETTY_COMMAND_PRINTING),1)
|
---|
1045 | export KBUILD_VERBOSE := 2
|
---|
1046 | endif
|
---|
1047 | endif
|
---|
1048 | endif
|
---|
1049 |
|
---|
1050 |
|
---|
1051 | #
|
---|
1052 | # Legacy variable translation.
|
---|
1053 | # These will be eliminated when switching to the next version.
|
---|
1054 | #
|
---|
1055 | ifdef USE_KOBJCACHE
|
---|
1056 | ifndef KBUILD_USE_KOBJCACHE
|
---|
1057 | export KBUILD_USE_KOBJCACHE := $(USE_KOBJCACHE)
|
---|
1058 | endif
|
---|
1059 | endif
|
---|
1060 |
|
---|
1061 |
|
---|
1062 | #
|
---|
1063 | # This is how we find the closest config.kmk.
|
---|
1064 | # It's a little hacky but I think it works fine.
|
---|
1065 | #
|
---|
1066 | _CFGDIR := .
|
---|
1067 | _CFGFILES := ./Config.kmk ./config.kmk
|
---|
1068 | define def_include_config
|
---|
1069 | $(eval _CFGDIR := $(_CFGDIR)/$(dir))
|
---|
1070 | _CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
|
---|
1071 | endef
|
---|
1072 | # walk down the _RELATIVE_ path specified by DEPTH.
|
---|
1073 | $(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
|
---|
1074 | # add the default config file.
|
---|
1075 | _CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
|
---|
1076 | _CFGFILES :=
|
---|
1077 | _CFGDIR :=
|
---|
1078 | ifeq ($(_CFGFILE),)
|
---|
1079 | $(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
|
---|
1080 | endif
|
---|
1081 |
|
---|
1082 | # Include the config.kmk we found file (or the default one).
|
---|
1083 | ifdef KBUILD_PROFILE_SELF
|
---|
1084 | $(evalcall def_profile_self, including $(_CFGFILE))
|
---|
1085 | include $(_CFGFILE)
|
---|
1086 | $(evalcall def_profile_self, included $(_CFGFILE))
|
---|
1087 | else
|
---|
1088 | include $(_CFGFILE)
|
---|
1089 | endif
|
---|
1090 |
|
---|
1091 |
|
---|
1092 |
|
---|
1093 | #
|
---|
1094 | # Finalize a the central path variables now that we've included the Config.kmk file.
|
---|
1095 | #
|
---|
1096 | # This prevents some trouble when users override the defaults for these
|
---|
1097 | # variables and uses relative paths or paths with incorrect case.
|
---|
1098 | #
|
---|
1099 | PATH_OUT_BASE := $(abspath $(PATH_OUT_BASE))
|
---|
1100 | PATH_OUT := $(abspath $(PATH_OUT))
|
---|
1101 | PATH_OBJ := $(abspath $(PATH_OBJ))
|
---|
1102 | PATH_TARGET := $(abspath $(PATH_TARGET))
|
---|
1103 | PATH_INS := $(abspath $(PATH_INS))
|
---|
1104 | PATH_BIN := $(abspath $(PATH_BIN))
|
---|
1105 | PATH_DLL := $(abspath $(PATH_DLL))
|
---|
1106 | PATH_SYS := $(abspath $(PATH_SYS))
|
---|
1107 | PATH_LIB := $(abspath $(PATH_LIB))
|
---|
1108 | PATH_DOC := $(abspath $(PATH_DOC))
|
---|
1109 |
|
---|
1110 |
|
---|
1111 | #
|
---|
1112 | # Setup the message style. The default one is inlined.
|
---|
1113 | #
|
---|
1114 | # See kBuild/msgstyles for more styles or use KBUILD_MSG_STYLE_PATHS
|
---|
1115 | # to create your own message style.
|
---|
1116 | #
|
---|
1117 | KBUILD_MSG_STYLE ?= default
|
---|
1118 | ifeq ($(KBUILD_MSG_STYLE),default)
|
---|
1119 | #
|
---|
1120 | # The 'default' style.
|
---|
1121 | #
|
---|
1122 |
|
---|
1123 | ## Fetch starting.
|
---|
1124 | # @param 1 Target name.
|
---|
1125 | MSG_FETCH ?= $(call MSG_L1,Fetching $1...)
|
---|
1126 | ## Re-fetch starting.
|
---|
1127 | # @param 1 Target name.
|
---|
1128 | MSG_REFETCH ?= $(call MSG_L1,Re-fetching $1...)
|
---|
1129 | ## Downloading a fetch component.
|
---|
1130 | # @param 1 Target name.
|
---|
1131 | # @param 2 The source URL.
|
---|
1132 | # @param 3 The destination file name.
|
---|
1133 | MSG_FETCH_DL ?= $(call MSG_L1,Downloading $1 - $2,=> $3)
|
---|
1134 | ## Checking a fetch component.
|
---|
1135 | # @param 1 Target name.
|
---|
1136 | # @param 2 The source URL.
|
---|
1137 | # @param 3 The destination file name.
|
---|
1138 | MSG_FETCH_CHK?= $(call MSG_L1,Checking $1 - $3, ($2))
|
---|
1139 | ## Unpacking a fetch component.
|
---|
1140 | # @param 1 Target name.
|
---|
1141 | # @param 2 The archive file name.
|
---|
1142 | # @param 3 The target directory.
|
---|
1143 | MSG_FETCH_UP ?= $(call MSG_L1,Unpacking $1 - $2 => $3)
|
---|
1144 | ## Fetch completed.
|
---|
1145 | # @param 1 Target name.
|
---|
1146 | MSG_FETCH_OK ?= $(call MSG_L1,Successfully fetched $1)
|
---|
1147 | ## Unfetch a fetch target.
|
---|
1148 | # @param 1 Target name.
|
---|
1149 | MSG_UNFETCH ?= $(call MSG_L1,Unfetching $1...)
|
---|
1150 | ## Compiling a source file.
|
---|
1151 | # @param 1 Target name.
|
---|
1152 | # @param 2 The source filename.
|
---|
1153 | # @param 3 The primary link output file name.
|
---|
1154 | # @param 4 The source type (C,CXX,OBJC,AS,RC,++).
|
---|
1155 | MSG_COMPILE ?= $(call MSG_L1,Compiling $1 - $2,=> $3)
|
---|
1156 | ## Tool
|
---|
1157 | # @param 1 The tool name (bin2c,...)
|
---|
1158 | # @param 2 Target name.
|
---|
1159 | # @param 3 The source filename.
|
---|
1160 | # @param 4 The primary output file name.
|
---|
1161 | MSG_TOOL ?= $(call MSG_L1,$1 $2 - $3,=> $4)
|
---|
1162 | ## Generate a file, typically a source file.
|
---|
1163 | # @param 1 Target name if applicable.
|
---|
1164 | # @param 2 Output file name.
|
---|
1165 | # @param 3 What it's generated from
|
---|
1166 | MSG_GENERATE ?= $(call MSG_L1,Generating $(if $1,$1 - )$2,$(if $3,from $3))
|
---|
1167 | ## Linking a bldprog/dll/program/sysmod target.
|
---|
1168 | # @param 1 Target name.
|
---|
1169 | # @param 2 The primary link output file name.
|
---|
1170 | # @param 3 The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
|
---|
1171 | MSG_LINK ?= $(call MSG_L1,Linking $1,=> $2)
|
---|
1172 | ## Merging a library into the target (during library linking).
|
---|
1173 | # @param 1 Target name.
|
---|
1174 | # @param 2 The output library name.
|
---|
1175 | # @param 3 The input library name.
|
---|
1176 | MSG_AR_MERGE ?= $(call MSG_L1,Merging $3 into $1, ($2))
|
---|
1177 | ## Creating a directory (build).
|
---|
1178 | # @param 1 Directory name.
|
---|
1179 | MSG_MKDIR ?= $(call MSG_L2,Creating directory $1)
|
---|
1180 | ## Cleaning.
|
---|
1181 | MSG_CLEAN ?= $(call MSG_L1,Cleaning...)
|
---|
1182 | ## Nothing.
|
---|
1183 | MSG_NOTHING ?= $(call MSG_L1,Did nothing in $(CURDIR))
|
---|
1184 | ## Pass
|
---|
1185 | # @param 1 The pass name.
|
---|
1186 | MSG_PASS ?= $(call MSG_L1,Pass - $1)
|
---|
1187 | ## Installing a bldprog/lib/dll/program/sysmod target.
|
---|
1188 | # @param 1 Target name.
|
---|
1189 | # @param 2 The source filename.
|
---|
1190 | # @param 3 The destination file name.
|
---|
1191 | MSG_INST_TRG ?= $(call MSG_L1,Installing $1 => $3)
|
---|
1192 | ## Installing a file (install target).
|
---|
1193 | # @param 1 The source filename.
|
---|
1194 | # @param 2 The destination filename.
|
---|
1195 | MSG_INST_FILE?= $(call MSG_L1,Installing $2,(<= $1))
|
---|
1196 | ## Installing a symlink.
|
---|
1197 | # @param 1 Symlink
|
---|
1198 | # @param 2 Link target
|
---|
1199 | MSG_INST_SYM ?= $(call MSG_L1,Installing symlink $1,=> $2)
|
---|
1200 | ## Installing a directory.
|
---|
1201 | # @param 1 Directory name.
|
---|
1202 | MSG_INST_DIR ?= $(call MSG_L1,Installing directory $1)
|
---|
1203 |
|
---|
1204 | else
|
---|
1205 | _KBUILD_MSG_STYLE_FILE := $(firstword $(foreach path, $(KBUILD_MSG_STYLE_PATHS) $(KBUILD_PATH)/msgstyles, $(wildcard $(path)/$(KBUILD_MSG_STYLE).kmk)))
|
---|
1206 | ifneq ($(_KBUILD_MSG_STYLE_FILE),)
|
---|
1207 | include $(_KBUILD_MSG_STYLE_FILE)
|
---|
1208 | else
|
---|
1209 | $(error kBuild: Can't find the style setup file for KBUILD_MSG_STYLE '$(KBUILD_MSG_STYLE)')
|
---|
1210 | endif
|
---|
1211 | endif
|
---|
1212 |
|
---|
1213 |
|
---|
1214 | #
|
---|
1215 | # Message macros.
|
---|
1216 | #
|
---|
1217 | # This is done after including Config.kmk as to allow for
|
---|
1218 | # KBUILD_QUIET and KBUILD_VERBOSE to be configurable.
|
---|
1219 | #
|
---|
1220 | ifdef KBUILD_QUIET
|
---|
1221 | # No output
|
---|
1222 | QUIET := @
|
---|
1223 | QUIET2:= @
|
---|
1224 | MSG_L1 =
|
---|
1225 | MSG_L2 =
|
---|
1226 | else
|
---|
1227 | ifndef KBUILD_VERBOSE
|
---|
1228 | # Default output level.
|
---|
1229 | QUIET := @
|
---|
1230 | QUIET2 := @
|
---|
1231 | MSG_L1 ?= %@$(ECHO) "kBuild: $1"
|
---|
1232 | MSG_L2 =
|
---|
1233 | else ifeq ($(KBUILD_VERBOSE),1)
|
---|
1234 | # A bit more output
|
---|
1235 | QUIET := @
|
---|
1236 | QUIET2 := @
|
---|
1237 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
---|
1238 | MSG_L2 =
|
---|
1239 | else ifeq ($(KBUILD_VERBOSE),2)
|
---|
1240 | # Lot more output
|
---|
1241 | QUIET :=
|
---|
1242 | QUIET2 := @
|
---|
1243 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
---|
1244 | MSG_L2 ?= %@$(ECHO) "kBuild: $1"
|
---|
1245 | else
|
---|
1246 | # maximal output.
|
---|
1247 | QUIET :=
|
---|
1248 | QUIET2 :=
|
---|
1249 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
---|
1250 | MSG_L2 ?= %@$(ECHO) "kBuild: $1"
|
---|
1251 | endif
|
---|
1252 | endif
|
---|
1253 |
|
---|
1254 |
|
---|
1255 | #
|
---|
1256 | # Validate any KBUILD_BLD_TYPES additions and finally the KBUILD_TYPE.
|
---|
1257 | #
|
---|
1258 | if1of ($(KBUILD_BLD_TYPES), $(KBUILD_OSES))
|
---|
1259 | $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_OSES!)
|
---|
1260 | endif
|
---|
1261 | if1of ($(KBUILD_BLD_TYPES), $(KBUILD_ARCHES))
|
---|
1262 | $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_ARCHES!)
|
---|
1263 | endif
|
---|
1264 | if1of ($(KBUILD_OSES), $(KBUILD_ARCHES))
|
---|
1265 | $(error kBuild: found KBUILD_OSES in KBUILD_ARCHES!)
|
---|
1266 | endif
|
---|
1267 | ifn1of ($(KBUILD_TYPE), $(KBUILD_BLD_TYPES))
|
---|
1268 | $(error kBuild: KBUILD_TYPE(=$(KBUILD_TYPE)) is not found in KBUILD_BLD_TYPES(=$(KBUILD_BLD_TYPES))!)
|
---|
1269 | endif
|
---|
1270 |
|
---|
1271 |
|
---|
1272 |
|
---|
1273 | ifdef KBUILD_PROFILE_SELF
|
---|
1274 | $(evalcall def_profile_self, end of header.kmk)
|
---|
1275 | _KBUILD_TS_HEADER_END := $(_KBUILD_TS_PREV)
|
---|
1276 | endif
|
---|
1277 |
|
---|
1278 | # end-of-file-content
|
---|
1279 | __header_kmk__ := 1
|
---|
1280 | endif # __header_kmk__
|
---|
1281 |
|
---|
1282 |
|
---|