1 | # $Id: header.kmk 972 2007-05-27 16:47:17Z bird $
|
---|
2 | ## @file
|
---|
3 | #
|
---|
4 | # kBuild - File included at top of makefile.
|
---|
5 | #
|
---|
6 | # Copyright (c) 2004-2007 knut st. osmundsen <bird-kBuild-spam@anduin.net>
|
---|
7 | #
|
---|
8 | #
|
---|
9 | # This file is part of kBuild.
|
---|
10 | #
|
---|
11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
12 | # it under the terms of the GNU General Public License as published by
|
---|
13 | # the Free Software Foundation; either version 2 of the License, or
|
---|
14 | # (at your option) any later version.
|
---|
15 | #
|
---|
16 | # kBuild is distributed in the hope that it will be useful,
|
---|
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | # GNU General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with kBuild; if not, write to the Free Software
|
---|
23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
24 | #
|
---|
25 | #
|
---|
26 |
|
---|
27 | ifndef __header_kmk__
|
---|
28 | # start-of-file-content
|
---|
29 |
|
---|
30 | #
|
---|
31 | # default rule
|
---|
32 | #
|
---|
33 | all: all_recursive
|
---|
34 |
|
---|
35 | #
|
---|
36 | # The FORCE rule.
|
---|
37 | #
|
---|
38 | FORCE:
|
---|
39 |
|
---|
40 | #
|
---|
41 | # Try avoid inference rules.
|
---|
42 | #
|
---|
43 | .SUFFIXES:
|
---|
44 | SUFFIXES :=
|
---|
45 |
|
---|
46 | #
|
---|
47 | # Enable delete (targets) on error.
|
---|
48 | #
|
---|
49 | .DELETE_ON_ERROR:
|
---|
50 |
|
---|
51 | #
|
---|
52 | # Enable second expansion of prerequisites.
|
---|
53 | #
|
---|
54 | .SECONDEXPANSION:
|
---|
55 |
|
---|
56 |
|
---|
57 | #
|
---|
58 | # General purpose macros.
|
---|
59 | #
|
---|
60 |
|
---|
61 | ## get last word in a list.
|
---|
62 | # @returns last word in $1.
|
---|
63 | # @param $1 Word list.
|
---|
64 | lastword = $(word $(words $(1)), $(1))
|
---|
65 |
|
---|
66 | ##
|
---|
67 | # Newline character(s).
|
---|
68 | define NL
|
---|
69 |
|
---|
70 |
|
---|
71 | endef
|
---|
72 |
|
---|
73 | ##
|
---|
74 | # Tab character.
|
---|
75 | TAB := $(subst ., ,.)
|
---|
76 |
|
---|
77 | ##
|
---|
78 | # Newline + tab characters (for generating commands).
|
---|
79 | NLTAB = $(NL)$(TAB)
|
---|
80 |
|
---|
81 | ##
|
---|
82 | # Space character.
|
---|
83 | SP := $(subst ., ,.)
|
---|
84 |
|
---|
85 | ##
|
---|
86 | # Hash character.
|
---|
87 | define HASH
|
---|
88 | #
|
---|
89 | endef
|
---|
90 |
|
---|
91 | ##
|
---|
92 | # Colon character.
|
---|
93 | COLON := :
|
---|
94 |
|
---|
95 | ##
|
---|
96 | # Semicolon character.
|
---|
97 | SEMICOLON := ;
|
---|
98 |
|
---|
99 | ##
|
---|
100 | # Comma character.
|
---|
101 | COMMA := ,
|
---|
102 |
|
---|
103 | ##
|
---|
104 | # Dot character.
|
---|
105 | DOT := .
|
---|
106 |
|
---|
107 | ##
|
---|
108 | # Dollar character.
|
---|
109 | DOLLAR := $$
|
---|
110 |
|
---|
111 | ##
|
---|
112 | # Equal character.
|
---|
113 | EQUAL := =
|
---|
114 |
|
---|
115 |
|
---|
116 | #
|
---|
117 | # Set default build type.
|
---|
118 | #
|
---|
119 | ifndef BUILD_TYPE
|
---|
120 | ifdef BUILD_MODE
|
---|
121 | # BUILD_MODE is legacy from the OS/2 build system. :)
|
---|
122 | BUILD_TYPE := $(tolower $(BUILD_MODE))
|
---|
123 | else
|
---|
124 | BUILD_TYPE := release
|
---|
125 | endif
|
---|
126 | endif
|
---|
127 |
|
---|
128 |
|
---|
129 | #
|
---|
130 | # Assert build platform.
|
---|
131 | #
|
---|
132 | ifndef BUILD_PLATFORM
|
---|
133 | $(error kBuild: BUILD_PLATFORM is undefined!)
|
---|
134 | else
|
---|
135 | BUILD_PLATFORM := $(strip $(BUILD_PLATFORM))
|
---|
136 | ifneq ($(words $(BUILD_PLATFORM))$(filter-out darwin freebsd l4 linux nt os2 solaris win win32 win64,$(BUILD_PLATFORM)),1)
|
---|
137 | # OS/2 (have uppercase legacy)
|
---|
138 | ifeq ($(BUILD_PLATFORM),OS2)
|
---|
139 | $(error kBuild: BUILD_PLATFORM must be all lowercase!)
|
---|
140 | endif
|
---|
141 | $(error kBuild: BUILD_PLATFORM value '$(BUILD_PLATFORM)' was not recognized!)
|
---|
142 | endif
|
---|
143 | endif
|
---|
144 |
|
---|
145 | # Fill in defaults if needed.
|
---|
146 | ifndef BUILD_PLATFORM_ARCH
|
---|
147 | ifeq ($(filter-out win64,$(BUILD_PLATFORM)),)
|
---|
148 | BUILD_PLATFORM_ARCH := amd64
|
---|
149 | else
|
---|
150 | BUILD_PLATFORM_ARCH := x86
|
---|
151 | endif
|
---|
152 | endif
|
---|
153 | ifndef BUILD_PLATFORM_CPU
|
---|
154 | ifeq ($(filter-out amd64,$(BUILD_PLATFORM_ARCH)),)
|
---|
155 | BUILD_PLATFORM_CPU:= k8
|
---|
156 | else
|
---|
157 | BUILD_PLATFORM_CPU:= i586
|
---|
158 | endif
|
---|
159 | endif
|
---|
160 |
|
---|
161 |
|
---|
162 | #
|
---|
163 | # Assert target platform.
|
---|
164 | #
|
---|
165 | ifndef BUILD_TARGET
|
---|
166 | # not defined, set to the same as build platform
|
---|
167 | BUILD_TARGET := $(BUILD_PLATFORM)
|
---|
168 | else
|
---|
169 | BUILD_TARGET := $(strip $(BUILD_TARGET))
|
---|
170 | ifneq ($(words $(BUILD_TARGET))$(filter-out darwin freebsd l4 linux nt os2 solaris win win32 win64,$(BUILD_TARGET)),1)
|
---|
171 | # OS/2 (have uppercase legacy)
|
---|
172 | ifeq ($(BUILD_TARGET),OS2)
|
---|
173 | $(error kBuild: BUILD_TARGET must be all lowercase!)
|
---|
174 | endif
|
---|
175 | $(error kBuild: BUILD_TARGET value '$(BUILD_TARGET)' was not recognized!)
|
---|
176 | endif
|
---|
177 | endif
|
---|
178 |
|
---|
179 | # Fill in defaults if needed.
|
---|
180 | ifndef BUILD_TARGET_ARCH
|
---|
181 | BUILD_TARGET_ARCH := x86
|
---|
182 | endif
|
---|
183 | ifndef BUILD_TARGET_CPU
|
---|
184 | BUILD_TARGET_CPU := i586
|
---|
185 | endif
|
---|
186 |
|
---|
187 | # Adjust the DEPTH definition first
|
---|
188 | ifeq ($(strip $(DEPTH)),)
|
---|
189 | DEPTH := .
|
---|
190 | endif
|
---|
191 |
|
---|
192 | #
|
---|
193 | # Common definitions.
|
---|
194 | #
|
---|
195 | ## PATH_CURRENT is the current directory (getcwd).
|
---|
196 | PATH_CURRENT := $(abspath $(CURDIR))
|
---|
197 | ## PATH_SUB_CURRENT points to current directory of the current makefile.
|
---|
198 | # Meaning that it will change value as we enter and exit sub-makefiles.
|
---|
199 | PATH_SUB_CURRENT := $(PATH_CURRENT)
|
---|
200 | ## PATH_ROOT points to the project root directory.
|
---|
201 | PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
|
---|
202 | ## PATH_SUB_ROOT points to the directory of the top-level makefile.
|
---|
203 | ifneq ($(strip $(SUB_DEPTH)),)
|
---|
204 | PATH_SUB_ROOT := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
|
---|
205 | else
|
---|
206 | PATH_SUB_ROOT := $(PATH_CURRENT)
|
---|
207 | endif
|
---|
208 |
|
---|
209 | ## CURSUBDIR is PATH_SUB_ROOT described relative to PATH_ROOT.
|
---|
210 | # This variable is used to determin where the object files and other output goes.
|
---|
211 | ifneq ($(PATH_ROOT),$(PATH_CURRENT))
|
---|
212 | CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_ROOT))
|
---|
213 | else
|
---|
214 | CURSUBDIR := .
|
---|
215 | endif
|
---|
216 |
|
---|
217 | # Output directories.
|
---|
218 | ifndef PATH_OUT_BASE
|
---|
219 | PATH_OUT_BASE := $(PATH_ROOT)/out
|
---|
220 | endif
|
---|
221 | ifndef PATH_OUT
|
---|
222 | ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places.)
|
---|
223 | PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(BUILD_TYPE)
|
---|
224 | else
|
---|
225 | PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/$(BUILD_TYPE)
|
---|
226 | endif
|
---|
227 | endif # !define PATH_OUT
|
---|
228 | PATH_OBJ = $(PATH_OUT)/obj
|
---|
229 | PATH_TARGET = $(PATH_OBJ)/$(CURSUBDIR)
|
---|
230 | PATH_INS = $(PATH_OUT)
|
---|
231 | PATH_BIN = $(PATH_INS)/bin
|
---|
232 | PATH_DLL = $(PATH_INS)/bin
|
---|
233 | PATH_SYS = $(PATH_INS)/bin
|
---|
234 | PATH_LIB = $(PATH_INS)/lib
|
---|
235 | PATH_DOC = $(PATH_INS)/doc
|
---|
236 |
|
---|
237 | # Usually kBuild is external to the source tree.
|
---|
238 | ifndef PATH_KBUILD
|
---|
239 | PATH_KBUILD := $(PATH_ROOT)/kBuild
|
---|
240 | endif
|
---|
241 | PATH_KBUILD := $(abspath $(PATH_KBUILD))
|
---|
242 | # kBuild files which might be of interest.
|
---|
243 | FILE_KBUILD_HEADER := $(PATH_KBUILD)/header.kmk
|
---|
244 | #FILE_KBUILD_CONFIG := $(PATH_KBUILD)/config.kmk
|
---|
245 | FILE_KBUILD_FOOTER := $(PATH_KBUILD)/footer.kmk
|
---|
246 |
|
---|
247 | SUFF_DEP := .dep
|
---|
248 | ## MAKEFILE is the name of the main makefile.
|
---|
249 | MAKEFILE := $(firstword $(MAKEFILE_LIST))
|
---|
250 | ## MAKEFILE_CURRENT is the name of the current makefile.
|
---|
251 | # This is updated everything a sub-makefile is included.
|
---|
252 | MAKEFILE_CURRENT := $(MAKEFILE)
|
---|
253 |
|
---|
254 |
|
---|
255 | #
|
---|
256 | # Check make version.
|
---|
257 | #
|
---|
258 | ifdef KMK_VERSION
|
---|
259 | ifneq ($(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR),0.1)
|
---|
260 | ifneq ($(KBUILD_VERSION_MAJOR),0)
|
---|
261 | $(warning kBuild: kmk major version mismatch, expected '0' found '$(KBUILD_VERSION_MAJOR)'!)
|
---|
262 | else
|
---|
263 | $(warning kBuild: kmk minor version mismatch, expected '1' found '$(KBUILD_VERSION_MINOR)'!)
|
---|
264 | endif
|
---|
265 | endif
|
---|
266 | endif
|
---|
267 |
|
---|
268 |
|
---|
269 | #
|
---|
270 | # The revision in which this file was last modified.
|
---|
271 | # This can be useful when using development versions of kBuild.
|
---|
272 | #
|
---|
273 | KMK_REVISION := $(patsubst %:,, $Rev: 972 $ )
|
---|
274 |
|
---|
275 |
|
---|
276 | #
|
---|
277 | # Build platform setup.
|
---|
278 | #
|
---|
279 | # OS/2
|
---|
280 | ifeq ($(BUILD_PLATFORM),os2)
|
---|
281 | EXEC_X86_WIN32 := innopec.exe
|
---|
282 | HOSTSUFF_EXE := .exe
|
---|
283 | endif
|
---|
284 |
|
---|
285 | # Linux
|
---|
286 | ifeq ($(BUILD_PLATFORM),linux)
|
---|
287 | EXEC_X86_WIN32 := wine
|
---|
288 | HOSTSUFF_EXE :=
|
---|
289 | endif
|
---|
290 |
|
---|
291 | # Win, Win32, Win64, NT.
|
---|
292 | ifeq ($(filter-out win32 win64 win nt,$(BUILD_PLATFORM)),)
|
---|
293 | EXEC_X86_WIN32 :=
|
---|
294 | HOSTSUFF_EXE := .exe
|
---|
295 | endif
|
---|
296 |
|
---|
297 | # FreeBSD
|
---|
298 | ifeq ($(BUILD_PLATFORM),freebsd)
|
---|
299 | EXEC_X86_WIN32 := wine
|
---|
300 | HOSTSUFF_EXE :=
|
---|
301 | endif
|
---|
302 |
|
---|
303 | # Darwin / Mac OS X
|
---|
304 | ifeq ($(BUILD_PLATFORM),darwin)
|
---|
305 | EXEC_X86_WIN32 := false
|
---|
306 | HOSTSUFF_EXE :=
|
---|
307 | endif
|
---|
308 |
|
---|
309 | # Solaris
|
---|
310 | ifeq ($(BUILD_PLATFORM),solaris)
|
---|
311 | EXEC_X86_WIN32 := false
|
---|
312 | HOSTSUFF_EXE :=
|
---|
313 | endif
|
---|
314 |
|
---|
315 | ifndef PATH_KBUILD_BIN
|
---|
316 | PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)
|
---|
317 | ifeq ($(wildcard $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)),)
|
---|
318 | ifeq ($(BUILD_TARGET_ARCH),amd64)
|
---|
319 | PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/$(BUILD_PLATFORM).x86
|
---|
320 | endif
|
---|
321 | ifeq ($(wildcard $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)),)
|
---|
322 | ifeq ($(filter-out win64 win32 win nt ,$(BUILD_PLATFORM)),)
|
---|
323 | PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/win.x86
|
---|
324 | endif
|
---|
325 | endif
|
---|
326 | ifeq ($(wildcard $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)),)
|
---|
327 | # give up
|
---|
328 | PATH_KBUILD_BIN := $(PATH_KBUILD)/bin/$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)
|
---|
329 | endif
|
---|
330 | endif
|
---|
331 | endif
|
---|
332 |
|
---|
333 |
|
---|
334 | #
|
---|
335 | # Build target setup.
|
---|
336 | #
|
---|
337 | ifeq ($(filter-out win32 win64 win nt os2,$(BUILD_TARGET)),)
|
---|
338 | SUFF_OBJ := .obj
|
---|
339 | SUFF_LIB := .lib
|
---|
340 | SUFF_DLL := .dll
|
---|
341 | SUFF_EXE := .exe
|
---|
342 | SUFF_SYS := .sys
|
---|
343 | SUFF_RES := .res
|
---|
344 | endif
|
---|
345 | ifeq ($(BUILD_TARGET),l4)
|
---|
346 | SUFF_OBJ := .o
|
---|
347 | SUFF_LIB := .a
|
---|
348 | SUFF_DLL := .s.so
|
---|
349 | SUFF_EXE :=
|
---|
350 | SUFF_SYS := .a
|
---|
351 | SUFF_RES :=
|
---|
352 | endif
|
---|
353 | ifeq ($(BUILD_TARGET),darwin)
|
---|
354 | SUFF_OBJ := .o
|
---|
355 | SUFF_LIB := .a
|
---|
356 | SUFF_DLL := .dylib
|
---|
357 | SUFF_EXE :=
|
---|
358 | SUFF_SYS :=
|
---|
359 | SUFF_RES :=
|
---|
360 | endif
|
---|
361 | ifndef SUFF_OBJ
|
---|
362 | SUFF_OBJ := .o
|
---|
363 | SUFF_LIB := .a
|
---|
364 | SUFF_DLL := .so
|
---|
365 | SUFF_EXE :=
|
---|
366 | SUFF_SYS := .a
|
---|
367 | SUFF_RES :=
|
---|
368 | endif
|
---|
369 |
|
---|
370 | #
|
---|
371 | # Standard kBuild tools.
|
---|
372 | #
|
---|
373 | ifeq ($(MAKE),kmk)
|
---|
374 | MAKE := $(PATH_KBUILD_BIN)/kmk$(HOSTSUFF_EXE)
|
---|
375 | endif
|
---|
376 |
|
---|
377 | DEP_EXT := $(PATH_KBUILD_BIN)/kDep$(HOSTSUFF_EXE)
|
---|
378 | ifeq ($(filter kDep,$(KMK_BUILTIN)),kDep)
|
---|
379 | DEP := kmk_builtin_kDep
|
---|
380 | else
|
---|
381 | DEP := $(DEP_EXT)
|
---|
382 | endif
|
---|
383 |
|
---|
384 | DEP_IDB_EXT := $(PATH_KBUILD_BIN)/kDepIDB$(HOSTSUFF_EXE)
|
---|
385 | ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepIDB)
|
---|
386 | DEP_IDB := $(if kmk_builtin_kDepIDB
|
---|
387 | else
|
---|
388 | DEP_IDB := $(DEP_IDB_EXT)
|
---|
389 | endif
|
---|
390 |
|
---|
391 | DEP_PRE_EXT := $(PATH_KBUILD_BIN)/kDepPre$(HOSTSUFF_EXE)
|
---|
392 | ifeq ($(filter kDepPre,$(KMK_BUILTIN)),kDepPre)
|
---|
393 | DEP_PRE := $(if kmk_builtin_kDepPre
|
---|
394 | else
|
---|
395 | DEP_PRE := $(DEP_PRE_EXT)
|
---|
396 | endif
|
---|
397 |
|
---|
398 | APPEND_EXT := $(PATH_KBUILD_BIN)/kmk_append$(HOSTSUFF_EXE)
|
---|
399 | ifeq ($(filter append,$(KMK_BUILTIN)),append)
|
---|
400 | APPEND := kmk_builtin_append
|
---|
401 | else
|
---|
402 | APPEND := $(APPEND_EXT)
|
---|
403 | endif
|
---|
404 |
|
---|
405 | CAT_EXT := $(PATH_KBUILD_BIN)/kmk_cat$(HOSTSUFF_EXE)
|
---|
406 | ifeq ($(filter cat,$(KMK_BUILTIN)),cat)
|
---|
407 | CAT := kmk_builtin_cat
|
---|
408 | else
|
---|
409 | CAT := $(CAT_EXT)
|
---|
410 | endif
|
---|
411 |
|
---|
412 | CP_EXT := $(PATH_KBUILD_BIN)/kmk_cp$(HOSTSUFF_EXE)
|
---|
413 | ifeq ($(filter cp,$(KMK_BUILTIN)),cp)
|
---|
414 | CP := kmk_builtin_cp
|
---|
415 | else
|
---|
416 | CP := $(CP_EXT)
|
---|
417 | endif
|
---|
418 |
|
---|
419 | ECHO_EXT := $(PATH_KBUILD_BIN)/kmk_echo$(HOSTSUFF_EXE)
|
---|
420 | ifeq ($(filter echo,$(KMK_BUILTIN)),echo)
|
---|
421 | ECHO := kmk_builtin_echo
|
---|
422 | else
|
---|
423 | ECHO := $(ECHO_EXT)
|
---|
424 | endif
|
---|
425 |
|
---|
426 | INSTALL_EXT := $(PATH_KBUILD_BIN)/kmk_install$(HOSTSUFF_EXE)
|
---|
427 | ifeq ($(filter install,$(KMK_BUILTIN)),install)
|
---|
428 | INSTALL := kmk_builtin_install
|
---|
429 | else
|
---|
430 | INSTALL := $(INSTALL_EXT)
|
---|
431 | endif
|
---|
432 |
|
---|
433 | LN_EXT := $(PATH_KBUILD_BIN)/kmk_ln$(HOSTSUFF_EXE)
|
---|
434 | ifeq ($(filter ln,$(KMK_BUILTIN)),ln)
|
---|
435 | LN := kmk_builtin_ln
|
---|
436 | else
|
---|
437 | LN := $(LN_EXT)
|
---|
438 | endif
|
---|
439 |
|
---|
440 | MKDIR_EXT := $(PATH_KBUILD_BIN)/kmk_mkdir$(HOSTSUFF_EXE)
|
---|
441 | ifeq ($(filter mkdir,$(KMK_BUILTIN)),mkdir)
|
---|
442 | MKDIR := kmk_builtin_mkdir
|
---|
443 | else
|
---|
444 | MKDIR := $(MKDIR_EXT)
|
---|
445 | endif
|
---|
446 |
|
---|
447 | MV_EXT := $(PATH_KBUILD_BIN)/kmk_mv$(HOSTSUFF_EXE)
|
---|
448 | ifeq ($(filter mv,$(KMK_BUILTIN)),mv)
|
---|
449 | MV := kmk_builtin_mv
|
---|
450 | else
|
---|
451 | MV := $(MV_EXT)
|
---|
452 | endif
|
---|
453 |
|
---|
454 | PRINTF_EXT := $(PATH_KBUILD_BIN)/kmk_printf$(HOSTSUFF_EXE)
|
---|
455 | ifeq ($(filter printf,$(KMK_BUILTIN)),printf)
|
---|
456 | PRINTF := kmk_builtin_printf
|
---|
457 | else
|
---|
458 | PRINTF := $(PRINTF_EXT)
|
---|
459 | endif
|
---|
460 |
|
---|
461 | RM_EXT := $(PATH_KBUILD_BIN)/kmk_rm$(HOSTSUFF_EXE)
|
---|
462 | ifeq ($(filter rm,$(KMK_BUILTIN)),rm)
|
---|
463 | RM := kmk_builtin_rm
|
---|
464 | else
|
---|
465 | RM := $(RM_EXT)
|
---|
466 | endif
|
---|
467 |
|
---|
468 | RMDIR_EXT := $(PATH_KBUILD_BIN)/kmk_rmdir$(HOSTSUFF_EXE)
|
---|
469 | ifeq ($(filter rmdir,$(KMK_BUILTIN)),rmdir)
|
---|
470 | RMDIR := kmk_builtin_rmdir
|
---|
471 | else
|
---|
472 | RMDIR := $(RMDIR_EXT)
|
---|
473 | endif
|
---|
474 |
|
---|
475 | SED_EXT := $(PATH_KBUILD_BIN)/kmk_sed$(HOSTSUFF_EXE)
|
---|
476 | ifeq ($(filter sed,$(KMK_BUILTIN)),sed)
|
---|
477 | SED := kmk_builtin_sed
|
---|
478 | else
|
---|
479 | SED := $(SED_EXT)
|
---|
480 | endif
|
---|
481 |
|
---|
482 | # Our default shell is the Almquist shell from *BSD.
|
---|
483 | ASH := $(PATH_KBUILD_BIN)/kmk_ash$(HOSTSUFF_EXE)
|
---|
484 | MAKESHELL := $(ASH)
|
---|
485 | SHELL := $(ASH)
|
---|
486 | export SHELL MAKESHELL
|
---|
487 |
|
---|
488 | # Symlinking is problematic on some platforms...
|
---|
489 | LN_SYMLINK := $(LN) -s
|
---|
490 |
|
---|
491 |
|
---|
492 | #
|
---|
493 | # Some Functions.
|
---|
494 | # The lower cased ones are either fallbacks or candidates for functions.c.
|
---|
495 | #
|
---|
496 |
|
---|
497 | ## ABSPATH - make paths absolute.
|
---|
498 | # This implementation is clumsy and doesn't resolve '..' and '.' components.
|
---|
499 | #
|
---|
500 | # @param $1 The paths to make absolute.
|
---|
501 | # @obsolete Use the GNU make function $(abspath) directly now.
|
---|
502 | ABSPATH = $(abspath $(1))
|
---|
503 |
|
---|
504 | ## DIRDEP - make create directory dependencies.
|
---|
505 | #
|
---|
506 | # @param $1 The paths to the directories which must be created.
|
---|
507 | DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
|
---|
508 |
|
---|
509 | ## Cygwin kludge.
|
---|
510 | # This converts /cygdrive/x/% to x:%.
|
---|
511 | #
|
---|
512 | # @param $1 The paths to make native.
|
---|
513 | # @remark This macro is pretty much obsolete since we don't use cygwin base make.
|
---|
514 | ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
|
---|
515 | CYGPATHMIXED = $(foreach path,$(1)\
|
---|
516 | ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
|
---|
517 | else
|
---|
518 | CYGPATHMIXED = $(1)
|
---|
519 | endif
|
---|
520 |
|
---|
521 | ifneq ($(filter xargs,$(KMK_FEATURES)),xargs) ## @todo Retire this to gnumake-header.kmk when it has been implemented.
|
---|
522 | ##
|
---|
523 | # Fake xargs without doing any commandline splitting.
|
---|
524 | # @param $1 The initial command.
|
---|
525 | # @param $2 The command for the subseqent command lines. optional
|
---|
526 | # @param $3 The command for the final command lines. optional
|
---|
527 | # @param $($#) The arguments.
|
---|
528 | xargs = $(1) $(if $(4),$(4),$(if $(3),$(3),$(2)))
|
---|
529 | endif
|
---|
530 |
|
---|
531 | ## Removes the drive letter from a path (if it has one)
|
---|
532 | # @param $1 the path
|
---|
533 | no-drive = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
|
---|
534 |
|
---|
535 | ## Removes the root slash from a path (if it has one)
|
---|
536 | # @param $1 the path
|
---|
537 | no-root-slash = $(patsubst /%,%,$(1))
|
---|
538 |
|
---|
539 | ## Figure out where to put object files.
|
---|
540 | # @param $1 real target name.
|
---|
541 | # @param $2 normalized main target
|
---|
542 | TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(1)))
|
---|
543 |
|
---|
544 | ## Figure out where to put object files.
|
---|
545 | # @param $1 normalized main target
|
---|
546 | TARGET_PATH = $(PATH_TARGET)/$(1)
|
---|
547 |
|
---|
548 |
|
---|
549 | #
|
---|
550 | # Initialize some of the globals which the Config.kmk and
|
---|
551 | # others can add stuff to if they like for processing in the footer.
|
---|
552 | #
|
---|
553 |
|
---|
554 | ## ALL_TARGET
|
---|
555 | # This is the list of all targets.
|
---|
556 | ALL_TARGETS :=
|
---|
557 |
|
---|
558 | ## TEMPLATE_PATHS
|
---|
559 | # List a paths (separated by space) where templates can be found.
|
---|
560 | TEMPLATE_PATHS :=
|
---|
561 |
|
---|
562 | ## TOOL_PATHS
|
---|
563 | # List of paths (separated by space) where tools can be found.
|
---|
564 | TOOL_PATHS :=
|
---|
565 |
|
---|
566 | ## SDK_PATHS
|
---|
567 | # List of paths (separated by space) where SDKs can be found.
|
---|
568 | SDK_PATHS :=
|
---|
569 |
|
---|
570 | ## Proritized list of the default makefile when walking subdirectories.
|
---|
571 | # The user can overload this list.
|
---|
572 | DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile
|
---|
573 |
|
---|
574 | ## PROPS_TOOLS
|
---|
575 | # This is a subset of the other PROPS
|
---|
576 | PROPS_TOOLS := TOOL CTOOL CXXTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
|
---|
577 |
|
---|
578 | ## PROPS_SINGLE
|
---|
579 | # The list of non-accumulative target properties.
|
---|
580 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
581 | # will do the necessary inheritance from templates to targets.
|
---|
582 | PROPS_SINGLE := $(PROPS_TOOLS) INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
|
---|
583 | OBJSUFF COBJSUFF CXXOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF
|
---|
584 |
|
---|
585 | ## PROPS_DEFERRED
|
---|
586 | # This list of non-accumulative target properties which are or may be
|
---|
587 | # functions, and thus should not be expanded until the very last moment.
|
---|
588 | PROPS_DEFERRED := INSTFUN INSTALLER PRE_CMDS POST_CMDS NAME
|
---|
589 |
|
---|
590 | ## PROPS_ACCUMULATE_R
|
---|
591 | # The list of accumulative target properties where the right most value/flag
|
---|
592 | # is the 'most significant'.
|
---|
593 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
594 | # will do the necessary inheritance from templates to targets.
|
---|
595 | PROPS_ACCUMULATE_R := \
|
---|
596 | DEFS DEPS ORDERDEPS \
|
---|
597 | CFLAGS CDEFS \
|
---|
598 | CXXFLAGS CXXDEFS \
|
---|
599 | ASFLAGS ASDEFS \
|
---|
600 | RCFLAGS RCDEFS \
|
---|
601 | LDFLAGS \
|
---|
602 | IDFLAGS IFDLAGS ISFLAGS \
|
---|
603 | FETCHFLAGS UNPACKFLAGS PATCHFLAGS
|
---|
604 |
|
---|
605 | ## PROPS_ACCUMULATE
|
---|
606 | # The list of accumulative target properties where the left most value/flag
|
---|
607 | # is the 'most significant'.
|
---|
608 | # A Config.kmk file can add it's own properties to this list and kBuild
|
---|
609 | # will do the necessary inheritance from templates to targets.
|
---|
610 | PROPS_ACCUMULATE_L := \
|
---|
611 | SDKS SOURCES \
|
---|
612 | INCS CINCS CXXINCX ASINCS RCINCS \
|
---|
613 | LIBS LIBPATH \
|
---|
614 | DIRS BLDDIRS \
|
---|
615 | CLEAN
|
---|
616 |
|
---|
617 | ## PROPS_ALL
|
---|
618 | # List of all the properties.
|
---|
619 | PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R)
|
---|
620 |
|
---|
621 |
|
---|
622 | #
|
---|
623 | # Here is a special 'hack' to prevent innocent environment variables being
|
---|
624 | # picked up and treated as properties. (The most annoying example of why
|
---|
625 | # this is necessary is the Visual C++ commandline with it's LIBPATH.)
|
---|
626 | #
|
---|
627 | # Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to
|
---|
628 | # disable this 'hack'.
|
---|
629 | #
|
---|
630 | ifndef KBUILD_DONT_KILL_ENV_PROPS
|
---|
631 |
|
---|
632 | define def_nuke_environment_prop
|
---|
633 | ifeq ($(origin $(prop)),environment)
|
---|
634 | $(prop) =
|
---|
635 | endif
|
---|
636 | endef
|
---|
637 | $(foreach prop, $(PROPS_ALL) \
|
---|
638 | FETCHES PATCHES BLDPROGS LIBRARIES IMPORT_LIBS DLLS PROGRAMS SYSMODS INSTALLS OTHERS \
|
---|
639 | SUBDIRS MAKEFILES BLDDIRS \
|
---|
640 | ,$(eval $(value def_nuke_environment_prop)))
|
---|
641 |
|
---|
642 | endif # KBUILD_DONT_KILL_ENV_PROPS
|
---|
643 |
|
---|
644 |
|
---|
645 | #
|
---|
646 | # Pass configuration.
|
---|
647 | #
|
---|
648 | # The PASS_<passname>_trgs variable is listing the targets.
|
---|
649 | # The PASS_<passname>_vars variable is listing the target variables.
|
---|
650 | # The PASS_<passname>_pass variable is the lowercased passname.
|
---|
651 | #
|
---|
652 |
|
---|
653 | ## PASS: fetches
|
---|
654 | # This pass fetches and unpacks things needed to complete the build.
|
---|
655 | PASS_FETCHES := Fetches
|
---|
656 | PASS_FETCHES_trgs :=
|
---|
657 | PASS_FETCHES_vars := _FETCHES
|
---|
658 | PASS_FETCHES_pass := fetches
|
---|
659 |
|
---|
660 | ## PASS: patches
|
---|
661 | # This pass applies patches.
|
---|
662 | PASS_PATCHES := Patches
|
---|
663 | PASS_PATCHES_trgs :=
|
---|
664 | PASS_PATCHES_vars := _PATCHES
|
---|
665 | PASS_PATCHES_pass := patches
|
---|
666 |
|
---|
667 | ## PASS: bldprogs
|
---|
668 | # This pass builds targets which are required for building the rest.
|
---|
669 | PASS_BLDPROGS := Build Programs
|
---|
670 | PASS_BLDPROGS_trgs :=
|
---|
671 | PASS_BLDPROGS_vars := _BLDPROGS
|
---|
672 | PASS_BLDPROGS_pass := bldprogs
|
---|
673 |
|
---|
674 | ## PASS: libraries
|
---|
675 | # This pass builds library targets.
|
---|
676 | PASS_LIBRARIES := Libraries
|
---|
677 | PASS_LIBRARIES_trgs :=
|
---|
678 | PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES
|
---|
679 | PASS_LIBRARIES_pass := libraries
|
---|
680 |
|
---|
681 | ## PASS: binaries
|
---|
682 | # This pass builds dll targets.
|
---|
683 | PASS_DLLS := DLLs
|
---|
684 | PASS_DLLS_trgs :=
|
---|
685 | PASS_DLLS_vars := _DLLS _OTHER_DLLS
|
---|
686 | PASS_DLLS_pass := dlls
|
---|
687 |
|
---|
688 | ## PASS: binaries
|
---|
689 | # This pass builds binary targets, i.e. programs, system modules and stuff.
|
---|
690 | PASS_BINARIES := Programs
|
---|
691 | PASS_BINARIES_trgs :=
|
---|
692 | PASS_BINARIES_vars := _PROGRAMS _SYSMODS _OTHER_BINARIES
|
---|
693 | PASS_BINARIES_pass := binaries
|
---|
694 |
|
---|
695 | ## PASS: others
|
---|
696 | # This pass builds other targets.
|
---|
697 | PASS_OTHERS := Other Stuff
|
---|
698 | PASS_OTHERS_trgs :=
|
---|
699 | PASS_OTHERS_vars := _OTHERS
|
---|
700 | PASS_OTHERS_pass := others
|
---|
701 |
|
---|
702 | ## PASS: install
|
---|
703 | # This pass installs the built entities to a sandbox area.
|
---|
704 | PASS_INSTALLS := Install
|
---|
705 | PASS_INSTALLS_trgs :=
|
---|
706 | PASS_INSTALLS_vars := _INSTALLS_DIRS _INSTALLS _INSTALLS_FILES
|
---|
707 | PASS_INSTALLS_pass := installs
|
---|
708 |
|
---|
709 | ## PASS: packing
|
---|
710 | # This pass processes custom packing rules.
|
---|
711 | PASS_PACKING := Packing
|
---|
712 | PASS_PACKING_trgs :=
|
---|
713 | PASS_PACKING_vars := _PACKING
|
---|
714 | PASS_PACKING_pass := packing
|
---|
715 | #alias
|
---|
716 | packing: pass_packing
|
---|
717 |
|
---|
718 | ## PASS: clean
|
---|
719 | # This pass removes all generated files.
|
---|
720 | PASS_CLEAN := Clean
|
---|
721 | PASS_CLEAN_trgs := do-clean
|
---|
722 | PASS_CLEAN_vars :=
|
---|
723 | PASS_CLEAN_pass := clean
|
---|
724 | # alias
|
---|
725 | clean: pass_clean
|
---|
726 |
|
---|
727 | ## PASS: nothing
|
---|
728 | # This pass just walks the tree.
|
---|
729 | PASS_NOTHING := Nothing
|
---|
730 | PASS_NOTHING_trgs := do-nothing
|
---|
731 | PASS_NOTHING_vars :=
|
---|
732 | PASS_NOTHING_pass := nothing
|
---|
733 | # alias
|
---|
734 | nothing: pass_nothing
|
---|
735 |
|
---|
736 | ## DEFAULT_PASSES
|
---|
737 | # The default passes and their order.
|
---|
738 | DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS INSTALLS
|
---|
739 |
|
---|
740 | ## PASSES
|
---|
741 | # The passes that should be defined. This must include
|
---|
742 | # all passes mentioned by DEFAULT_PASSES.
|
---|
743 | PASSES := FETCHES PATCHES $(DEFAULT_PASSES) NOTHING CLEAN
|
---|
744 |
|
---|
745 |
|
---|
746 | #
|
---|
747 | # Include the gnumake header hacks if we're not using kmk.
|
---|
748 | #
|
---|
749 | ifndef KMK_VERSION
|
---|
750 | include $(PATH_KBUILD)/gnumake-header.kmk
|
---|
751 | endif
|
---|
752 |
|
---|
753 |
|
---|
754 | #
|
---|
755 | # This is how we find the closest config.kmk.
|
---|
756 | # It's a little hacky but I think it works fine.
|
---|
757 | #
|
---|
758 | _CFGDIR := .
|
---|
759 | _CFGFILES := ./Config.kmk ./config.kmk
|
---|
760 | define def_include_config
|
---|
761 | $(eval _CFGDIR := $(_CFGDIR)/$(dir))
|
---|
762 | _CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
|
---|
763 | endef
|
---|
764 | # walk down the _RELATIVE_ path specified by DEPTH.
|
---|
765 | $(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
|
---|
766 | # add the default config file.
|
---|
767 | _CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
|
---|
768 | _CFGFILES :=
|
---|
769 | _CFGDIR :=
|
---|
770 | ifeq ($(_CFGFILE),)
|
---|
771 | $(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)')
|
---|
772 | endif
|
---|
773 |
|
---|
774 | #
|
---|
775 | # Check for --pretty-command-printing before including the Config.kmk
|
---|
776 | # so that anyone overriding the message macros can take the implied
|
---|
777 | # verbosity level change into account.
|
---|
778 | #
|
---|
779 | ifndef KBUILD_VERBOSE
|
---|
780 | ifndef KBUILD_QUIET
|
---|
781 | ifneq ($(filter --pretty-command-printing,$(MAKEFLAGS)),)
|
---|
782 | export KBUILD_VERBOSE := 2
|
---|
783 | endif
|
---|
784 | endif
|
---|
785 | endif
|
---|
786 |
|
---|
787 |
|
---|
788 | # Include the config.kmk we found file (or the default one).
|
---|
789 | include $(_CFGFILE)
|
---|
790 |
|
---|
791 |
|
---|
792 | #
|
---|
793 | # Finalize a the central path variables now that we've included the Config.kmk file.
|
---|
794 | #
|
---|
795 | # This prevents some trouble when users override the defaults for these
|
---|
796 | # variables and uses relative paths or paths with incorrect case.
|
---|
797 | #
|
---|
798 | PATH_OUT := $(abspath $(PATH_OUT))
|
---|
799 | PATH_OBJ := $(abspath $(PATH_OBJ))
|
---|
800 | PATH_TARGET := $(abspath $(PATH_TARGET))
|
---|
801 | PATH_INS := $(abspath $(PATH_INS))
|
---|
802 | PATH_BIN := $(abspath $(PATH_BIN))
|
---|
803 | PATH_DLL := $(abspath $(PATH_DLL))
|
---|
804 | PATH_SYS := $(abspath $(PATH_SYS))
|
---|
805 | PATH_LIB := $(abspath $(PATH_LIB))
|
---|
806 | PATH_DOC := $(abspath $(PATH_DOC))
|
---|
807 |
|
---|
808 |
|
---|
809 | #
|
---|
810 | # Setup the message style. The default one is inlined.
|
---|
811 | #
|
---|
812 | # See kBuild/msgstyles for more styles or use KBUILD_MSG_STYLE_PATHS
|
---|
813 | # to create your own message style.
|
---|
814 | #
|
---|
815 | KBUILD_MSG_STYLE ?= default
|
---|
816 | ifeq ($(KBUILD_MSG_STYLE),default)
|
---|
817 | #
|
---|
818 | # The 'default' style.
|
---|
819 | #
|
---|
820 |
|
---|
821 | ## Fetch starting.
|
---|
822 | # @param 1 Target name.
|
---|
823 | MSG_FETCH ?= $(call MSG_L1,Fetching $1...)
|
---|
824 | ## Re-fetch starting.
|
---|
825 | # @param 1 Target name.
|
---|
826 | MSG_REFETCH ?= $(call MSG_L1,Re-fetching $1...)
|
---|
827 | ## Downloading a fetch component.
|
---|
828 | # @param 1 Target name.
|
---|
829 | # @param 2 The source URL.
|
---|
830 | # @param 3 The destination file name.
|
---|
831 | MSG_FETCH_DL ?= $(call MSG_L1,Downloading $1 - $2,=> $3)
|
---|
832 | ## Checking a fetch component.
|
---|
833 | # @param 1 Target name.
|
---|
834 | # @param 2 The source URL.
|
---|
835 | # @param 3 The destination file name.
|
---|
836 | MSG_FETCH_CHK?= $(call MSG_L1,Checking $1 - $3, ($2))
|
---|
837 | ## Unpacking a fetch component.
|
---|
838 | # @param 1 Target name.
|
---|
839 | # @param 2 The archive file name.
|
---|
840 | # @param 3 The target directory.
|
---|
841 | MSG_FETCH_UP ?= $(call MSG_L1,Unpacking $1 - $2 => $3)
|
---|
842 | ## Fetch completed.
|
---|
843 | # @param 1 Target name.
|
---|
844 | MSG_FETCH_OK ?= $(call MSG_L1,Successfully fetched $1)
|
---|
845 | ## Unfetch a fetch target.
|
---|
846 | # @param 1 Target name.
|
---|
847 | MSG_UNFETCH ?= $(call MSG_L1,Unfetching $1...)
|
---|
848 | ## Compiling a source file.
|
---|
849 | # @param 1 Target name.
|
---|
850 | # @param 2 The source filename.
|
---|
851 | # @param 3 The primary link output file name.
|
---|
852 | # @param 4 The source type (CXX,C,AS,RC,++).
|
---|
853 | MSG_COMPILE ?= $(call MSG_L1,Compiling $1 - $2,=> $3)
|
---|
854 | ## Tool
|
---|
855 | # @param 1 The tool name (bin2c,...)
|
---|
856 | # @param 2 Target name.
|
---|
857 | # @param 3 The source filename.
|
---|
858 | # @param 4 The primary output file name.
|
---|
859 | MSG_TOOL ?= $(call MSG_L1,$1 $2 - $3,=> $4)
|
---|
860 | ## Generate a file, typically a source file.
|
---|
861 | # @param 1 Target name if applicable.
|
---|
862 | # @param 2 Output file name.
|
---|
863 | # @param 3 What it's generated from
|
---|
864 | MSG_GENERATE ?= $(call MSG_L1,Generating $(if $1,$1 - )$2,$(if $3,from $3))
|
---|
865 | ## Linking a bldprog/dll/program/sysmod target.
|
---|
866 | # @param 1 Target name.
|
---|
867 | # @param 2 The primary link output file name.
|
---|
868 | # @param 3 The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
|
---|
869 | MSG_LINK ?= $(call MSG_L1,Linking $1,=> $2)
|
---|
870 | ## Merging a library into the target (during library linking).
|
---|
871 | # @param 1 Target name.
|
---|
872 | # @param 2 The output library name.
|
---|
873 | # @param 3 The input library name.
|
---|
874 | MSG_AR_MERGE ?= $(call MSG_L1,Merging $3 into $1, ($2))
|
---|
875 | ## Creating a directory (build).
|
---|
876 | # @param 1 Directory name.
|
---|
877 | MSG_MKDIR ?= $(call MSG_L2,Creating directory $1)
|
---|
878 | ## Cleaning.
|
---|
879 | MSG_CLEAN ?= $(call MSG_L1,Cleaning...)
|
---|
880 | ## Nothing.
|
---|
881 | MSG_NOTHING ?= $(call MSG_L1,Did nothing in $(CURDIR))
|
---|
882 | ## Pass
|
---|
883 | # @param 1 The pass name.
|
---|
884 | MSG_PASS ?= $(call MSG_L1,Pass - $1)
|
---|
885 | ## Installing a bldprog/lib/dll/program/sysmod target.
|
---|
886 | # @param 1 Target name.
|
---|
887 | # @param 2 The source filename.
|
---|
888 | # @param 3 The destination file name.
|
---|
889 | MSG_INST_TRG ?= $(call MSG_L1,Installing $1 => $3)
|
---|
890 | ## Installing a file (install target).
|
---|
891 | # @param 1 The source filename.
|
---|
892 | # @param 2 The destination filename.
|
---|
893 | MSG_INST_FILE?= $(call MSG_L1,Installing $2,(<= $1))
|
---|
894 | ## Installing a symlink.
|
---|
895 | # @param 1 Symlink
|
---|
896 | # @param 2 Link target
|
---|
897 | MSG_INST_SYM ?= $(call MSG_L1,Installing symlink $1,=> $2)
|
---|
898 | ## Installing a directory.
|
---|
899 | # @param 1 Directory name.
|
---|
900 | MSG_INST_DIR ?= $(call MSG_L1,Installing directory $1)
|
---|
901 |
|
---|
902 | else
|
---|
903 | _KBUILD_MSG_STYLE_FILE := $(firstword $(foreach path, $(KBUILD_MSG_STYLE_PATHS) $(PATH_KBUILD)/msgstyles, $(wildcard $(path)/$(KBUILD_MSG_STYLE).kmk)))
|
---|
904 | ifneq ($(_KBUILD_MSG_STYLE_FILE),)
|
---|
905 | include $(_KBUILD_MSG_STYLE_FILE)
|
---|
906 | else
|
---|
907 | $(error kBuild: Can't find the style setup file for KBUILD_MSG_STYLE '$(KBUILD_MSG_STYLE)')
|
---|
908 | endif
|
---|
909 | endif
|
---|
910 |
|
---|
911 |
|
---|
912 | #
|
---|
913 | # Message macros.
|
---|
914 | #
|
---|
915 | # This is done after including Config.kmk as to allow for
|
---|
916 | # KBUILD_QUIET and KBUILD_VERBOSE to be configurable.
|
---|
917 | #
|
---|
918 | ifdef KBUILD_QUIET
|
---|
919 | # No output
|
---|
920 | QUIET := @
|
---|
921 | QUIET2:= @
|
---|
922 | MSG_L1 =
|
---|
923 | MSG_L2 =
|
---|
924 | else
|
---|
925 | ifndef KBUILD_VERBOSE
|
---|
926 | # Default output level.
|
---|
927 | QUIET := @
|
---|
928 | QUIET2 := @
|
---|
929 | MSG_L1 ?= @$(ECHO) "kBuild: $1"
|
---|
930 | MSG_L2 =
|
---|
931 | else ifeq ($(KBUILD_VERBOSE),1)
|
---|
932 | # A bit more output
|
---|
933 | QUIET := @
|
---|
934 | QUIET2 := @
|
---|
935 | MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
|
---|
936 | MSG_L2 =
|
---|
937 | else ifeq ($(KBUILD_VERBOSE),2)
|
---|
938 | # Lot more output
|
---|
939 | QUIET :=
|
---|
940 | QUIET2 := @
|
---|
941 | MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
|
---|
942 | MSG_L2 ?= @$(ECHO) "kBuild: $1"
|
---|
943 | else
|
---|
944 | # maximal output.
|
---|
945 | QUIET :=
|
---|
946 | QUIET2 :=
|
---|
947 | MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
|
---|
948 | MSG_L2 ?= @$(ECHO) "kBuild: $1"
|
---|
949 | endif
|
---|
950 | endif
|
---|
951 |
|
---|
952 |
|
---|
953 | # end-of-file-content
|
---|
954 | __header_kmk__ := 1
|
---|
955 | endif # __header_kmk__
|
---|
956 |
|
---|
957 |
|
---|