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