1 | # $Id: header.kmk 2887 2016-09-06 14:33:15Z bird $
|
---|
2 | ## @file
|
---|
3 | # kBuild - File included at top of a makefile.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (c) 2004-2015 knut st. osmundsen <bird-kBuild-spam-xiv@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 | if $(KBUILD_VERSION_PATCH) < 999
|
---|
74 | $(error kBuild: kmk version mismatch! Expected 0.1.999 or later. Actual version is $(KBUILD_VERSION).)
|
---|
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: 2887 $ )
|
---|
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 | # Percent character.
|
---|
163 | PERCENT := %
|
---|
164 |
|
---|
165 | ##
|
---|
166 | # Single quote character.
|
---|
167 | SQUOTE := '
|
---|
168 |
|
---|
169 | ##
|
---|
170 | # Double quote character.
|
---|
171 | DQUOTE := "
|
---|
172 |
|
---|
173 |
|
---|
174 | #
|
---|
175 | # The list of standard build types in kBuild.
|
---|
176 | #
|
---|
177 | # This list can be extended in Config.kmk and it's possible to extend
|
---|
178 | # (inherit) another build type.
|
---|
179 | #
|
---|
180 | KBUILD_BLD_TYPES := release profile debug
|
---|
181 |
|
---|
182 |
|
---|
183 | #
|
---|
184 | # The OSes, Architectures and CPUs that kBuild recognizes.
|
---|
185 | #
|
---|
186 | # When kBuild is ported to a new OS or architecture a unique keyword needs
|
---|
187 | # to be assigned to it and added here. This strictness is required because
|
---|
188 | # this keyword namespace is shared between OSes, architectures, cpus and
|
---|
189 | # build types. (PORTME)
|
---|
190 | #
|
---|
191 | KBUILD_OSES := darwin dos dragonfly freebsd haiku l4 linux netbsd nt openbsd os2 solaris win os-agnostic
|
---|
192 | KBUILD_ARCHES := x86 amd64 sparc32 sparc64 s390 s390x ppc32 ppc64 mips32 mips64 ia64 hppa32 hppa64 arm alpha noarch
|
---|
193 | KBUILD_ARCHES_64 := amd64 sparc64 s390x ppc64 mips64 ia64 hppa64 alpha
|
---|
194 | KBUILD_ARCHES_32 := x86 sparc32 s390 ppc32 mips32 hppa32 arm
|
---|
195 |
|
---|
196 |
|
---|
197 | #
|
---|
198 | # Set default build type.
|
---|
199 | #
|
---|
200 | ifndef KBUILD_TYPE
|
---|
201 | ifdef BUILD_TYPE
|
---|
202 | KBUILD_TYPE := $(BUILD_TYPE)
|
---|
203 | endif
|
---|
204 | else ifdef BUILD_TYPE
|
---|
205 | ifneq ($(KBUILD_TYPE),$(BUILD_TYPE))
|
---|
206 | ifeq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),environment:command line)
|
---|
207 | KBUILD_TYPE := $(BUILD_TYPE)
|
---|
208 | else ifneq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),command line:environment)
|
---|
209 | $(error kBuild: KBUILD_TYPE and BUILD_TYPE disagree.)
|
---|
210 | endif
|
---|
211 | endif
|
---|
212 | endif
|
---|
213 | override BUILD_TYPE = $(KBUILD_TYPE)
|
---|
214 |
|
---|
215 | ifndef KBUILD_TYPE
|
---|
216 | KBUILD_TYPE := release
|
---|
217 | else
|
---|
218 | if1of ($(KBUILD_TYPE), $(KBUILD_OSES) $(KBUILD_ARCHES))
|
---|
219 | $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' is an OS or architecture!)
|
---|
220 | endif
|
---|
221 | ifneq (.$(words $(KBUILD_TYPE)).$(KBUILD_TYPE).,.1.$(strip $(KBUILD_TYPE)).)
|
---|
222 | $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' contains spaces/tabs!)
|
---|
223 | endif
|
---|
224 | endif
|
---|
225 |
|
---|
226 |
|
---|
227 | #
|
---|
228 | # Host platform legacy
|
---|
229 | # kmk deals with this, so this is only temporary until I've rebuilt everything.
|
---|
230 | #
|
---|
231 | ifndef KBUILD_HOST
|
---|
232 | KBUILD_HOST := $(BUILD_PLATFORM)
|
---|
233 | endif
|
---|
234 | ifndef KBUILD_HOST_ARCH
|
---|
235 | KBUILD_HOST_ARCH := $(BUILD_PLATFORM_ARCH)
|
---|
236 | endif
|
---|
237 | ifndef KBUILD_HOST_CPU
|
---|
238 | KBUILD_HOST_CPU := $(BUILD_PLATFORM_CPU)
|
---|
239 | endif
|
---|
240 |
|
---|
241 |
|
---|
242 | #
|
---|
243 | # Assert valid build platform variables.
|
---|
244 | #
|
---|
245 | # All these are set by kmk so they shouldn't be any trouble
|
---|
246 | # unless the user starts messing about with environment variables.
|
---|
247 | #
|
---|
248 | ifneq (.$(words $(KBUILD_HOST)).$(KBUILD_HOST).,.1.$(strip $(KBUILD_HOST)).)
|
---|
249 | $(error kBuild: The KBUILD_HOST value '$(KBUILD_HOST)' contains spaces/tabs!)
|
---|
250 | endif
|
---|
251 | ifneq ($(words $(filter $(KBUILD_HOST),$(KBUILD_OSES))),1)
|
---|
252 | $(error kBuild: KBUILD_HOST value '$(KBUILD_HOST)' is not recognized (valid: $(KBUILD_OSES)))
|
---|
253 | endif
|
---|
254 |
|
---|
255 | ifneq (.$(words $(KBUILD_HOST_ARCH)).$(KBUILD_HOST_ARCH).,.1.$(strip $(KBUILD_HOST_ARCH)).)
|
---|
256 | $(error kBuild: The KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' contains spaces/tabs!)
|
---|
257 | endif
|
---|
258 | ifneq ($(words $(filter $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES))),1)
|
---|
259 | $(error kBuild: KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
|
---|
260 | endif
|
---|
261 |
|
---|
262 | ifeq ($(strip $(KBUILD_HOST_CPU)),)
|
---|
263 | KBUILD_HOST_CPU := blend
|
---|
264 | else
|
---|
265 | ifneq (.$(words $(KBUILD_HOST_CPU)).$(KBUILD_HOST_CPU).,.1.$(strip $(KBUILD_HOST_CPU)).)
|
---|
266 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' contains spaces/tabs!)
|
---|
267 | endif
|
---|
268 | if1of ($(KBUILD_HOST_CPU), $(KBUILD_OSES) $(KBUILD_ARCHES))
|
---|
269 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' was found in the OS or architecture keywords!)
|
---|
270 | endif
|
---|
271 | ifeq ($(KBUILD_HOST_CPU),$(KBUILD_TYPE))
|
---|
272 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' is the same as the KBUILD_TYPE!)
|
---|
273 | endif
|
---|
274 | endif
|
---|
275 |
|
---|
276 |
|
---|
277 | #
|
---|
278 | # Deal with target platform legacy.
|
---|
279 | #
|
---|
280 | ifndef KBUILD_TARGET
|
---|
281 | ifdef BUILD_TARGET
|
---|
282 | KBUILD_TARGET := $(BUILD_TARGET)
|
---|
283 | endif
|
---|
284 | else ifdef BUILD_TARGET
|
---|
285 | ifneq ($(KBUILD_TARGET),$(BUILD_TARGET))
|
---|
286 | ifeq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),environment:command line)
|
---|
287 | KBUILD_TARGET := $(BUILD_TARGET)
|
---|
288 | else ifneq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),command line:environment)
|
---|
289 | $(error kBuild: KBUILD_TARGET and BUILD_TARGET disagree)
|
---|
290 | endif
|
---|
291 | endif
|
---|
292 | endif
|
---|
293 | override BUILD_TARGET = $(KBUILD_TARGET)
|
---|
294 |
|
---|
295 | ifndef KBUILD_TARGET_ARCH
|
---|
296 | ifdef BUILD_TARGET_ARCH
|
---|
297 | KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
|
---|
298 | endif
|
---|
299 | else ifdef BUILD_TARGET_ARCH
|
---|
300 | ifneq ($(KBUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH))
|
---|
301 | ifeq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),environment:command line)
|
---|
302 | KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH)
|
---|
303 | else ifneq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),command line:environment)
|
---|
304 | $(error kBuild: KBUILD_TARGET_ARCH and BUILD_TARGET_ARCH disagree)
|
---|
305 | endif
|
---|
306 | endif
|
---|
307 | endif
|
---|
308 | override BUILD_TARGET_ARCH = $(KBUILD_TARGET_ARCH)
|
---|
309 |
|
---|
310 | ifndef KBUILD_TARGET_CPU
|
---|
311 | ifdef BUILD_TARGET_CPU
|
---|
312 | KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
|
---|
313 | endif
|
---|
314 | else ifdef BUILD_TARGET_CPU
|
---|
315 | ifneq ($(KBUILD_TARGET_CPU),$(BUILD_TARGET_CPU))
|
---|
316 | ifeq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),environment:command line)
|
---|
317 | KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU)
|
---|
318 | else ifneq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),command line:environment)
|
---|
319 | $(error kBuild: KBUILD_TARGET_CPU and BUILD_TARGET_CPU disagree)
|
---|
320 | endif
|
---|
321 | endif
|
---|
322 | endif
|
---|
323 | override BUILD_TARGET_CPU = $(KBUILD_TARGET_CPU)
|
---|
324 |
|
---|
325 |
|
---|
326 | #
|
---|
327 | # Assert or set default target platform.
|
---|
328 | # When not defined use the corresponding KBUILD_HOST value.
|
---|
329 | #
|
---|
330 | ifndef KBUILD_TARGET
|
---|
331 | KBUILD_TARGET := $(KBUILD_HOST)
|
---|
332 | else
|
---|
333 | ifneq (.$(words $(KBUILD_TARGET)).$(KBUILD_TARGET).,.1.$(strip $(KBUILD_TARGET)).)
|
---|
334 | $(error kBuild: The KBUILD_TARGET value '$(KBUILD_TARGET)' contains spaces/tabs!)
|
---|
335 | endif
|
---|
336 | ifneq ($(words $(filter $(KBUILD_TARGET),$(KBUILD_OSES))),1)
|
---|
337 | $(error kBuild: KBUILD_TARGET value '$(KBUILD_TARGET)' is not recognized (valid: $(KBUILD_OSES)))
|
---|
338 | endif
|
---|
339 | endif
|
---|
340 |
|
---|
341 | ifndef KBUILD_TARGET_ARCH
|
---|
342 | KBUILD_TARGET_ARCH := $(KBUILD_HOST_ARCH)
|
---|
343 | else
|
---|
344 | ifneq (.$(words $(KBUILD_TARGET_ARCH)).$(KBUILD_TARGET_ARCH).,.1.$(strip $(KBUILD_TARGET_ARCH)).)
|
---|
345 | $(error kBuild: The KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' contains spaces/tabs!)
|
---|
346 | endif
|
---|
347 | ifneq ($(words $(filter $(KBUILD_TARGET_ARCH),$(KBUILD_ARCHES))),1)
|
---|
348 | $(error kBuild: KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' is not recognized (valid: $(KBUILD_ARCHES)))
|
---|
349 | endif
|
---|
350 | endif
|
---|
351 |
|
---|
352 | ifndef KBUILD_TARGET_CPU
|
---|
353 | KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
|
---|
354 | else ifeq ($(strip $(KBUILD_TARGET_CPU)),)
|
---|
355 | ifeq ($(KBUILD_TARGET_ARCH),$(KBUILD_HOST_ARCH))
|
---|
356 | KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU)
|
---|
357 | else
|
---|
358 | KBUILD_TARGET_CPU := blend
|
---|
359 | endif
|
---|
360 | else
|
---|
361 | ifneq (.$(words $(KBUILD_TARGET_CPU)).$(KBUILD_TARGET_CPU).,.1.$(strip $(KBUILD_TARGET_CPU)).)
|
---|
362 | $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' contains spaces/tabs!)
|
---|
363 | endif
|
---|
364 | if1of ($(KBUILD_TARGET_CPU), $(KBUILD_OSES) $(KBUILD_ARCHES))
|
---|
365 | $(error kBuild: The KBUILD_TARGET_CPU value was found in the OS or architecture keywords!)
|
---|
366 | endif
|
---|
367 | ifeq ($(KBUILD_TARGET_CPU),$(KBUILD_TYPE))
|
---|
368 | $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' is the same as the KBUILD_TYPE!)
|
---|
369 | endif
|
---|
370 | endif
|
---|
371 |
|
---|
372 |
|
---|
373 | #
|
---|
374 | # Paths and stuff.
|
---|
375 | #
|
---|
376 |
|
---|
377 | # Adjust DEPTH first.
|
---|
378 | DEPTH := $(strip $(DEPTH))
|
---|
379 | ifeq ($(DEPTH),)
|
---|
380 | DEPTH := .
|
---|
381 | endif
|
---|
382 |
|
---|
383 | ## PATH_CURRENT is the current directory (getcwd).
|
---|
384 | PATH_CURRENT := $(abspath $(CURDIR))
|
---|
385 | ## PATH_SUB_CURRENT points to current directory of the current makefile.
|
---|
386 | # Meaning that it will change value as we enter and exit sub-makefiles.
|
---|
387 | PATH_SUB_CURRENT := $(PATH_CURRENT)
|
---|
388 | ## PATH_ROOT points to the project root directory.
|
---|
389 | PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
|
---|
390 | ## PATH_SUB_ROOT points to the directory of the top-level makefile.
|
---|
391 | ifneq ($(strip $(SUB_DEPTH)),)
|
---|
392 | SUB_DEPTH := $(strip $(SUB_DEPTH))
|
---|
393 | PATH_SUB_ROOT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
|
---|
394 | else
|
---|
395 | PATH_SUB_ROOT := $(PATH_CURRENT)
|
---|
396 | endif
|
---|
397 |
|
---|
398 | ## CURSUBDIR is PATH_SUB_ROOT described relative to PATH_ROOT.
|
---|
399 | # This variable is used to determin where the object files and other output goes.
|
---|
400 | ifneq ($(PATH_ROOT),$(PATH_SUB_ROOT))
|
---|
401 | CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_ROOT))
|
---|
402 | else
|
---|
403 | CURSUBDIR := .
|
---|
404 | endif
|
---|
405 |
|
---|
406 | # Install directory layout. Relative to PATH_INS.
|
---|
407 | KBUILD_INST_PATHS := BIN DLL SYS LIB DOC DEBUG SBIN LIBEXEC SHARE
|
---|
408 | INST_BIN = bin/
|
---|
409 | if1of ($(KBUILD_TARGET), win)
|
---|
410 | INST_DLL = bin/
|
---|
411 | else
|
---|
412 | INST_DLL = lib/
|
---|
413 | endif
|
---|
414 | if1of ($(KBUILD_TARGET), os2 win)
|
---|
415 | INST_SYS = drivers/
|
---|
416 | else
|
---|
417 | INST_SYS = kernel/
|
---|
418 | endif
|
---|
419 | INST_LIB = lib/
|
---|
420 | INST_DOC = share/doc/
|
---|
421 | INST_DEBUG = debug/
|
---|
422 | INST_SBIN = sbin/
|
---|
423 | INST_LIBEXEC = libexec/
|
---|
424 | INST_SHARE = share/
|
---|
425 |
|
---|
426 | # Staging directory layout. Relative to PATH_STAGE.
|
---|
427 | STAGE_BIN = $(INST_BIN)
|
---|
428 | STAGE_DLL = $(INST_DLL)
|
---|
429 | STAGE_SYS = $(INST_SYS)
|
---|
430 | STAGE_LIB = $(INST_LIB)
|
---|
431 | STAGE_DOC = $(INST_DOC)
|
---|
432 | STAGE_DEBUG = $(INST_DEBUG)
|
---|
433 | STAGE_SBIN = $(INST_SBIN)
|
---|
434 | STAGE_LIBEXEC = $(INST_LIBEXEC)
|
---|
435 | STAGE_SHARE = $(INST_SHARE)
|
---|
436 |
|
---|
437 | # Install and staging directory paths.
|
---|
438 | $(foreach path, $(KBUILD_INST_PATHS), \
|
---|
439 | $(eval PATH_STAGE_$(path) = $$(patsubst %/,%,$$(PATH_STAGE)/$$(STAGE_$(path)))) \
|
---|
440 | $(eval PATH_INST_$(path) = $$(patsubst %/,%,$$(PATH_INS)/$$(INST_$(path)))) \
|
---|
441 | )
|
---|
442 |
|
---|
443 | # Output directories.
|
---|
444 | ifndef PATH_OUT_BASE
|
---|
445 | PATH_OUT_BASE := $(PATH_ROOT)/out
|
---|
446 | endif
|
---|
447 | ifndef PATH_OUT
|
---|
448 | ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places - obsolete)
|
---|
449 | PATH_OUT = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(KBUILD_TYPE)
|
---|
450 | else
|
---|
451 | PATH_OUT = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/$(KBUILD_TYPE)
|
---|
452 | endif
|
---|
453 | endif # !define PATH_OUT
|
---|
454 | PATH_OBJCACHE = $(PATH_OUT_BASE)/kObjCache
|
---|
455 | PATH_OBJ = $(PATH_OUT)/obj
|
---|
456 | PATH_TARGET = $(PATH_OBJ)/$(CURSUBDIR)
|
---|
457 | PATH_STAGE = $(PATH_OUT)/stage
|
---|
458 | ifndef PATH_INS
|
---|
459 | ifdef DESTROOT
|
---|
460 | PATH_INS = $(DESTROOT)
|
---|
461 | else
|
---|
462 | PATH_INS = $(PATH_OUT)/dist
|
---|
463 | endif
|
---|
464 | endif
|
---|
465 |
|
---|
466 | # Tripwire obsolete PATH defines.
|
---|
467 | PATH_BIN = $(error kBuild: PATH_BIN is obsoleted in kBuild 0.1.2. Use PATH_STAGE_BIN or PATH_INST_BIN instead)
|
---|
468 | PATH_DLL = $(error kBuild: PATH_LIB is obsoleted in kBuild 0.1.2. Use PATH_STAGE_DLL or PATH_INST_DLL instead)
|
---|
469 | PATH_LIB = $(error kBuild: PATH_LIB is obsoleted in kBuild 0.1.2. Use PATH_STAGE_LIB or PATH_INST_LIB instead)
|
---|
470 | PATH_SYS = $(error kBuild: PATH_SYS is obsoleted in kBuild 0.1.2. Use PATH_STAGE_SYS or PATH_INST_SYS instead)
|
---|
471 | PATH_DOC = $(error kBuild: PATH_DOC is obsoleted in kBuild 0.1.2. Use PATH_STAGE_DOC or PATH_INST_DOC instead)
|
---|
472 |
|
---|
473 | # Development tool tree.
|
---|
474 | ifndef KBUILD_DEVTOOLS
|
---|
475 | ifeq ($(PATH_DEVTOOLS),)
|
---|
476 | KBUILD_DEVTOOLS = $(PATH_ROOT)/tools
|
---|
477 | else
|
---|
478 | KBUILD_DEVTOOLS := $(PATH_DEVTOOLS)
|
---|
479 | endif
|
---|
480 | endif
|
---|
481 | KBUILD_DEVTOOLS_TRG ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)
|
---|
482 | KBUILD_DEVTOOLS_HST ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).$(KBUILD_HOST_ARCH)
|
---|
483 |
|
---|
484 | if1of ($(KBUILD_TARGET_ARCH), amd64 hppa64 mips64 ppc64 s390x sparc64)
|
---|
485 | ifeq ($(KBUILD_TARGET_ARCH),amd64)
|
---|
486 | KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).x86
|
---|
487 | else ifeq ($(KBUILD_TARGET_ARCH),hppa64)
|
---|
488 | KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).hppa32
|
---|
489 | else ifeq ($(KBUILD_TARGET_ARCH),mips64)
|
---|
490 | KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).mips32
|
---|
491 | else ifeq ($(KBUILD_TARGET_ARCH),ppc64)
|
---|
492 | KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).ppc32
|
---|
493 | else ifeq ($(KBUILD_TARGET_ARCH),s390x)
|
---|
494 | KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).s390
|
---|
495 | else ifeq ($(KBUILD_TARGET_ARCH),sparc64)
|
---|
496 | KBUILD_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_TARGET).sparc32
|
---|
497 | endif
|
---|
498 | endif
|
---|
499 |
|
---|
500 | if1of ($(KBUILD_HOST_ARCH), amd64 hppa64 mips64 ppc64 s390x sparc64)
|
---|
501 | ifeq ($(KBUILD_HOST_ARCH),amd64)
|
---|
502 | KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).x86
|
---|
503 | else ifeq ($(KBUILD_HOST_ARCH),hppa64)
|
---|
504 | KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).hppa32
|
---|
505 | else ifeq ($(KBUILD_HOST_ARCH),mips64)
|
---|
506 | KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).mips32
|
---|
507 | else ifeq ($(KBUILD_HOST_ARCH),ppc64)
|
---|
508 | KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).ppc32
|
---|
509 | else ifeq ($(KBUILD_HOST_ARCH),s390x)
|
---|
510 | KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).s390
|
---|
511 | else ifeq ($(KBUILD_HOST_ARCH),sparc64)
|
---|
512 | KBUILD_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS)/$(KBUILD_HOST).sparc32
|
---|
513 | endif
|
---|
514 | endif
|
---|
515 |
|
---|
516 | # Deprecated legacy names.
|
---|
517 | PATH_DEVTOOLS ?= $(KBUILD_DEVTOOLS)
|
---|
518 | PATH_DEVTOOLS_TRG ?= $(KBUILD_DEVTOOLS_TRG)
|
---|
519 | PATH_DEVTOOLS_BLD ?= $(KBUILD_DEVTOOLS_TRG)
|
---|
520 | PATH_DEVTOOLS_TRG_ALT ?= $(KBUILD_DEVTOOLS_TRG_ALT)
|
---|
521 | PATH_DEVTOOLS_HST ?= $(KBUILD_DEVTOOLS_HST)
|
---|
522 | PATH_DEVTOOLS_HST_ALT ?= $(KBUILD_DEVTOOLS_HST_ALT)
|
---|
523 |
|
---|
524 | # KBUILD_PATH / PATH_KBUILD is determined by kmk.
|
---|
525 | ifndef KBUILD_PATH
|
---|
526 | KBUILD_PATH := $(PATH_KBUILD)
|
---|
527 | endif
|
---|
528 | ifeq ($(strip $(KBUILD_PATH)),)
|
---|
529 | $(error kBuild: KBUILD_PATH is missing or empty! kmk is supposed to set it.)
|
---|
530 | endif
|
---|
531 | # KBUILD_BIN_PATH / PATH_KBUILD_BIN is determined by kmk.
|
---|
532 | ifndef KBUILD_BIN_PATH
|
---|
533 | KBUILD_BIN_PATH := $(PATH_KBUILD_BIN)
|
---|
534 | endif
|
---|
535 | ifeq ($(strip $(KBUILD_BIN_PATH)),)
|
---|
536 | $(error kBuild: KBUILD_BIN_PATH is missing or empty! kmk is supposed to set it.)
|
---|
537 | endif
|
---|
538 |
|
---|
539 | # kBuild files which might be of interest.
|
---|
540 | FILE_KBUILD_HEADER := $(KBUILD_PATH)/header.kmk
|
---|
541 | #FILE_KBUILD_CONFIG := $(KBUILD_PATH)/config.kmk
|
---|
542 | FILE_KBUILD_FOOTER := $(KBUILD_PATH)/footer.kmk
|
---|
543 | FILE_KBUILD_SUB_HEADER := $(KBUILD_PATH)/subheader.kmk
|
---|
544 | FILE_KBUILD_SUB_FOOTER := $(KBUILD_PATH)/subfooter.kmk
|
---|
545 |
|
---|
546 | ## MAKEFILE is the name of the main makefile.
|
---|
547 | MAKEFILE := $(firstword $(MAKEFILE_LIST))
|
---|
548 | ## MAKEFILE_CURRENT is the name of the current makefile.
|
---|
549 | # This is updated everything a sub-makefile is included.
|
---|
550 | MAKEFILE_CURRENT := $(MAKEFILE)
|
---|
551 |
|
---|
552 |
|
---|
553 | ## @todo this should be done via SUFF_XYZ.target/host...
|
---|
554 |
|
---|
555 | #
|
---|
556 | # Build platform setup.
|
---|
557 | # (PORTME)
|
---|
558 | #
|
---|
559 | if1of ($(KBUILD_HOST), win nt)
|
---|
560 | # Win, Win32, Win64, NT.
|
---|
561 | EXEC_X86_WIN32 :=
|
---|
562 | HOSTSUFF_EXE := .exe
|
---|
563 |
|
---|
564 | # OS/2.
|
---|
565 | else ifeq ($(KBUILD_HOST),os2)
|
---|
566 | EXEC_X86_WIN32 := innopec.exe
|
---|
567 | HOSTSUFF_EXE := .exe
|
---|
568 |
|
---|
569 | else if1of ($(KBUILD_HOST), freebsd dragonfly linux openbsd netbsd)
|
---|
570 | # Unix (like) systems with wine.
|
---|
571 | EXEC_X86_WIN32 := wine
|
---|
572 | HOSTSUFF_EXE :=
|
---|
573 |
|
---|
574 | else
|
---|
575 | # Unix (like) systems without wine.
|
---|
576 | EXEC_X86_WIN32 := false
|
---|
577 | HOSTSUFF_EXE :=
|
---|
578 | endif
|
---|
579 |
|
---|
580 |
|
---|
581 | #
|
---|
582 | # Build target setup.
|
---|
583 | # (PORTME)
|
---|
584 | #
|
---|
585 | SUFF_DEP := .dep
|
---|
586 | SUFF_BIN :=
|
---|
587 | if1of ($(KBUILD_TARGET), win nt os2)
|
---|
588 | SUFF_OBJ := .obj
|
---|
589 | SUFF_LIB := .lib
|
---|
590 | SUFF_DLL := .dll
|
---|
591 | SUFF_EXE := .exe
|
---|
592 | SUFF_SYS := .sys
|
---|
593 | SUFF_RES := .res
|
---|
594 | else ifeq ($(KBUILD_TARGET),l4)
|
---|
595 | SUFF_OBJ := .o
|
---|
596 | SUFF_LIB := .a
|
---|
597 | SUFF_DLL := .s.so
|
---|
598 | SUFF_EXE :=
|
---|
599 | SUFF_SYS := .a
|
---|
600 | SUFF_RES :=
|
---|
601 | else ifeq ($(KBUILD_TARGET),darwin)
|
---|
602 | SUFF_OBJ := .o
|
---|
603 | SUFF_LIB := .a
|
---|
604 | SUFF_DLL := .dylib
|
---|
605 | SUFF_EXE :=
|
---|
606 | SUFF_SYS :=
|
---|
607 | SUFF_RES :=
|
---|
608 | else
|
---|
609 | SUFF_OBJ := .o
|
---|
610 | SUFF_LIB := .a
|
---|
611 | SUFF_DLL := .so
|
---|
612 | SUFF_EXE :=
|
---|
613 | if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd) ## @todo check netbsd and openbsd.
|
---|
614 | SUFF_SYS := .ko
|
---|
615 | else
|
---|
616 | SUFF_SYS :=
|
---|
617 | endif
|
---|
618 | SUFF_RES :=
|
---|
619 | endif
|
---|
620 |
|
---|
621 | #
|
---|
622 | # Standard kBuild tools.
|
---|
623 | #
|
---|
624 | ifeq ($(KMK),kmk)
|
---|
625 | KMK := $(KBUILD_BIN_PATH)/kmk$(HOSTSUFF_EXE)
|
---|
626 | endif
|
---|
627 | MAKE := $(KMK)
|
---|
628 |
|
---|
629 | GMAKE := $(KBUILD_BIN_PATH)/kmk_gmake$(HOSTSUFF_EXE)
|
---|
630 |
|
---|
631 | #DEP_EXT := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
|
---|
632 | #DEP_INT := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE)
|
---|
633 | #DEP := $(DEP_INT)
|
---|
634 |
|
---|
635 | DEP_IDB_EXT := $(KBUILD_BIN_PATH)/kDepIDB$(HOSTSUFF_EXE)
|
---|
636 | DEP_IDB_INT := kmk_builtin_kDepIDB
|
---|
637 | DEP_IDB := $(DEP_IDB_INT)
|
---|
638 |
|
---|
639 | DEP_PRE := $(KBUILD_BIN_PATH)/kDepPre$(HOSTSUFF_EXE)
|
---|
640 |
|
---|
641 | KOBJCACHE_EXT := $(KBUILD_BIN_PATH)/kObjCache$(HOSTSUFF_EXE)
|
---|
642 | KOBJCACHE := $(KOBJCACHE_EXT)
|
---|
643 |
|
---|
644 | KLIBTWEAKER_EXT := $(KBUILD_BIN_PATH)/kLibTweaker$(HOSTSUFF_EXE)
|
---|
645 | KLIBTWEAKER := $(KLIBTWEAKER_EXT)
|
---|
646 |
|
---|
647 | APPEND_EXT := $(KBUILD_BIN_PATH)/kmk_append$(HOSTSUFF_EXE)
|
---|
648 | APPEND_INT := kmk_builtin_append
|
---|
649 | APPEND := $(APPEND_INT)
|
---|
650 |
|
---|
651 | CAT_EXT := $(KBUILD_BIN_PATH)/kmk_cat$(HOSTSUFF_EXE)
|
---|
652 | CAT_INT := kmk_builtin_cat
|
---|
653 | CAT := $(CAT_INT)
|
---|
654 |
|
---|
655 | CHMOD_EXT := $(KBUILD_BIN_PATH)/kmk_chmod$(HOSTSUFF_EXE)
|
---|
656 | CHMOD_INT := kmk_builtin_chmod
|
---|
657 | CHMOD := $(CHMOD_INT)
|
---|
658 |
|
---|
659 | CMP_EXT := $(KBUILD_BIN_PATH)/kmk_cmp$(HOSTSUFF_EXE)
|
---|
660 | CMP_INT := kmk_builtin_cmp
|
---|
661 | CMP := $(CMP_INT)
|
---|
662 |
|
---|
663 | CP_EXT := $(KBUILD_BIN_PATH)/kmk_cp$(HOSTSUFF_EXE)
|
---|
664 | CP_INT := kmk_builtin_cp
|
---|
665 | CP := $(CP_INT)
|
---|
666 |
|
---|
667 | ECHO_EXT := $(KBUILD_BIN_PATH)/kmk_echo$(HOSTSUFF_EXE)
|
---|
668 | ECHO_INT := kmk_builtin_echo
|
---|
669 | ECHO := $(ECHO_INT)
|
---|
670 |
|
---|
671 | EXPR_EXT := $(KBUILD_BIN_PATH)/kmk_expr$(HOSTSUFF_EXE)
|
---|
672 | EXPR_INT := kmk_builtin_expr
|
---|
673 | EXPR := $(EXPR_INT)
|
---|
674 |
|
---|
675 | INSTALL_EXT := $(KBUILD_BIN_PATH)/kmk_install$(HOSTSUFF_EXE)
|
---|
676 | INSTALL_INT := kmk_builtin_install
|
---|
677 | INSTALL := $(INSTALL_INT)
|
---|
678 |
|
---|
679 | LN_EXT := $(KBUILD_BIN_PATH)/kmk_ln$(HOSTSUFF_EXE)
|
---|
680 | LN_INT := kmk_builtin_ln
|
---|
681 | LN := $(LN_INT)
|
---|
682 |
|
---|
683 | MD5SUM_EXT := $(KBUILD_BIN_PATH)/kmk_md5sum$(HOSTSUFF_EXE)
|
---|
684 | MD5SUM_INT := kmk_builtin_md5sum
|
---|
685 | MD5SUM := $(MD5SUM_INT)
|
---|
686 |
|
---|
687 | MKDIR_EXT := $(KBUILD_BIN_PATH)/kmk_mkdir$(HOSTSUFF_EXE)
|
---|
688 | MKDIR_INT := kmk_builtin_mkdir
|
---|
689 | MKDIR := $(MKDIR_INT)
|
---|
690 |
|
---|
691 | MV_EXT := $(KBUILD_BIN_PATH)/kmk_mv$(HOSTSUFF_EXE)
|
---|
692 | MV_INT := kmk_builtin_mv
|
---|
693 | MV := $(MV_INT)
|
---|
694 |
|
---|
695 | PRINTF_EXT := $(KBUILD_BIN_PATH)/kmk_printf$(HOSTSUFF_EXE)
|
---|
696 | PRINTF_INT := kmk_builtin_printf
|
---|
697 | PRINTF := $(PRINTF_INT)
|
---|
698 |
|
---|
699 | REDIRECT_EXT:= $(KBUILD_BIN_PATH)/kmk_redirect$(HOSTSUFF_EXE)
|
---|
700 | REDIRECT_INT:= $(REDIRECT_EXT)
|
---|
701 | REDIRECT := $(REDIRECT_INT)
|
---|
702 |
|
---|
703 | RM_EXT := $(KBUILD_BIN_PATH)/kmk_rm$(HOSTSUFF_EXE)
|
---|
704 | RM_INT := kmk_builtin_rm
|
---|
705 | RM := $(RM_INT)
|
---|
706 |
|
---|
707 | RMDIR_EXT := $(KBUILD_BIN_PATH)/kmk_rmdir$(HOSTSUFF_EXE)
|
---|
708 | RMDIR_INT := kmk_builtin_rmdir
|
---|
709 | RMDIR := $(RMDIR_INT)
|
---|
710 |
|
---|
711 | SED_EXT := $(KBUILD_BIN_PATH)/kmk_sed$(HOSTSUFF_EXE)
|
---|
712 | SED_INT := $(SED_EXT)
|
---|
713 | SED := $(SED_EXT)
|
---|
714 |
|
---|
715 | SLEEP_INT := kmk_builtin_sleep
|
---|
716 | SLEEP_EXT := $(KBUILD_BIN_PATH)/kmk_sleep$(HOSTSUFF_EXE)
|
---|
717 | SLEEP := $(SLEEP_EXT)
|
---|
718 |
|
---|
719 | TEST_EXT := $(KBUILD_BIN_PATH)/kmk_test$(HOSTSUFF_EXE)
|
---|
720 | TEST_INT := kmk_builtin_test
|
---|
721 | TEST := $(TEST_INT)
|
---|
722 |
|
---|
723 | TIME_EXT := $(KBUILD_BIN_PATH)/kmk_time$(HOSTSUFF_EXE)
|
---|
724 | TIME_INT := $(TIME_EXT)
|
---|
725 | TIME := $(TIME_INT)
|
---|
726 |
|
---|
727 | # Our default shell is the Almquist shell from *BSD.
|
---|
728 | ASH := $(KBUILD_BIN_PATH)/kmk_ash$(HOSTSUFF_EXE)
|
---|
729 | MAKESHELL := $(ASH)
|
---|
730 | SHELL := $(ASH)
|
---|
731 | export SHELL MAKESHELL
|
---|
732 |
|
---|
733 | # Symlinking is problematic on some platforms...
|
---|
734 | LN_SYMLINK := $(LN) -s
|
---|
735 |
|
---|
736 | # When copying to the staging area, use hard links to save time and space.
|
---|
737 | ifndef KBUILD_NO_HARD_LINKING
|
---|
738 | INSTALL_STAGING := $(INSTALL) --hard-link-files-when-possible
|
---|
739 | else
|
---|
740 | INSTALL_STAGING := $(INSTALL)
|
---|
741 | endif
|
---|
742 |
|
---|
743 |
|
---|
744 | #
|
---|
745 | # Some Functions.
|
---|
746 | # The lower cased ones are either fallbacks or candidates for functions.c.
|
---|
747 | #
|
---|
748 |
|
---|
749 | ## ABSPATH - make paths absolute.
|
---|
750 | # This implementation is clumsy and doesn't resolve '..' and '.' components.
|
---|
751 | #
|
---|
752 | # @param $1 The paths to make absolute.
|
---|
753 | # @obsolete Use the GNU make function $(abspath) directly now.
|
---|
754 | ABSPATH = $(abspath $(1))$(warning ABSPATH is deprecated, use abspath directly!)
|
---|
755 |
|
---|
756 | ## DIRDEP - make create directory dependencies.
|
---|
757 | #
|
---|
758 | # @param $1 The paths to the directories which must be created.
|
---|
759 | DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
|
---|
760 |
|
---|
761 | ## Cygwin kludge.
|
---|
762 | # This converts /cygdrive/x/% to x:%.
|
---|
763 | #
|
---|
764 | # @param $1 The paths to make native.
|
---|
765 | # @remark This macro is pretty much obsolete since we don't use cygwin base make.
|
---|
766 | ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
|
---|
767 | CYGPATHMIXED = $(foreach path,$(1)\
|
---|
768 | ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
|
---|
769 | else
|
---|
770 | CYGPATHMIXED = $(1)
|
---|
771 | endif
|
---|
772 |
|
---|
773 | ## Removes the drive letter from a path (if it has one)
|
---|
774 | # @param $1 the path
|
---|
775 | no-drive = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
|
---|
776 |
|
---|
777 | ## Removes the root slash from a path (if it has one)
|
---|
778 | # @param $1 the path
|
---|
779 | no-root-slash = $(patsubst /%,%,$(1))
|
---|
780 |
|
---|
781 | ##
|
---|
782 | # Similar to firstword, except it returns the value of first defined variable.
|
---|
783 | # @param $1 list of variables to probe.
|
---|
784 | define FIRST-DEFINED-VAR
|
---|
785 | local .RETURN := $(strip $(firstdefined $1, value))
|
---|
786 | endef
|
---|
787 |
|
---|
788 | ## Figure out where to put object files.
|
---|
789 | # @param $1 real target name.
|
---|
790 | # @param $2 normalized main target
|
---|
791 | TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(1)))
|
---|
792 |
|
---|
793 | ## Figure out where to put object files.
|
---|
794 | # @param $1 normalized main target
|
---|
795 | TARGET_PATH = $(PATH_TARGET)/$(1)
|
---|
796 |
|
---|
797 | ##
|
---|
798 | # Checks if the specified short option ($1) is found in the flags ($2),
|
---|
799 | # assuming getopt style options.
|
---|
800 | #
|
---|
801 | # @returns $3 if present, $4 not.
|
---|
802 | #
|
---|
803 | # @param $1 The option (single char!).
|
---|
804 | # @param $2 The option arguments.
|
---|
805 | # @param $3 Eval and return if present.
|
---|
806 | # @param $4 Eval and return if not present.
|
---|
807 | #
|
---|
808 | # @todo May confuse option values starting with '-' for options.
|
---|
809 | # @remarks Invoke like this: $(evalcall KB_FN_OPT_TEST_SHORT,d,$(flags),present,not-present)
|
---|
810 | #
|
---|
811 | define KB_FN_OPT_TEST_SHORT
|
---|
812 | local options := $(translate $(strip $(filter -%,$(filter-out --%,$2))),$(SP)-,)
|
---|
813 | local .RETURN := $(if-expr $(pos $1,$(options)) != 0,$3,$4)
|
---|
814 | endef
|
---|
815 |
|
---|
816 | ##
|
---|
817 | # Checks if the specified long option ($1) is found in the flags ($2),
|
---|
818 | # assuming getopt style options.
|
---|
819 | #
|
---|
820 | # @returns $3 if present, $4 not.
|
---|
821 | #
|
---|
822 | # @param $1 The long option, dashes included. No % chars.
|
---|
823 | # @param $2 The option arguments.
|
---|
824 | # @param $3 Eval and return if present.
|
---|
825 | # @param $4 Eval and return if not present.
|
---|
826 | #
|
---|
827 | # @todo May confuse option values starting with '--' for options.
|
---|
828 | # @remarks Invoke like this: $(evalcall KBFN_OPT_TEST_SHORT,--defined,$(flags),present,not-present)
|
---|
829 | #
|
---|
830 | define KB_FN_OPT_TEST_LONG
|
---|
831 | local options := $(filter-out =delete=%,$(subst :, =delete=,$(subst =, =delete=,$2)))
|
---|
832 | local .RETURN := $(if-expr "$(filter $1,$(options))" != "",$3,$4)
|
---|
833 | endef
|
---|
834 |
|
---|
835 | ##
|
---|
836 | # Checks if the specified short ($1) or long ($2) option is found in the flags ($2),
|
---|
837 | # assuming getopt style options.
|
---|
838 | #
|
---|
839 | # @returns $4 if present, $5 not.
|
---|
840 | #
|
---|
841 | # @param $1 The short option (single char!).
|
---|
842 | # @param $2 The long option, dashes included. No % chars.
|
---|
843 | # @param $3 The option arguments.
|
---|
844 | # @param $4 Eval and return if present.
|
---|
845 | # @param $5 Eval and return if not present.
|
---|
846 | #
|
---|
847 | # @todo May confuse option values starting with '--' for options.
|
---|
848 | # @remarks Invoke like this: $(evalcall KB_FN_OPT_TEST_SHORT_LONG,d,--defined,$(flags),present,not-present)
|
---|
849 | #
|
---|
850 | define KB_FN_OPT_TEST_SHORT_LONG
|
---|
851 | local short_options := $(translate $(strip $(filter -%,$(filter-out --%,$3))),$(SP)-,)
|
---|
852 | local long_options := $(filter-out =delete=%,$(subst :, =delete=,$(subst =, =delete=,$3)))
|
---|
853 | local .RETURN := $(if-expr $(pos $1,$(short_options)) != 0 || "$(filter $2,$(long_options))" != "",$4,$5)
|
---|
854 | endef
|
---|
855 |
|
---|
856 | ##
|
---|
857 | # Make an assignment to a deprecated variable.
|
---|
858 | #
|
---|
859 | # @param $1 The variable name.
|
---|
860 | # @param $2 The value.
|
---|
861 | # @param $3 The variable to use instead.
|
---|
862 | #
|
---|
863 | ifdef KBUILD_WITH_DEPREATED_AS_ERROR
|
---|
864 | KB_FN_ASSIGN_DEPRECATED = $(eval $(subst :,$$(COLON),$1) = $2$$(error $1 is deprecated, use $3 instead))
|
---|
865 | else
|
---|
866 | KB_FN_ASSIGN_DEPRECATED = $(eval $(subst :,$$(COLON),$1) = $2$$(warning $1 is deprecated, use $3 instead))
|
---|
867 | endif
|
---|
868 |
|
---|
869 | ##
|
---|
870 | # Show an assertion message.
|
---|
871 | #
|
---|
872 | # @param $1 The assertion name.
|
---|
873 | # @param $2 The details.
|
---|
874 | #
|
---|
875 | define KB_FN_ASSERT_MSG
|
---|
876 | $(info !! kBuild $1 Assertion Failed !!)
|
---|
877 | ifdef target
|
---|
878 | $(info !! target: $(target))
|
---|
879 | local varloc := $(where $(target))
|
---|
880 | if "$(varloc)" == "undefined"
|
---|
881 | local varloc := $(where $(target)_TEMPLATE)
|
---|
882 | endif
|
---|
883 | if "$(varloc)" == "undefined"
|
---|
884 | local varloc := $(where $(target)_SOURCES)
|
---|
885 | endif
|
---|
886 | if "$(varloc)" == "undefined"
|
---|
887 | local varloc := $(where $(target)_EXTENDS)
|
---|
888 | endif
|
---|
889 | if "$(varloc)" == "undefined"
|
---|
890 | local varloc := $(where target)
|
---|
891 | endif
|
---|
892 | ifneq ($(varloc),)
|
---|
893 | $(info !! location: $(varloc))
|
---|
894 | else
|
---|
895 | $(info !! probable location: $($(target)_DEFPATH)/Makefile.kmk)
|
---|
896 | endif
|
---|
897 | endif
|
---|
898 | $(info !! $2)
|
---|
899 | $(error fixme)
|
---|
900 | endef
|
---|
901 |
|
---|
902 | ##
|
---|
903 | # Throw an error if the given path $1 isn't absolute and assertions are enabled.
|
---|
904 | #
|
---|
905 | # @param $1 The name of the path variable to check.
|
---|
906 | #
|
---|
907 | ifdef KBUILD_INTERNAL_STRICT
|
---|
908 | KB_FN_ASSERT_ABSPATH = $(if-expr "$(abspath $($(strip $1)))" != "$(strip $($(strip $1)))",\
|
---|
909 | $(evalcall KB_FN_ASSERT_MSG,abspath,$1 is:$(NLTAB)'$($(strip $1))'$(NLTAB)expected:$(NLTAB)'$(abspath $($(strip $1)))'))
|
---|
910 | else
|
---|
911 | KB_FN_ASSERT_ABSPATH :=
|
---|
912 | endif
|
---|
913 |
|
---|
914 |
|
---|
915 | #
|
---|
916 | # Initialize some of the globals which the Config.kmk and
|
---|
917 | # others can add stuff to if they like for processing in the footer.
|
---|
918 | #
|
---|
919 |
|
---|
920 | ## KBUILD_TEMPLATE_PATHS
|
---|
921 | # List a paths (separated by space) where templates can be found.
|
---|
922 | KBUILD_TEMPLATE_PATHS :=
|
---|
923 |
|
---|
924 | ## KBUILD_TOOL_PATHS
|
---|
925 | # List of paths (separated by space) where tools can be found.
|
---|
926 | KBUILD_TOOL_PATHS :=
|
---|
927 |
|
---|
928 | ## KBUILD_SDK_PATHS
|
---|
929 | # List of paths (separated by space) where SDKs can be found.
|
---|
930 | KBUILD_SDK_PATHS :=
|
---|
931 |
|
---|
932 | ## KBUILD_UNIT_PATHS
|
---|
933 | # List of paths (separated by space) where units (USES) can be found.
|
---|
934 | KBUILD_UNIT_PATHS :=
|
---|
935 |
|
---|
936 | ## KBUILD_DEFAULT_PATHS
|
---|
937 | # List of paths (separated by space) to search for stuff as a last resort.
|
---|
938 | KBUILD_DEFAULT_PATHS :=
|
---|
939 |
|
---|
940 | ## Proritized list of the default makefile when walking subdirectories.
|
---|
941 | # The user can overload this list.
|
---|
942 | DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
|
---|
943 |
|
---|
944 | ## KBUILD_SRC_HANDLERS
|
---|
945 | # The list of source handlers, pair of extension and handler.
|
---|
946 | # The user can overload this list to provide additional or custom
|
---|
947 | # handlers. On a per-target/template see SRC_HANDLERS.
|
---|
948 | KBUILD_SRC_HANDLERS := \
|
---|
949 | .c:def_src_handler_c \
|
---|
950 | .C:def_src_handler_c \
|
---|
951 | .cxx:def_src_handler_cxx \
|
---|
952 | .CXX:def_src_handler_cxx \
|
---|
953 | .cpp:def_src_handler_cxx \
|
---|
954 | .CPP:def_src_handler_cxx \
|
---|
955 | .cc:def_src_handler_cxx \
|
---|
956 | .CC:def_src_handler_cxx \
|
---|
957 | .m:def_src_handler_objc \
|
---|
958 | .M:def_src_handler_objcxx \
|
---|
959 | .mm:def_src_handler_objcxx \
|
---|
960 | .asm:def_src_handler_asm \
|
---|
961 | .ASM:def_src_handler_asm \
|
---|
962 | .s:def_src_handler_asm \
|
---|
963 | .S:def_src_handler_asm \
|
---|
964 | .rc:def_src_handler_rc \
|
---|
965 | .obj:def_src_handler_obj \
|
---|
966 | .o:def_src_handler_obj \
|
---|
967 | .res:def_src_handler_obj
|
---|
968 |
|
---|
969 | ## PROPS_TOOLS
|
---|
970 | # This is a subset of PROPS_SINGLE.
|
---|
971 | PROPS_TOOLS := TOOL CTOOL CXXTOOL OBJCTOOL OBJCXXTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
|
---|
972 |
|
---|
973 | ## PROPS_SINGLE
|
---|
974 | # The list of non-accumulative target properties.
|
---|
975 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
976 | # will do the necessary inheritance for templates, sdks, tools and targets.
|
---|
977 | PROPS_SINGLE := $(PROPS_TOOLS) TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
|
---|
978 | OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF OBJCXXOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF BINSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF \
|
---|
979 | MODE UID GID LD_DEBUG DEBUG_INSTTYPE DEBUG_INST DEBUG_STAGE
|
---|
980 | ## PROPS_SINGLE_LNK
|
---|
981 | # Subset of PROPS_SINGLE which applies to all linkable targets.
|
---|
982 | PROPS_SINGLE_LNK := $(filter-out FETCHTOOL UNPACKTOOL PATCHTOOL FETCHDIR, $(PROPS_SINGLE))
|
---|
983 |
|
---|
984 | ## PROPS_DEFERRED
|
---|
985 | # This list of non-accumulative target properties which are or may be
|
---|
986 | # functions, and thus should not be expanded until the very last moment.
|
---|
987 | PROPS_DEFERRED := INSTFUN INSTALLER PRE_CMDS POST_CMDS PRE_INST_CMDS POST_INST_CMDS \
|
---|
988 | PRE_FILE_CMDS POST_FILE_CMDS PRE_SYMLINK_CMDS POST_SYMLINK_CMDS PRE_DIRECTORY_CMDS POST_DIRECTORY_CMDS \
|
---|
989 | NAME SONAME
|
---|
990 |
|
---|
991 | ## PROPS_ACCUMULATE_R
|
---|
992 | # The list of accumulative target properties where the right most value/flag
|
---|
993 | # is the 'most significant'.
|
---|
994 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
995 | # will do the necessary inheritance from templates to targets.
|
---|
996 | PROPS_ACCUMULATE_R := \
|
---|
997 | DEPS LNK_DEPS ORDERDEPS LNK_ORDERDEPS DEFS \
|
---|
998 | ARFLAGS \
|
---|
999 | CFLAGS CDEFS \
|
---|
1000 | CXXFLAGS CXXDEFS \
|
---|
1001 | OBJCFLAGS OBJCDEFS \
|
---|
1002 | OBJCXXFLAGS OBJCXXDEFS \
|
---|
1003 | ASFLAGS ASDEFS \
|
---|
1004 | RCFLAGS RCDEFS \
|
---|
1005 | LDFLAGS \
|
---|
1006 | IDFLAGS IFFLAGS EXEC_IFFLAGS ISFLAGS \
|
---|
1007 | FETCHFLAGS UNPACKFLAGS PATCHFLAGS
|
---|
1008 | ## PROPS_ACCUMULATE_R_LNK
|
---|
1009 | # Subset of PROPS_ACCUMULATE_R which applies to all linkable targets.
|
---|
1010 | PROPS_ACCUMULATE_R_LNK := $(filter-out ARFLAGS LDFLAGS EXEC_IFFLAGS FETCHFLAGS UNPACKFLAGS PATCHFLAGS, $(PROPS_ACCUMULATE_R))
|
---|
1011 |
|
---|
1012 | ## PROPS_ACCUMULATE
|
---|
1013 | # The list of accumulative target properties where the left most value/flag
|
---|
1014 | # is the 'most significant'.
|
---|
1015 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
1016 | # will do the necessary inheritance from templates to targets.
|
---|
1017 | PROPS_ACCUMULATE_L := \
|
---|
1018 | SDKS USES SOURCES EXEC_SOURCES SRC_HANDLERS INTERMEDIATES \
|
---|
1019 | INCS CINCS CXXINCS OBJCINCS OBJCXXINCS ASINCS RCINCS \
|
---|
1020 | LIBS LIBPATH \
|
---|
1021 | DIRS BLDDIRS CLEAN
|
---|
1022 | ## PROPS_ACCUMULATE_L_LNK
|
---|
1023 | # Subset of PROPS_ACCUMULATE_L which applies to all linkable targets.
|
---|
1024 | PROPS_ACCUMULATE_L_LNK := $(filter-out LIBS LIBPATH EXEC_SOURCES DIRS, $(PROPS_ACCUMULATE_L))
|
---|
1025 |
|
---|
1026 | ## PROPS_ALL
|
---|
1027 | # List of all the properties.
|
---|
1028 | PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
|
---|
1029 |
|
---|
1030 | ## @name Properties valid on programs (BLDPROGS and PROGRAMS)
|
---|
1031 | ## @{
|
---|
1032 | PROPS_PROGRAMS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL EXESUFF
|
---|
1033 | PROPS_PROGRAMS_DEFERRED := $(PROPS_DEFERRED)
|
---|
1034 | PROPS_PROGRAMS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
1035 | PROPS_PROGRAMS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
1036 | ## @}
|
---|
1037 |
|
---|
1038 | ## @name Properties valid on libraries (LIBRARIES and IMPORT_LIBS)
|
---|
1039 | ## @{
|
---|
1040 | PROPS_LIBRARIES_SINGLE := $(PROPS_SINGLE_LNK) ARTOOL LIBSUFF ARLIBSUFF LIBSUFF
|
---|
1041 | PROPS_LIBRARIES_DEFERRED := $(filter-out SONAME,$(PROPS_DEFERRED))
|
---|
1042 | PROPS_LIBRARIES_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) ARFLAGS
|
---|
1043 | PROPS_LIBRARIES_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK)
|
---|
1044 | ## @}
|
---|
1045 |
|
---|
1046 | ## @name Properties valid on dlls (DLLS)
|
---|
1047 | ## @{
|
---|
1048 | PROPS_DLLS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL DLLSUFF LIBSUFF
|
---|
1049 | PROPS_DLLS_DEFERRED := $(PROPS_DEFERRED)
|
---|
1050 | PROPS_DLLS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
1051 | PROPS_DLLS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
1052 | ## @}
|
---|
1053 |
|
---|
1054 | ## @name Properties valid on system modules (SYSMODS)
|
---|
1055 | ## @{
|
---|
1056 | PROPS_SYSMODS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL SYSSUFF
|
---|
1057 | PROPS_SYSMODS_DEFERRED := $(PROPS_DEFERRED)
|
---|
1058 | PROPS_SYSMODS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
1059 | PROPS_SYSMODS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
1060 | ## @}
|
---|
1061 |
|
---|
1062 | ## @name Properties valid on misc binaries (MISCBINS)
|
---|
1063 | ## @{
|
---|
1064 | PROPS_MISCBINS_SINGLE := $(PROPS_SINGLE_LNK) LDTOOL BINSUFF
|
---|
1065 | PROPS_MISCBINS_DEFERRED := $(PROPS_DEFERRED)
|
---|
1066 | PROPS_MISCBINS_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
|
---|
1067 | PROPS_MISCBINS_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
|
---|
1068 | ## @}
|
---|
1069 |
|
---|
1070 | ## @name Properties valid on installs (INSTALLS)
|
---|
1071 | ## @{
|
---|
1072 | PROPS_INSTALLS_SINGLE := TOOL TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU MODE UID GID
|
---|
1073 | PROPS_INSTALLS_DEFERRED := INSTFUN INSTALLER PRE_FILE_CMDS POST_FILE_CMDS PRE_SYMLINK_CMDS POST_SYMLINK_CMDS \
|
---|
1074 | PRE_DIRECTORY_CMDS POST_DIRECTORY_CMDS
|
---|
1075 | PROPS_INSTALLS_ACCUMULATE_R := DEPS ORDERDEPS GOALS INST_ONLY_GOALS STAGE_ONLY_GOALS IFFLAGS EXEC_IFFLAGS
|
---|
1076 | PROPS_INSTALLS_ACCUMULATE_L := SOURCES EXEC_SOURCES DIRS CLEAN
|
---|
1077 | ## @}
|
---|
1078 |
|
---|
1079 | ## @name Properties valid on fetches (FETCHES)
|
---|
1080 | ## @{
|
---|
1081 | PROPS_FETCHES_SINGLE := TOOL TEMPLATE FETCHTOOL UNPACKTOOL PATCHTOOL INST FETCHDIR
|
---|
1082 | PROPS_FETCHES_DEFERRED :=
|
---|
1083 | PROPS_FETCHES_ACCUMULATE_R := FETCHFLAGS UNPACKFLAGS PATCHFLAGS
|
---|
1084 | PROPS_FETCHES_ACCUMULATE_L := SOURCES CLEAN
|
---|
1085 | ## @}
|
---|
1086 |
|
---|
1087 | ## KBUILD_COMPILE_CATEGTORIES
|
---|
1088 | # Tools categories for compiling.
|
---|
1089 | KBUILD_COMPILE_CATEGTORIES := AS C CXX OBJC OBJCXX RC
|
---|
1090 |
|
---|
1091 | ## KBUILD_GENERIC_CATEGORIES
|
---|
1092 | # Generic tool categories.
|
---|
1093 | KBUILD_GENERIC_CATEGORIES := FETCH UNPACK PATCH $(addprefix LINK_,LIBRARY PROGRAM DLL SYSMOD MISCBIN)
|
---|
1094 |
|
---|
1095 | ## PROPS_TOOLS_ONLY
|
---|
1096 | # Properties found only on tools.
|
---|
1097 | # This is expanded in a deferred manner, so it will pick up changes made to
|
---|
1098 | # KBUILD_COMPILE_CATEGTORIES and KBUILD_GENERIC_CATEGORIES made by units.
|
---|
1099 | PROPS_TOOLS_ONLY = \
|
---|
1100 | $(foreach cat, $(KBUILD_COMPILE_CATEGTORIES), \
|
---|
1101 | COMPILE_$(cat)_CMDS \
|
---|
1102 | COMPILE_$(cat)_OUTPUT \
|
---|
1103 | COMPILE_$(cat)_OUTPUT_MAYBE \
|
---|
1104 | COMPILE_$(cat)_DEPEND \
|
---|
1105 | COMPILE_$(cat)_DEPORD \
|
---|
1106 | COMPILE_$(cat)_USES_KOBJCACHE ) \
|
---|
1107 | $(foreach cat, $(KBUILD_GENERIC_CATEGORIES), \
|
---|
1108 | $(cat)_CMDS \
|
---|
1109 | $(cat)_OUTPUT \
|
---|
1110 | $(cat)_OUTPUT_MAYBE \
|
---|
1111 | $(cat)_DEPEND \
|
---|
1112 | $(cat)_DEPORD ))
|
---|
1113 |
|
---|
1114 |
|
---|
1115 | #
|
---|
1116 | # Here is a special 'hack' to prevent innocent environment variables being
|
---|
1117 | # picked up and treated as properties. (The most annoying example of why
|
---|
1118 | # this is necessary is the Visual C++ commandline with it's LIBPATH.)
|
---|
1119 | #
|
---|
1120 | # Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to
|
---|
1121 | # disable this 'hack'.
|
---|
1122 | #
|
---|
1123 | ifndef KBUILD_DONT_KILL_ENV_PROPS
|
---|
1124 |
|
---|
1125 | define def_nuke_environment_prop
|
---|
1126 | ifeq ($(origin $(prop)),environment)
|
---|
1127 | $(prop) =
|
---|
1128 | endif
|
---|
1129 | endef
|
---|
1130 | $(foreach prop, $(PROPS_ALL) \
|
---|
1131 | FETCHES PATCHES BLDPROGS LIBRARIES IMPORT_LIBS DLLS PROGRAMS SYSMODS MISCBINS INSTALLS OTHERS \
|
---|
1132 | SUBDIRS MAKEFILES BLDDIRS \
|
---|
1133 | ,$(eval $(value def_nuke_environment_prop)))
|
---|
1134 |
|
---|
1135 | endif # KBUILD_DONT_KILL_ENV_PROPS
|
---|
1136 |
|
---|
1137 |
|
---|
1138 | #
|
---|
1139 | # Pass configuration.
|
---|
1140 | #
|
---|
1141 | # The PASS_<passname>_trgs variable is listing the targets.
|
---|
1142 | # The PASS_<passname>_vars variable is listing the target variables.
|
---|
1143 | # The PASS_<passname>_pass variable is the lowercased passname.
|
---|
1144 | #
|
---|
1145 |
|
---|
1146 | ## PASS: fetches
|
---|
1147 | # This pass fetches and unpacks things needed to complete the build.
|
---|
1148 | PASS_FETCHES := Fetches
|
---|
1149 | PASS_FETCHES_trgs :=
|
---|
1150 | PASS_FETCHES_vars := _FETCHES
|
---|
1151 | PASS_FETCHES_pass := fetches
|
---|
1152 |
|
---|
1153 | ## PASS: patches
|
---|
1154 | # This pass applies patches.
|
---|
1155 | PASS_PATCHES := Patches
|
---|
1156 | PASS_PATCHES_trgs :=
|
---|
1157 | PASS_PATCHES_vars := _PATCHES
|
---|
1158 | PASS_PATCHES_pass := patches
|
---|
1159 |
|
---|
1160 | ## PASS: bldprogs
|
---|
1161 | # This pass builds targets which are required for building the rest.
|
---|
1162 | PASS_BLDPROGS := Build Programs
|
---|
1163 | PASS_BLDPROGS_trgs :=
|
---|
1164 | PASS_BLDPROGS_vars := _BLDPROGS
|
---|
1165 | PASS_BLDPROGS_pass := bldprogs
|
---|
1166 |
|
---|
1167 | ## PASS: libraries
|
---|
1168 | # This pass builds library targets.
|
---|
1169 | PASS_LIBRARIES := Libraries
|
---|
1170 | PASS_LIBRARIES_trgs :=
|
---|
1171 | PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
|
---|
1172 | PASS_LIBRARIES_pass := libraries
|
---|
1173 |
|
---|
1174 | ## PASS: binaries
|
---|
1175 | # This pass builds dll targets.
|
---|
1176 | PASS_DLLS := DLLs
|
---|
1177 | PASS_DLLS_trgs :=
|
---|
1178 | PASS_DLLS_vars := _DLLS _OTHER_DLLS
|
---|
1179 | PASS_DLLS_pass := dlls
|
---|
1180 |
|
---|
1181 | ## PASS: binaries
|
---|
1182 | # This pass builds binary targets, i.e. programs, system modules and stuff.
|
---|
1183 | PASS_BINARIES := Programs
|
---|
1184 | PASS_BINARIES_trgs :=
|
---|
1185 | PASS_BINARIES_vars := _PROGRAMS _SYSMODS _MISC_BINS _OTHER_BINARIES
|
---|
1186 | PASS_BINARIES_pass := binaries
|
---|
1187 |
|
---|
1188 | ## PASS: others
|
---|
1189 | # This pass builds other targets.
|
---|
1190 | PASS_OTHERS := Other Stuff
|
---|
1191 | PASS_OTHERS_trgs :=
|
---|
1192 | PASS_OTHERS_vars := _OTHERS
|
---|
1193 | PASS_OTHERS_pass := others
|
---|
1194 |
|
---|
1195 | ## PASS: staging
|
---|
1196 | # This pass installs the built entities to a sandbox area.
|
---|
1197 | ## @todo split this up into build install (to sandbox) and real installation.
|
---|
1198 | PASS_STAGING := Staging
|
---|
1199 | PASS_STAGING_trgs :=
|
---|
1200 | PASS_STAGING_vars := _STAGE_DIRS _INSTALLS _STAGE_FILES _DEBUG_STAGE_DIRS _DEBUG_STAGE_FILES
|
---|
1201 | PASS_STAGING_pass := staging
|
---|
1202 |
|
---|
1203 | ## PASS: install
|
---|
1204 | # This pass installs the built entities to where they will be used (using
|
---|
1205 | # DESTROOT or PATH_INS to indicate where this is).
|
---|
1206 | PASS_INSTALLS := Install
|
---|
1207 | PASS_INSTALLS_trgs :=
|
---|
1208 | PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS_FILES _DEBUG_INSTALL_DIRS _DEBUG_INSTALL_FILES
|
---|
1209 | PASS_INSTALLS_pass := installs
|
---|
1210 |
|
---|
1211 | ## PASS: testing
|
---|
1212 | # This pass processes custom rules for executing tests.
|
---|
1213 | PASS_TESTING := Tests
|
---|
1214 | PASS_TESTING_trgs :=
|
---|
1215 | PASS_TESTING_vars := _TESTING
|
---|
1216 | PASS_TESTING_pass := testing
|
---|
1217 |
|
---|
1218 | ## PASS: packing
|
---|
1219 | # This pass processes custom packing rules.
|
---|
1220 | PASS_PACKING := Packing
|
---|
1221 | PASS_PACKING_trgs :=
|
---|
1222 | PASS_PACKING_vars := _PACKING
|
---|
1223 | PASS_PACKING_pass := packing
|
---|
1224 |
|
---|
1225 | ## PASS: clean
|
---|
1226 | # This pass removes all generated files.
|
---|
1227 | PASS_CLEAN := Clean
|
---|
1228 | PASS_CLEAN_trgs := do-clean
|
---|
1229 | PASS_CLEAN_vars :=
|
---|
1230 | PASS_CLEAN_pass := clean
|
---|
1231 |
|
---|
1232 | ## PASS: nothing
|
---|
1233 | # This pass just walks the tree.
|
---|
1234 | PASS_NOTHING := Nothing
|
---|
1235 | PASS_NOTHING_trgs := do-nothing
|
---|
1236 | PASS_NOTHING_vars :=
|
---|
1237 | PASS_NOTHING_pass := nothing
|
---|
1238 |
|
---|
1239 | ## DEFAULT_PASSES
|
---|
1240 | # The default passes and their order.
|
---|
1241 | DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS STAGING
|
---|
1242 |
|
---|
1243 | ## PASSES
|
---|
1244 | # The passes that should be defined. This must include
|
---|
1245 | # all passes mentioned by DEFAULT_PASSES.
|
---|
1246 | PASSES := FETCHES PATCHES $(DEFAULT_PASSES) INSTALLS TESTING PACKING CLEAN NOTHING
|
---|
1247 |
|
---|
1248 |
|
---|
1249 | #
|
---|
1250 | # Check for --pretty-command-printing before including the Config.kmk
|
---|
1251 | # so that anyone overriding the message macros can take the implied
|
---|
1252 | # verbosity level change into account.
|
---|
1253 | #
|
---|
1254 | ifndef KBUILD_VERBOSE
|
---|
1255 | ifndef KBUILD_QUIET
|
---|
1256 | ifeq ($(KMK_OPTS_PRETTY_COMMAND_PRINTING),1)
|
---|
1257 | export KBUILD_VERBOSE := 2
|
---|
1258 | endif
|
---|
1259 | endif
|
---|
1260 | endif
|
---|
1261 |
|
---|
1262 |
|
---|
1263 | #
|
---|
1264 | # Legacy variable translation.
|
---|
1265 | # These will be eliminated when switching to the next version.
|
---|
1266 | #
|
---|
1267 | ifdef USE_KOBJCACHE
|
---|
1268 | ifndef KBUILD_USE_KOBJCACHE
|
---|
1269 | export KBUILD_USE_KOBJCACHE := $(USE_KOBJCACHE)
|
---|
1270 | endif
|
---|
1271 | endif
|
---|
1272 |
|
---|
1273 |
|
---|
1274 | #
|
---|
1275 | # Library path searching hints (target OS + arch).
|
---|
1276 | #
|
---|
1277 | # KBUILD_LIB_SEARCH_SUBS - Subdirs typically containing the right libraries.
|
---|
1278 | # KBUILD_LIB_SEARCH_ROOTS - Roots to search for library subdirs.
|
---|
1279 | # KBUILD_LIB_SEARCH_PATHS - ROOTS + SUBS.
|
---|
1280 | #
|
---|
1281 | ifeq ($(KBUILD_TARGET),darwin)
|
---|
1282 | KBUILD_LIB_SEARCH_ROOTS := \
|
---|
1283 | /usr/ \
|
---|
1284 | /Developer/usr/
|
---|
1285 | KBUILD_LIB_SEARCH_SUBS := lib/
|
---|
1286 |
|
---|
1287 | else if1of ($(KBUILD_TARGET), freebsd netbsd openbsd dragonfly)
|
---|
1288 | KBUILD_LIB_SEARCH_ROOTS := \
|
---|
1289 | / \
|
---|
1290 | /usr/ \
|
---|
1291 | /usr/local/
|
---|
1292 | KBUILD_LIB_SEARCH_SUBS := lib/
|
---|
1293 |
|
---|
1294 | else ifeq ($(KBUILD_TARGET),linux)
|
---|
1295 | ifeq ($(realpath /bin),/usr/bin)
|
---|
1296 | KBUILD_LIB_SEARCH_ROOTS := \
|
---|
1297 | /usr/ \
|
---|
1298 | / \
|
---|
1299 | /usr/local/
|
---|
1300 | else
|
---|
1301 | KBUILD_LIB_SEARCH_ROOTS := \
|
---|
1302 | / \
|
---|
1303 | /usr/ \
|
---|
1304 | /usr/local/
|
---|
1305 | endif
|
---|
1306 | ifeq ($(KBUILD_TARGET_ARCH),amd64)
|
---|
1307 | KBUILD_LIB_SEARCH_SUBS := \
|
---|
1308 | lib/x86_64-linux-gnu/ \
|
---|
1309 | lib64/ \
|
---|
1310 | lib/
|
---|
1311 | else ifeq ($(KBUILD_TARGET_ARCH),x86)
|
---|
1312 | KBUILD_LIB_SEARCH_SUBS := \
|
---|
1313 | lib/i686-linux-gnu/ \
|
---|
1314 | lib/i386-linux-gnu/ \
|
---|
1315 | lib32/ \
|
---|
1316 | lib/
|
---|
1317 | else
|
---|
1318 | KBUILD_LIB_SEARCH_SUBS := lib/
|
---|
1319 | endif
|
---|
1320 |
|
---|
1321 | else ifeq ($(KBUILD_TARGET),solaris)
|
---|
1322 | KBUILD_LIB_SEARCH_ROOTS := \
|
---|
1323 | / \
|
---|
1324 | /usr/ \
|
---|
1325 | /usr/sfw/ \
|
---|
1326 | /usr/local/ \
|
---|
1327 | /sw/
|
---|
1328 | ifeq ($(KBUILD_TARGET_ARCH),amd64)
|
---|
1329 | KBUILD_LIB_SEARCH_SUBS := lib/amd64/ lib/
|
---|
1330 | else ifeq ($(KBUILD_TARGET_ARCH),sparc64)
|
---|
1331 | KBUILD_LIB_SEARCH_SUBS := lib/sparcv9/ lib/
|
---|
1332 | else
|
---|
1333 | KBUILD_LIB_SEARCH_SUBS := lib/
|
---|
1334 | endif
|
---|
1335 |
|
---|
1336 | else
|
---|
1337 | KBUILD_LIB_SEARCH_SUBS :=
|
---|
1338 | KBUILD_LIB_SEARCH_ROOTS :=
|
---|
1339 | endif
|
---|
1340 | KBUILD_LIB_SEARCH_PATHS := $(foreach root, $(KBUILD_LIB_SEARCH_ROOTS), $(addprefix $(root),$(KBUILD_LIB_SEARCH_SUBS)))
|
---|
1341 |
|
---|
1342 |
|
---|
1343 | #
|
---|
1344 | # This is how we find the closest config.kmk.
|
---|
1345 | # It's a little hacky but I think it works fine.
|
---|
1346 | #
|
---|
1347 | _CFGDIR := .
|
---|
1348 | _CFGFILES := ./Config.kmk ./config.kmk
|
---|
1349 | define def_include_config
|
---|
1350 | $(eval _CFGDIR := $(_CFGDIR)/$(dir))
|
---|
1351 | _CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
|
---|
1352 | endef
|
---|
1353 | # walk down the _RELATIVE_ path specified by DEPTH.
|
---|
1354 | $(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
|
---|
1355 | # add the default config file.
|
---|
1356 | _CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
|
---|
1357 | _CFGFILES :=
|
---|
1358 | _CFGDIR :=
|
---|
1359 | ifeq ($(_CFGFILE),)
|
---|
1360 | $(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
|
---|
1361 | endif
|
---|
1362 |
|
---|
1363 | # Include the config.kmk we found file (or the default one).
|
---|
1364 | ifdef KBUILD_PROFILE_SELF
|
---|
1365 | $(evalcall def_profile_self, including $(_CFGFILE))
|
---|
1366 | include $(_CFGFILE)
|
---|
1367 | $(evalcall def_profile_self, included $(_CFGFILE))
|
---|
1368 | else
|
---|
1369 | include $(_CFGFILE)
|
---|
1370 | endif
|
---|
1371 |
|
---|
1372 |
|
---|
1373 |
|
---|
1374 | #
|
---|
1375 | # Finalize a the central path variables now that we've included the Config.kmk file.
|
---|
1376 | #
|
---|
1377 | # This prevents some trouble when users override the defaults for these
|
---|
1378 | # variables and uses relative paths or paths with incorrect case.
|
---|
1379 | #
|
---|
1380 | PATH_OUT_BASE := $(abspath $(PATH_OUT_BASE))
|
---|
1381 | PATH_OUT := $(abspath $(PATH_OUT))
|
---|
1382 | PATH_OBJ := $(abspath $(PATH_OBJ))
|
---|
1383 | PATH_TARGET := $(abspath $(PATH_TARGET))
|
---|
1384 | PATH_INS := $(abspath $(PATH_INS))
|
---|
1385 | PATH_STAGE := $(abspath $(PATH_STAGE))
|
---|
1386 |
|
---|
1387 | # Finalize the install and staging directory layouts.
|
---|
1388 | define def_kbuild_finalize_inst
|
---|
1389 | local val := $(strip $($(y)_$(x)))
|
---|
1390 | ifeq ($(val),)
|
---|
1391 | $(error kBuild: '$(y)_$(x)' is set to an empty value.)
|
---|
1392 | endif
|
---|
1393 | ifneq ($(words $(val)),1)
|
---|
1394 | $(error kBuild: The '$(y)_$(x)' value '$(val)' should not contain spaces.)
|
---|
1395 | endif
|
---|
1396 | ifneq ($(pos \,$(val)), 0)
|
---|
1397 | $(error kBuild: The '$(y)_$(x)' value '$(val)' contains DOS slashes: not allowed.)
|
---|
1398 | endif
|
---|
1399 | ifneq ($(pos $(COLON),$(val)), 0)
|
---|
1400 | $(error kBuild: The '$(y)_$(x)' value '$(val)' contains colon: not allowed.)
|
---|
1401 | endif
|
---|
1402 | ifneq ($(substr $(val),-1), /)
|
---|
1403 | $(error kBuild: The '$(y)_$(x)' value '$(val)' has no trailing slash.)
|
---|
1404 | endif
|
---|
1405 | if $(pos /../,$(val)) != 0 || "$(substr $(val), 3)" == "../"
|
---|
1406 | $(error kBuild: The '$(y)_$(x)' value '$(val)' contains dot-dot escape.)
|
---|
1407 | endif
|
---|
1408 | $($(y)_$(x) := $(val)
|
---|
1409 |
|
---|
1410 | local val := $(strip $(PATH_$(y)_$(x)))
|
---|
1411 | ifeq ($(val),)
|
---|
1412 | $(error kBuild: 'PATH_$(y)_$(x)' is set to an empty value.)
|
---|
1413 | endif
|
---|
1414 | PATH_$(y)_$(x) := $(val)
|
---|
1415 | endef
|
---|
1416 | $(foreach y, INST STAGE, $(foreach x, $(KBUILD_INST_PATHS), $(evalcall def_kbuild_finalize_inst)))
|
---|
1417 |
|
---|
1418 | # No abspath for devtools since they might've been referenced already and we
|
---|
1419 | # don't want conflicting variable expansions.
|
---|
1420 | KBUILD_DEVTOOLS := $(KBUILD_DEVTOOLS)
|
---|
1421 | KBUILD_DEVTOOLS_TRG := $(KBUILD_DEVTOOLS_TRG)
|
---|
1422 | KBUILD_DEVTOOLS_TRG_ALT := $(KBUILD_DEVTOOLS_TRG_ALT)
|
---|
1423 | KBUILD_DEVTOOLS_HST := $(KBUILD_DEVTOOLS_HST)
|
---|
1424 | KBUILD_DEVTOOLS_HST_ALT := $(KBUILD_DEVTOOLS_HST_ALT)
|
---|
1425 |
|
---|
1426 |
|
---|
1427 | #
|
---|
1428 | # Setup the message style. The default one is inlined.
|
---|
1429 | #
|
---|
1430 | # See kBuild/msgstyles for more styles or use KBUILD_MSG_STYLE_PATHS
|
---|
1431 | # to create your own message style.
|
---|
1432 | #
|
---|
1433 | KBUILD_MSG_STYLE ?= default
|
---|
1434 | ifeq ($(KBUILD_MSG_STYLE),default)
|
---|
1435 | #
|
---|
1436 | # The 'default' style.
|
---|
1437 | #
|
---|
1438 |
|
---|
1439 | ## Fetch starting.
|
---|
1440 | # @param 1 Target name.
|
---|
1441 | MSG_FETCH ?= $(call MSG_L1,Fetching $1...)
|
---|
1442 | ## Re-fetch starting.
|
---|
1443 | # @param 1 Target name.
|
---|
1444 | MSG_REFETCH ?= $(call MSG_L1,Re-fetching $1...)
|
---|
1445 | ## Downloading a fetch component.
|
---|
1446 | # @param 1 Target name.
|
---|
1447 | # @param 2 The source URL.
|
---|
1448 | # @param 3 The destination file name.
|
---|
1449 | MSG_FETCH_DL ?= $(call MSG_L1,Downloading $1 - $2,=> $3)
|
---|
1450 | ## Checking a fetch component.
|
---|
1451 | # @param 1 Target name.
|
---|
1452 | # @param 2 The source URL.
|
---|
1453 | # @param 3 The destination file name.
|
---|
1454 | MSG_FETCH_CHK?= $(call MSG_L1,Checking $1 - $3, ($2))
|
---|
1455 | ## Unpacking a fetch component.
|
---|
1456 | # @param 1 Target name.
|
---|
1457 | # @param 2 The archive file name.
|
---|
1458 | # @param 3 The target directory.
|
---|
1459 | MSG_FETCH_UP ?= $(call MSG_L1,Unpacking $1 - $2 => $3)
|
---|
1460 | ## Fetch completed.
|
---|
1461 | # @param 1 Target name.
|
---|
1462 | MSG_FETCH_OK ?= $(call MSG_L1,Successfully fetched $1)
|
---|
1463 | ## Unfetch a fetch target.
|
---|
1464 | # @param 1 Target name.
|
---|
1465 | MSG_UNFETCH ?= $(call MSG_L1,Unfetching $1...)
|
---|
1466 | ## Compiling a source file.
|
---|
1467 | # @param 1 Target name.
|
---|
1468 | # @param 2 The source filename.
|
---|
1469 | # @param 3 The primary link output file name.
|
---|
1470 | # @param 4 The source type (C,CXX,OBJC,AS,RC,++).
|
---|
1471 | MSG_COMPILE ?= $(call MSG_L1,Compiling $1 - $2,=> $3)
|
---|
1472 | ## Tool
|
---|
1473 | # @param 1 The tool name (bin2c,...)
|
---|
1474 | # @param 2 Target name.
|
---|
1475 | # @param 3 The source filename.
|
---|
1476 | # @param 4 The primary output file name.
|
---|
1477 | MSG_TOOL ?= $(call MSG_L1,$1 $2 - $3,=> $4)
|
---|
1478 | ## Generate a file, typically a source file.
|
---|
1479 | # @param 1 Target name if applicable.
|
---|
1480 | # @param 2 Output file name.
|
---|
1481 | # @param 3 What it's generated from
|
---|
1482 | MSG_GENERATE ?= $(call MSG_L1,Generating $(if $1,$1 - )$2,$(if $3,from $3))
|
---|
1483 | ## Linking a bldprog/dll/program/sysmod target.
|
---|
1484 | # @param 1 Target name.
|
---|
1485 | # @param 2 The primary link output file name.
|
---|
1486 | # @param 3 The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
|
---|
1487 | MSG_LINK ?= $(call MSG_L1,Linking $1,=> $2)
|
---|
1488 | ## Merging a library into the target (during library linking).
|
---|
1489 | # @param 1 Target name.
|
---|
1490 | # @param 2 The output library name.
|
---|
1491 | # @param 3 The input library name.
|
---|
1492 | MSG_AR_MERGE ?= $(call MSG_L1,Merging $3 into $1, ($2))
|
---|
1493 | ## Creating a directory (build).
|
---|
1494 | # @param 1 Directory name.
|
---|
1495 | MSG_MKDIR ?= $(call MSG_L2,Creating directory $1)
|
---|
1496 | ## Cleaning.
|
---|
1497 | MSG_CLEAN ?= $(call MSG_L1,Cleaning...)
|
---|
1498 | ## Nothing.
|
---|
1499 | MSG_NOTHING ?= $(call MSG_L1,Did nothing in $(CURDIR))
|
---|
1500 | ## Pass
|
---|
1501 | # @param 1 The pass name.
|
---|
1502 | MSG_PASS ?= $(call MSG_L1,Pass - $1)
|
---|
1503 | ## Installing a bldprog/lib/dll/program/sysmod target.
|
---|
1504 | # @param 1 Target name.
|
---|
1505 | # @param 2 The source filename.
|
---|
1506 | # @param 3 The destination file name.
|
---|
1507 | MSG_INST_TRG ?= $(call MSG_L1,Installing $1 => $3)
|
---|
1508 | ## Installing a file (install target).
|
---|
1509 | # @param 1 The source filename.
|
---|
1510 | # @param 2 The destination filename.
|
---|
1511 | MSG_INST_FILE?= $(call MSG_L1,Installing $2,(<= $1))
|
---|
1512 | ## Installing a symlink.
|
---|
1513 | # @param 1 Symlink
|
---|
1514 | # @param 2 Link target
|
---|
1515 | MSG_INST_SYM ?= $(call MSG_L1,Installing symlink $1,=> $2)
|
---|
1516 | ## Installing a directory.
|
---|
1517 | # @param 1 Directory name.
|
---|
1518 | MSG_INST_DIR ?= $(call MSG_L1,Installing directory $1)
|
---|
1519 |
|
---|
1520 | else
|
---|
1521 | _KBUILD_MSG_STYLE_FILE := $(firstword $(foreach path, $(KBUILD_MSG_STYLE_PATHS) $(KBUILD_PATH)/msgstyles, $(wildcard $(path)/$(KBUILD_MSG_STYLE).kmk)))
|
---|
1522 | ifneq ($(_KBUILD_MSG_STYLE_FILE),)
|
---|
1523 | include $(_KBUILD_MSG_STYLE_FILE)
|
---|
1524 | else
|
---|
1525 | $(error kBuild: Can't find the style setup file for KBUILD_MSG_STYLE '$(KBUILD_MSG_STYLE)')
|
---|
1526 | endif
|
---|
1527 | endif
|
---|
1528 |
|
---|
1529 |
|
---|
1530 | #
|
---|
1531 | # Message macros.
|
---|
1532 | #
|
---|
1533 | # This is done after including Config.kmk as to allow for
|
---|
1534 | # KBUILD_QUIET and KBUILD_VERBOSE to be configurable.
|
---|
1535 | #
|
---|
1536 | ifdef KBUILD_QUIET
|
---|
1537 | # No output
|
---|
1538 | QUIET := @
|
---|
1539 | QUIET2:= @
|
---|
1540 | MSG_L1 =
|
---|
1541 | MSG_L2 =
|
---|
1542 | else
|
---|
1543 | ifndef KBUILD_VERBOSE
|
---|
1544 | # Default output level.
|
---|
1545 | QUIET := @
|
---|
1546 | QUIET2 := @
|
---|
1547 | MSG_L1 ?= %@$(ECHO) "kBuild: $1"
|
---|
1548 | MSG_L2 =
|
---|
1549 | else ifeq ($(KBUILD_VERBOSE),1)
|
---|
1550 | # A bit more output
|
---|
1551 | QUIET := @
|
---|
1552 | QUIET2 := @
|
---|
1553 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
---|
1554 | MSG_L2 =
|
---|
1555 | else ifeq ($(KBUILD_VERBOSE),2)
|
---|
1556 | # Lot more output
|
---|
1557 | QUIET :=
|
---|
1558 | QUIET2 := @
|
---|
1559 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
---|
1560 | MSG_L2 ?= %@$(ECHO) "kBuild: $1"
|
---|
1561 | else
|
---|
1562 | # maximal output.
|
---|
1563 | QUIET :=
|
---|
1564 | QUIET2 :=
|
---|
1565 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
|
---|
1566 | MSG_L2 ?= %@$(ECHO) "kBuild: $1"
|
---|
1567 | endif
|
---|
1568 | endif
|
---|
1569 |
|
---|
1570 |
|
---|
1571 | #
|
---|
1572 | # An internal define used by subheader.kmk and subfooter.kmk.
|
---|
1573 | # We keep them here to avoid redefining them for each sub-makefile.
|
---|
1574 | #
|
---|
1575 | define def_subfooter_header_target_pass
|
---|
1576 | ifndef $(target)_PATH
|
---|
1577 | ifndef $(target)_DEFPATH
|
---|
1578 | $(target)_DEFPATH := $(PATH_SUB_CURRENT)
|
---|
1579 | endif
|
---|
1580 | $(call KB_FN_ASSIGN_DEPRECATED,$(target)_PATH,$($(target)_DEFPATH), $(target)_DEFPATH)
|
---|
1581 | else ifndef $(target)_DEFPATH
|
---|
1582 | $(target)_DEFPATH := $($(target)_PATH)
|
---|
1583 | endif
|
---|
1584 | ifndef $(target)_MAKEFILE
|
---|
1585 | $(target)_MAKEFILE := $(MAKEFILE_CURRENT)
|
---|
1586 | endif
|
---|
1587 | ifndef $(target)_0_OUTDIR
|
---|
1588 | $(target)_0_OUTDIR := $(call TARGET_PATH,$(target))
|
---|
1589 | $(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
|
---|
1590 | endif
|
---|
1591 | endef
|
---|
1592 |
|
---|
1593 |
|
---|
1594 | #
|
---|
1595 | # Validate any KBUILD_BLD_TYPES additions and finally the KBUILD_TYPE.
|
---|
1596 | #
|
---|
1597 | if1of ($(KBUILD_BLD_TYPES), $(KBUILD_OSES))
|
---|
1598 | $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_OSES!)
|
---|
1599 | endif
|
---|
1600 | if1of ($(KBUILD_BLD_TYPES), $(KBUILD_ARCHES))
|
---|
1601 | $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_ARCHES!)
|
---|
1602 | endif
|
---|
1603 | if1of ($(KBUILD_OSES), $(KBUILD_ARCHES))
|
---|
1604 | $(error kBuild: found KBUILD_OSES in KBUILD_ARCHES!)
|
---|
1605 | endif
|
---|
1606 | ifn1of ($(KBUILD_TYPE), $(KBUILD_BLD_TYPES))
|
---|
1607 | $(error kBuild: KBUILD_TYPE(=$(KBUILD_TYPE)) is not found in KBUILD_BLD_TYPES(=$(KBUILD_BLD_TYPES))!)
|
---|
1608 | endif
|
---|
1609 |
|
---|
1610 |
|
---|
1611 | #
|
---|
1612 | # Mark the output and temporary directories as volatile on windows.
|
---|
1613 | #
|
---|
1614 | # This automatically means the directories not listed here are considered
|
---|
1615 | # static and won't be invalidated once we start running compile jobs.
|
---|
1616 | #
|
---|
1617 | ifeq ($(KBUILD_HOST),win)
|
---|
1618 | if $(KBUILD_KMK_REVISION) >= 2886
|
---|
1619 | $(dircache-ctl volatile, $(PATH_OUT_BASE), $(PATH_OUT), $(TEMP), $(TMP), $(TMPDIR), $(TMP))
|
---|
1620 | endif
|
---|
1621 | endif
|
---|
1622 |
|
---|
1623 |
|
---|
1624 | ifdef KBUILD_PROFILE_SELF
|
---|
1625 | $(evalcall def_profile_self, end of header.kmk)
|
---|
1626 | _KBUILD_TS_HEADER_END := $(_KBUILD_TS_PREV)
|
---|
1627 | endif
|
---|
1628 |
|
---|
1629 | # end-of-file-content
|
---|
1630 | __header_kmk__ := 1
|
---|
1631 | endif # !__header_kmk__
|
---|
1632 |
|
---|