Built win.arm64 against r3658
[kbuild-mirror.git] / Config.kmk
blobf12cb3a48fe2750846ff51d55df728ccdd504691
1 # $Id$
2 ## @file
3 # Build Configuration.
7 # Copyright (c) 2005-2012 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
9 # This file is part of kBuild.
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 3 of the License, or
14 # (at your option) any later version.
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.
21 # You should have received a copy of the GNU General Public License
22 # along with kBuild. If not, see <http://www.gnu.org/licenses/>
26 # Enable automatic installation of what's built.
27 KBUILD_DO_AUTO_INSTALL := 1
31 # The kBuild version.
33 KBUILD_VERSION_MAJOR = 0
34 KBUILD_VERSION_MINOR = 1
35 KBUILD_VERSION_PATCH = 9998
36 KBUILD_VERSION = 0.1.9998
37 DEFS += \
38 KBUILD_VERSION_MAJOR=$(KBUILD_VERSION_MAJOR) \
39 KBUILD_VERSION_MINOR=$(KBUILD_VERSION_MINOR) \
40 KBUILD_VERSION_PATCH=$(KBUILD_VERSION_PATCH)
43 # Get the svn version.
44 # This is shipped with the tarballs in a SvnInfo.kmk in the root.
46 ifneq ($(wildcard $(PATH_ROOT)/SvnInfo.kmk),)
47 # Shipped
48 KBUILD_SVN_INFO_KMK := $(PATH_ROOT)/SvnInfo.kmk
49 KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK)
51 else ifneq ($(wildcard $(PATH_ROOT)/.svn/ $(PATH_ROOT)/../.svn/),)
52 # Generate from svn info
53 KBUILD_SVN_INFO_KMK := $(PATH_OBJ)/SvnInfo.kmk
54 KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK)
55 KBUILD_SVN_TOOL := svn
57 $(PATH_OBJ)/SvnInfo.ts +| $(KBUILD_SVN_INFO_KMK): $(wildcard $(addprefix $(PATH_ROOT)/.svn/ $(PATH_ROOT)/../.svn/,\
58 . \
59 pristine \
60 wc.db \
61 tmp \
62 entries \
63 all-wcprops \
64 format \
65 props \
66 prop-base ) )
67 $(call MSG_GENERATE,,$(KBUILD_SVN_INFO_KMK))
68 @$(RM) -f $@ $@.tmp
69 @$(MKDIR) -p $(@D)
70 @$(REDIRECT) -o $@.tmp -E 'LC_ALL=C' -- $(KBUILD_SVN_TOOL) info $(DEPTH)
71 @$(SED) \
72 -e 's/^URL: */KBUILD_SVN_URL := /' \
73 -e 's/Revision: */KBUILD_SVN_REV := /' \
74 -e '/KBUILD_SVN_/!d' \
75 --append $@ \
76 $@.tmp
77 @$(RM) -f $@.tmp
78 @$(CP) --changed -fv $@ $(KBUILD_SVN_INFO_KMK)
80 ifeq ($(DEPTH),.)
81 OTHER_CLEAN += $(KBUILD_SVN_INFO_KMK) $(PATH_OBJ)/SvnInfo.ts
82 endif
84 else
85 # Some incomplete source export...
86 KBUILD_SVN_INFO_KMK := $(PATH_OBJ)/SvnInfo.kmk
87 KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK)
88 $(warning Neither SvnInfo nor .svn/* was found in the root. Will have to cook up something too keep the build happy.)
89 $(KBUILD_SVN_INFO_KMK):
90 $(RM) -f $@
91 $(MKDIR) -p $(@D)
92 $(APPEND) $@ 'KBUILD_SVN_REV := 0'
93 $(APPEND) $@ 'KBUILD_SVN_URL := /dev/null'
95 ifeq ($(DEPTH),.)
96 OTHER_CLEAN += $(KBUILD_SVN_INFO_KMK)
97 endif
99 endif
100 include $(KBUILD_SVN_INFO_KMK)
104 # Local config, optional.
106 ifneq ($(wildcard $(PATH_ROOT)/LocalConfig.kmk),)
107 include $(PATH_ROOT)/LocalConfig.kmk
108 endif
112 # Where to fine the GNU Make stuff (for FreeBSD and Windows).
114 PATH_GNUMAKE_SRC ?= $(PATH_ROOT)/src/kmk
118 # Various platform specific hacks.
120 ifn1of ($(KBUILD_TARGET), haiku openbsd)
121 GCC_Wextra = -Wextra
122 endif
123 if1of ($(KBUILD_TARGET), openbsd)
124 TOOL_FLEX_LEX = gflex
125 endif
126 # Not all compiler tools currently do the same quoting of DEFS, so here's a
127 # temporary workaround.
128 if "$(KBUILD_TARGET)" != "win" || defined(KBUILD_NEW_VCC)
129 TMP_QUOTE_SLASH :=
130 else
131 TMP_QUOTE_SLASH := \$(NO_SUCH_VARIABLE)
132 endif
135 # The OS and Architecture indicators.
137 DEFS.darwin += KBUILD_OS_DARWIN
138 DEFS.freebsd += KBUILD_OS_FREEBSD
139 DEFS.linux += KBUILD_OS_LINUX
140 DEFS.netbsd += KBUILD_OS_NETBSD
141 DEFS.openbsd += KBUILD_OS_OPENBSD
142 DEFS.os2 += KBUILD_OS_OS2
143 DEFS.solaris += KBUILD_OS_SOLARIS
144 DEFS.win += KBUILD_OS_WINDOWS
146 DEFS.x86 += KBUILD_ARCH_X86
147 DEFS.amd64 += KBUILD_ARCH_AMD64
148 DEFS.arm64 += KBUILD_ARCH_ARM64
152 # Check if we're building a *nix installation.
154 # There are a few optional overrides here for customizing the install location
155 # and how it is installed:
156 # MY_INST_BIN - the bin/ directory (the trailing slash is mandatory).
157 # MY_INST_DATA - the share/kBuild/ directory (the trailing slash is mandatory).
158 # MY_INST_DOC - the share/doc/kBuild-x.y.z/ directory (the trailing slash is mandatory).
159 # MY_INST_UID - the default install UID or user name.
160 # MY_INST_GID - the default install GID or group name.
161 # MY_INST_MODE - the default install mode mask, ",a+x" is added for executables and files.
162 # MY_INST_DATA_UID - data specialization.
163 # MY_INST_DATA_GID - data specialization.
164 # MY_INST_DATA_MODE - data specialization.
165 # MY_INST_DOC_UID - doc specialization.
166 # MY_INST_DOC_GID - doc specialization.
167 # MY_INST_DOC_MODE - doc specialization.
168 # MY_INST_BIN_UID - binary (executable) specialization.
169 # MY_INST_BIN_GID - binary (executable) specialization.
170 # MY_INST_BIN_MODE - binary (executable) specialization.
172 # When running kmk install, you can use PATH_INS like you use DESTDIR in other makefile
173 # systems. (These things will be improved in 0.2.x btw, so will be possible to enable a
174 # mode where PREFIX and DESTDIR will.)
177 ifdef NIX_INSTALL_DIR
178 MY_INST_ROOT := $(patsubst /%,%,$(NIX_INSTALL_DIR))/
179 ifndef MY_INST_BIN
180 MY_INST_BIN := $(MY_INST_ROOT)bin/
181 endif
182 ifndef MY_INST_DATA
183 MY_INST_DATA := $(MY_INST_ROOT)share/kBuild/
184 endif
185 ifndef MY_INST_DOC
186 MY_INST_DOC := $(MY_INST_ROOT)share/doc/kBuild-$(KBUILD_VERSION)/
187 endif
188 if !defined(MY_INST_BIN_MODE) && defined(MY_INST_MODE)
189 MY_INST_BIN_MODE := $(MY_INST_MODE),a+x
190 endif
192 DEFS += \
193 KBUILD_PATH=$(TMP_QUOTE_SLASH)"/$(patsubst %/,%,$(MY_INST_DATA))$(TMP_QUOTE_SLASH)" \
194 KBUILD_BIN_PATH=$(TMP_QUOTE_SLASH)"/$(patsubst %/,%,$(MY_INST_BIN))$(TMP_QUOTE_SLASH)"
195 endif
199 # Templates for installing docs and make scripts.
201 TEMPLATE_DATA = Data installation template.
202 TEMPLATE_DATA_INST = $(MY_INST_DATA)
203 TEMPLATE_DATA_MODE ?= $(firstword $(MY_INST_DATA_MODE) $(MY_INST_MODE) a+r)
204 TEMPLATE_DATA_UID ?= $(firstword $(MY_INST_DATA_UID) $(MY_INST_UID))
205 TEMPLATE_DATA_GID ?= $(firstword $(MY_INST_DATA_GID) $(MY_INST_GID))
207 TEMPLATE_DOC = Documentation installation template.
208 TEMPLATE_DOC_INST = $(MY_INST_DOC)
209 TEMPLATE_DOC_MODE ?= $(firstword $(MY_INST_DOC_MODE) $(MY_INST_MODE) a+r)
210 TEMPLATE_DOC_UID ?= $(firstword $(MY_INST_DOC_UID) $(MY_INST_UID))
211 TEMPLATE_DOC_GID ?= $(firstword $(MY_INST_DOC_GID) $(MY_INST_GID))
215 # Template for building commandline tools.
217 TEMPLATE_BIN = Command line binary
219 TEMPLATE_BIN_INCS = \
220 $(PATH_ROOT)/src/lib \
221 $(PATH_ROOT)/src/lib/kStuff/include
222 TEMPLATE_BIN_DEFS.profile = NDEBUG
223 TEMPLATE_BIN_DEFS.release = NDEBUG
224 if defined(NIX_INSTALL_DIR) && !defined(KBUILD_BOOTSTRAP)
225 TEMPLATE_BIN_INST = $(MY_INST_BIN)
226 TEMPLATE_BIN_MODE ?= $(firstword $(MY_INST_BIN_MODE) a+rx)
227 TEMPLATE_BIN_UID ?= $(firstword $(MY_INST_BIN_UID) $(MY_INST_UID))
228 TEMPLATE_BIN_GID ?= $(firstword $(MY_INST_BIN_GID) $(MY_INST_GID))
229 else
230 TEMPLATE_BIN_INST = kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
231 endif
234 ifeq ($(KBUILD_TARGET),os2)
235 TEMPLATE_BIN_TOOL = GCC3OMF
236 TEMPLATE_BIN_CFLAGS = -g
237 TEMPLATE_BIN_CFLAGS.profile = -pg
238 TEMPLATE_BIN_CFLAGS.release = -O3
239 TEMPLATE_BIN_LDFLAGS = -Zhigh-mem -Zstack=1024 -g
241 else if1of ($(KBUILD_TARGET), win nt)
242 ifdef KBUILD_NEW_VCC
243 TEMPLATE_BIN_TOOL = VCC143
244 TEMPLATE_BIN_TOOL.x86 = VCC143X86
245 TEMPLATE_BIN_TOOL.amd64 = VCC143AMD64
246 else
247 TEMPLATE_BIN_TOOL = VCC100
248 TEMPLATE_BIN_TOOL.x86 = VCC100X86
249 TEMPLATE_BIN_TOOL.amd64 = VCC100AMD64
250 endif
251 TEMPLATE_BIN_TOOL.arm64 = VCC143ARM64
252 TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_WARNINGS
253 TEMPLATE_BIN_DEFS.x86 = WIN32 __WIN32__
254 TEMPLATE_BIN_DEFS.amd64 = WIN32 __WIN32__ __WIN64__ WIN64
255 TEMPLATE_BIN_CFLAGS = -W3 -Zi -Zl -Gy -we4013
256 TEMPLATE_BIN_CFLAGS.release = -O2
257 TEMPLATE_BIN_CFLAGS.profile = -O2 -GH -Gh
258 TEMPLATE_BIN_INCS += \
260 $(PATH_GNUMAKE_SRC)/w32/include \
261 $(PATH_GNUMAKE_SRC)/glob
262 TEMPLATE_BIN_LDFLAGS = /SUBSYSTEM:console /INCREMENTAL:no /NOD /DEBUG /OPT:REF /OPT:ICF /LargeAddressAware
263 ifdef KBUILD_NEW_VCC
264 ifdef KBUILD_WITH_STATIC_MSVCRT
265 TEMPLATE_BIN_SDKS = WINSDK10-UM WINSDK10-UCRT-STATIC
266 TEMPLATE_BIN_CFLAGS += -MT
267 TEMPLATE_BIN_LATE_LIBS.x86 = \
268 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/vcruntime.lib \
269 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/oldnames.lib \
270 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/libcmt.lib \
271 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/libcpmt.lib
272 TEMPLATE_BIN_LATE_LIBS.amd64 = \
273 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/vcruntime.lib \
274 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/oldnames.lib \
275 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/libcmt.lib \
276 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/libcpmt.lib
277 TEMPLATE_BIN_LATE_LIBS.arm64 = \
278 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/vcruntime.lib \
279 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/oldnames.lib \
280 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/libcmt.lib \
281 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/libcpmt.lib
282 else
283 TEMPLATE_BIN_SDKS = WINSDK10-UM WINSDK10-UCRT
284 TEMPLATE_BIN_CFLAGS += -MD
285 TEMPLATE_BIN_LATE_LIBS.x86 = \
286 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/vcruntime.lib \
287 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/oldnames.lib \
288 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/msvcrt.lib
289 TEMPLATE_BIN_LATE_LIBS.amd64 = \
290 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/vcruntime.lib \
291 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/oldnames.lib \
292 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/msvcrt.lib
293 TEMPLATE_BIN_LATE_LIBS.arm64 = \
294 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.arm64)_LIB)/vcruntime.lib \
295 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.arm64)_LIB)/oldnames.lib \
296 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.arm64)_LIB)/msvcrt.lib
297 endif
298 else ifeq ($(KBUILD_TYPE),profile)
299 TEMPLATE_BIN_SDKS = WINPSDKINCS
300 TEMPLATE_BIN_CFLAGS += -MT
301 TEMPLATE_BIN_LIBS = \
302 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2.lib \
303 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \
304 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
305 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \
306 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib \
307 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \
308 $(PATH_SDK_WINPSDKINCS_LIB)/AdvAPI32.lib \
309 $(PATH_SDK_WINPSDKINCS_LIB)/User32.lib
310 else
311 TEMPLATE_BIN_SDKS = WINPSDK71
312 ifdef KBUILD_WITH_STATIC_MSVCRT
313 TEMPLATE_BIN_CFLAGS += -MT
314 TEMPLATE_BIN_LIBS = \
315 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
316 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \
317 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib
318 else
319 TEMPLATE_BIN_CFLAGS += -MD
320 TEMPLATE_BIN_LIBS.amd64 = \
321 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/oldnames.lib \
322 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/msvcrt.lib
323 TEMPLATE_BIN_LIBS.x86 = \
324 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/oldnames.lib \
325 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/msvcrt.lib
326 endif
327 endif
328 # HACK ALERT! Using kmk_builting_redirect here to bypass some shell quoting issue.
329 ifdef KBUILD_NEW_VCC # The OLD CRT will use the codepage default to the locale rather than UTF-8, so APC and CRT ends
330 # up using different code pages when a locale other than "C" is used. Thus, only enable for new compiler.
331 TEMPLATE_BIN_POST_CMDS.win = \
332 $(QUIET)$(APPEND) -tn "$(out).manifest" \
333 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' \
334 '<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">' \
335 ' <assemblyIdentity type="win32" name="$(notdir $(out))" version="$(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR).$(KBUILD_VERSION_PATCH).$(KBUILD_SVN_REV)"/>' \
336 ' <application>' \
337 ' <windowsSettings>' \
338 ' <activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>' \
339 ' </windowsSettings>' \
340 ' </application>' \
341 '</assembly>' \
342 $(NLTAB)$(QUIET)$(REDIRECT) -- $(requote sh,$(PATH_SDK_$(firstword $(TEMPLATE_$($(target)_TEMPLATE)_SDKS))_BIN)/mt.exe) \
343 -nologo -manifest '$(subst /,\,$(out).manifest)' '-outputresource:$(subst /,\,$(out));$(HASH)1' \
344 $(NLTAB)$(QUIET)$(RM) -f -- "$(out).manifest"
345 endif
347 else # !os2, !win, !nt
349 ifeq ($(KBUILD_TARGET),darwin)
350 ifndef KBUILD_MACOSX_VERSION
351 export KBUILD_MACOSX_VERSION := $(expr $(firstword $(subst ., ,$(shell uname -r))) - 4)
352 endif
353 #ifndef KBUILD_XCODE_VERSION
354 # export KBUILD_XCODE_VERSION := $(shell xcodebuild -version | kmk_sed -e '/Xcode/!d' -e 's/Xcode *//')
355 #endif
356 ifndef KBUILD_MACOSX_TARGET_VERSION
357 if $(KBUILD_TARGET_ARCH) == amd64
358 KBUILD_MACOSX_TARGET_VERSION = 6
359 else if $(KBUILD_TARGET_ARCH) == arm64
360 KBUILD_MACOSX_TARGET_VERSION := 0
361 KBUILD_MACOSX_TARGET_MAJOR_VERSION := 11
362 else
363 KBUILD_MACOSX_TARGET_VERSION = 5
364 endif
365 endif
366 ifndef KBUILD_MACOSX_TARGET_MAJOR_VERSION
367 KBUILD_MACOSX_TARGET_MAJOR_VERSION := 10
368 endif
369 ifndef KBUILD_MACOSX_WHATEVER_MODE
370 if $(KBUILD_MACOSX_TARGET_VERSION) <= 4 && $(KBUILD_MACOSX_TARGET_MAJOR_VERSION) == 10
371 TOOL_GCC4MACHO_SUFFIX = -4.0
372 TOOL_GXX4MACHO_SUFFIX = -4.0
373 else if $(KBUILD_MACOSX_TARGET_VERSION) <= 9 && $(KBUILD_MACOSX_TARGET_MAJOR_VERSION) == 10 # dunno which exactly.
374 TOOL_GCC4MACHO_SUFFIX = -4.2
375 TOOL_GXX4MACHO_SUFFIX = -4.2
376 endif
377 ifndef KBUILD_MACOSX_SDK
378 KBUILD_MACOSX_SDK := /Developer/SDKs/MacOSX$(KBUILD_MACOSX_TARGET_MAJOR_VERSION).$(KBUILD_MACOSX_TARGET_VERSION)$(if-expr $(KBUILD_MACOSX_TARGET_MAJOR_VERSION).$(KBUILD_MACOSX_TARGET_VERSION)==10.4,u,).sdk
379 ifeq ($(wildcard $(KBUILD_MACOSX_SDK)),)
380 KBUILD_MACOSX_SDK := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform$(KBUILD_MACOSX_SDK)
381 endif
382 ifeq ($(wildcard $(KBUILD_MACOSX_SDK)),)
383 KBUILD_MACOSX_SDK := /Library/Developer/CommandLineTools/SDKs/MacOSX$(KBUILD_MACOSX_TARGET_MAJOR_VERSION).$(KBUILD_MACOSX_TARGET_VERSION)$(if-expr $(KBUILD_MACOSX_TARGET_MAJOR_VERSION).$(KBUILD_MACOSX_TARGET_VERSION)==10.4,u,).sdk
384 endif
385 endif
386 ifeq ($(wildcard $(KBUILD_MACOSX_SDK)),)
387 $(error SDK not found ($(KBUILD_MACOSX_SDK)), please adjust KBUILD_MACOSX_TARGET_VERSION or/and KBUILD_MACOSX_SDK in LocalConfig.kmk or simply use KBUILD_MACOSX_WHATEVER_MODE=1.)
388 endif
389 endif # !KBUILD_MACOSX_WHATEVER_MODE
390 TEMPLATE_BIN_TOOL = GCC4MACHO
391 TEMPLATE_BIN_CFLAGS = -g -mmacosx-version-min=$(KBUILD_MACOSX_TARGET_MAJOR_VERSION).$(KBUILD_MACOSX_TARGET_VERSION) $(if $(KBUILD_MACOSX_WHATEVER_MODE),,-isysroot $(KBUILD_MACOSX_SDK))
392 ifeq ($(USER),bird)
393 TEMPLATE_BIN_CFLAGS += -Wall $(GCC_Wextra) -pedantic -Wno-unused-parameter -Wno-long-long -Wshadow
394 TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS
395 endif
396 TEMPLATE_BIN_CFLAGS.profile = -O3 -pg
397 TEMPLATE_BIN_CFLAGS.release = -O3
398 TEMPLATE_BIN_LDFLAGS = -g -mmacosx-version-min=$(KBUILD_MACOSX_TARGET_MAJOR_VERSION).$(KBUILD_MACOSX_TARGET_VERSION) $(if $(KBUILD_MACOSX_WHATEVER_MODE),,-Wl,-syslibroot,$(KBUILD_MACOSX_SDK))
399 if $(KBUILD_MACOSX_TARGET_VERSION) == 4 && $(KBUILD_MACOSX_VERSION) >= 5 && $(KBUILD_MACOSX_TARGET_MAJOR_VERSION) == 10
400 TEMPLATE_BIN_LDFLAGS += -classic_ld
401 endif
402 TEMPLATE_BIN_LDFLAGS.profile = -pg
404 else # !darwin
405 # Use GCC3 when we're certain that the system is using GNU ld and ar.
406 ifeq ($(filter-out linux freebsd openbsd netbsd,$(KBUILD_TARGET)),)
407 TEMPLATE_BIN_TOOL = GCC3
408 else
409 TEMPLATE_BIN_TOOL = GCC3PLAIN
410 endif
411 TEMPLATE_BIN_CFLAGS = -g
412 ifeq ($(USER),bird)
413 TEMPLATE_BIN_CFLAGS += -Wall $(GCC_Wextra) -pedantic -Wno-unused-parameter -Wshadow
414 TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS
415 endif
416 TEMPLATE_BIN_LDFLAGS = -g
417 TEMPLATE_BIN_LDFLAGS.profile = -pg -p
418 TEMPLATE_BIN_CFLAGS.release = -O3
419 TEMPLATE_BIN_CFLAGS.profile = -O3 -pg -p
420 ifeq ($(KBUILD_TARGET),freebsd)
421 TEMPLATE_BIN_INCS += $(PATH_GNUMAKE_SRC)/glob /usr/local/include
422 endif
423 ifeq ($(KBUILD_TARGET),linux)
424 TEMPLATE_BIN_LIBS += rt
425 endif
426 endif
428 # Make sure we get the right bit count in the output.
429 TEMPLATE_BIN_CFLAGS.x86 += -m32
430 TEMPLATE_BIN_CFLAGS.x32 += -mx32
431 TEMPLATE_BIN_CFLAGS.sparc32 += -m32
432 TEMPLATE_BIN_CFLAGS.amd64 += -m64
433 TEMPLATE_BIN_CFLAGS.sparc64 += -m64
434 TEMPLATE_BIN_CXXFLAGS.x86 += -m32
435 TEMPLATE_BIN_CXXFLAGS.x32 += -mx32
436 TEMPLATE_BIN_CXXFLAGS.sparc32 += -m32
437 TEMPLATE_BIN_CXXFLAGS.amd64 += -m64
438 TEMPLATE_BIN_CXXFLAGS.sparc64 += -m64
439 TEMPLATE_BIN_LDFLAGS.x86 += -m32
440 TEMPLATE_BIN_LDFLAGS.x32 += -mx32
441 TEMPLATE_BIN_LDFLAGS.sparc32 += -m32
442 TEMPLATE_BIN_LDFLAGS.amd64 += -m64
443 TEMPLATE_BIN_LDFLAGS.sparc64 += -m64
444 ifeq ($(KBUILD_TARGET),solaris)
445 TEMPLATE_BIN_LIBS += rt dl
446 TEMPLATE_BIN_LDFLAGS += -Wl,-i
447 TEMPLATE_BIN_DEFS.x86 += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE
448 TEMPLATE_BIN_DEFS.sparc32 += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE
449 endif
450 ifeq ($(KBUILD_TARGET),netbsd)
451 TEMPLATE_BIN_LIBS += util
452 endif
453 endif
455 # On systems where it's possible, do split out the debug info from the binaries.
456 if1of ($(KBUILD_TARGET), darwin win)
457 TEMPLATE_BIN_LD_DEBUG = split
458 endif
461 # Template for building threaded binaries.
463 TEMPLATE_BIN-THREADED = Threaded command line binary
464 TEMPLATE_BIN-THREADED_EXTENDS = BIN
465 TEMPLATE_BIN-THREADED_EXTENDS_BY = appending
466 if1of ($(KBUILD_TARGET), dragonfly freebsd gnuhurd gnukfbsd gnuknbsd linux netbsd openbsd)
467 TEMPLATE_BIN-THREADED_LIBS = pthread
468 endif
471 # Template for building libraries for the tools.
473 TEMPLATE_LIB = Library for Commandline binary
474 TEMPLATE_LIB_EXTENDS = BIN
475 TEMPLATE_LIB_INST = lib/
476 # for LIB_KDEP
477 TEMPLATE_LIB_TOOL = $(TEMPLATE_BIN_TOOL)
478 TEMPLATE_LIB_CLEAN.win = $(NO_SUCH_VARIABLE)
479 TEMPLATE_LIB_LNK_DEPS.win = $(NO_SUCH_VARIABLE)
480 TEMPLATE_LIB_POST_CMDS.win = $(NO_SUCH_VARIABLE)
483 # Template for static threaded binaries (windows).
485 TEMPLATE_BIN-STATIC-THREADED = Threaded command line binary
486 TEMPLATE_BIN-STATIC-THREADED_EXTENDS = BIN-THREADED
487 ifeq ($(filter-out win nt,$(KBUILD_TARGET)),)
488 TEMPLATE_BIN-STATIC-THREADED_CFLAGS = $(filter-out -MD,$(TEMPLATE_BIN-THREADED_CFLAGS)) -MT
489 TEMPLATE_BIN-STATIC-THREADED_LIBS.amd64 = $(filter-out %/msvcrt.lib,$(TEMPLATE_BIN-THREADED_LIBS.amd64)) \
490 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/libcmt.lib \
491 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/libcpmt.lib
492 TEMPLATE_BIN-STATIC-THREADED_LIBS.x86 = $(filter-out %/msvcrt.lib,$(TEMPLATE_BIN-THREADED_LIBS.x86)) \
493 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/libcmt.lib \
494 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/libcpmt.lib
495 else
496 TEMPLATE_BIN-STATIC-THREADED_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) -static
497 TEMPLATE_BIN-STATIC-THREADED_LDFLAGS = $(TEMPLATE_BIN-THREADED_LDFLAGS) -static
498 endif
501 # Template for static threaded libraries.
503 TEMPLATE_LIB-STATIC-THREADED = Threaded command line library
504 TEMPLATE_LIB-STATIC-THREADED_EXTENDS = BIN-STATIC-THREADED
505 TEMPLATE_LIB-STATIC-THREADED_INST = lib/
506 TEMPLATE_LIB-STATIC-THREADED_POST_CMDS.win = $(NO_SUCH_VARIABLE)
509 # Template for build programs.
510 # This currently does not do cross compilation, sorry.
512 TEMPLATE_BLD = Build program to be executed during the build but not installed.
513 TEMPLATE_BLD_EXTENDS = BIN
517 # Library macros.
519 LIB_KDEP = $(PATH_OBJ)/kDep/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kDep$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
520 LIB_KUTIL = $(PATH_OBJ)/kUtil/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kUtil$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)