VirtualBox

source: kBuild/trunk/Config.kmk@ 3655

Last change on this file since 3655 was 3648, checked in by bird, 4 weeks ago

Config.kmk: Enabled the -Gy VCC compiler option to slighly reduce executable sizes. Treat anything missing a proptype as errors with VCC.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.6 KB
Line 
1# $Id: Config.kmk 3648 2024-11-03 02:35:01Z bird $
2## @file
3# Build Configuration.
4#
5
6#
7# Copyright (c) 2005-2012 knut st. osmundsen <[email protected]>
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 3 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, see <http://www.gnu.org/licenses/>
23#
24#
25
26# Enable automatic installation of what's built.
27KBUILD_DO_AUTO_INSTALL := 1
28
29
30#
31# The kBuild version.
32#
33KBUILD_VERSION_MAJOR = 0
34KBUILD_VERSION_MINOR = 1
35KBUILD_VERSION_PATCH = 9998
36KBUILD_VERSION = 0.1.9998
37DEFS += \
38 KBUILD_VERSION_MAJOR=$(KBUILD_VERSION_MAJOR) \
39 KBUILD_VERSION_MINOR=$(KBUILD_VERSION_MINOR) \
40 KBUILD_VERSION_PATCH=$(KBUILD_VERSION_PATCH)
41
42#
43# Get the svn version.
44# This is shipped with the tarballs in a SvnInfo.kmk in the root.
45#
46ifneq ($(wildcard $(PATH_ROOT)/SvnInfo.kmk),)
47# Shipped
48KBUILD_SVN_INFO_KMK := $(PATH_ROOT)/SvnInfo.kmk
49KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK)
50
51else ifneq ($(wildcard $(PATH_ROOT)/.svn/ $(PATH_ROOT)/../.svn/),)
52# Generate from svn info
53KBUILD_SVN_INFO_KMK := $(PATH_OBJ)/SvnInfo.kmk
54KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK)
55KBUILD_SVN_TOOL := svn
56
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 $@ [email protected]
69 @$(MKDIR) -p $(@D)
70 @$(REDIRECT) -o [email protected] -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 [email protected]
77 @$(RM) -f [email protected]
78 @$(CP) --changed -fv $@ $(KBUILD_SVN_INFO_KMK)
79
80 ifeq ($(DEPTH),.)
81OTHER_CLEAN += $(KBUILD_SVN_INFO_KMK) $(PATH_OBJ)/SvnInfo.ts
82 endif
83
84else
85# Some incomplete source export...
86KBUILD_SVN_INFO_KMK := $(PATH_OBJ)/SvnInfo.kmk
87KBUILD_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'
94
95 ifeq ($(DEPTH),.)
96OTHER_CLEAN += $(KBUILD_SVN_INFO_KMK)
97 endif
98
99endif
100include $(KBUILD_SVN_INFO_KMK)
101
102
103#
104# Local config, optional.
105#
106ifneq ($(wildcard $(PATH_ROOT)/LocalConfig.kmk),)
107 include $(PATH_ROOT)/LocalConfig.kmk
108endif
109
110
111#
112# Where to fine the GNU Make stuff (for FreeBSD and Windows).
113#
114PATH_GNUMAKE_SRC ?= $(PATH_ROOT)/src/kmk
115
116
117#
118# Various platform specific hacks.
119#
120ifn1of ($(KBUILD_TARGET), haiku openbsd)
121 GCC_Wextra = -Wextra
122endif
123if1of ($(KBUILD_TARGET), openbsd)
124 TOOL_FLEX_LEX = gflex
125endif
126# Not all compiler tools currently do the same quoting of DEFS, so here's a
127# temporary workaround.
128if "$(KBUILD_TARGET)" != "win" || defined(KBUILD_NEW_VCC)
129 TMP_QUOTE_SLASH :=
130else
131 TMP_QUOTE_SLASH := \$(NO_SUCH_VARIABLE)
132endif
133
134#
135# The OS and Architecture indicators.
136#
137DEFS.darwin += KBUILD_OS_DARWIN
138DEFS.freebsd += KBUILD_OS_FREEBSD
139DEFS.linux += KBUILD_OS_LINUX
140DEFS.netbsd += KBUILD_OS_NETBSD
141DEFS.openbsd += KBUILD_OS_OPENBSD
142DEFS.os2 += KBUILD_OS_OS2
143DEFS.solaris += KBUILD_OS_SOLARIS
144DEFS.win += KBUILD_OS_WINDOWS
145
146DEFS.x86 += KBUILD_ARCH_X86
147DEFS.amd64 += KBUILD_ARCH_AMD64
148DEFS.arm64 += KBUILD_ARCH_ARM64
149
150
151#
152# Check if we're building a *nix installation.
153#
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.
171#
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.)
175#
176#
177ifdef 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
191
192DEFS += \
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)"
195endif
196
197
198#
199# Templates for installing docs and make scripts.
200#
201TEMPLATE_DATA = Data installation template.
202TEMPLATE_DATA_INST = $(MY_INST_DATA)
203TEMPLATE_DATA_MODE ?= $(firstword $(MY_INST_DATA_MODE) $(MY_INST_MODE) a+r)
204TEMPLATE_DATA_UID ?= $(firstword $(MY_INST_DATA_UID) $(MY_INST_UID))
205TEMPLATE_DATA_GID ?= $(firstword $(MY_INST_DATA_GID) $(MY_INST_GID))
206
207TEMPLATE_DOC = Documentation installation template.
208TEMPLATE_DOC_INST = $(MY_INST_DOC)
209TEMPLATE_DOC_MODE ?= $(firstword $(MY_INST_DOC_MODE) $(MY_INST_MODE) a+r)
210TEMPLATE_DOC_UID ?= $(firstword $(MY_INST_DOC_UID) $(MY_INST_UID))
211TEMPLATE_DOC_GID ?= $(firstword $(MY_INST_DOC_GID) $(MY_INST_GID))
212
213
214#
215# Template for building commandline tools.
216#
217TEMPLATE_BIN = Command line binary
218
219TEMPLATE_BIN_INCS = \
220 $(PATH_ROOT)/src/lib \
221 $(PATH_ROOT)/src/lib/kStuff/include
222TEMPLATE_BIN_DEFS.profile = NDEBUG
223TEMPLATE_BIN_DEFS.release = NDEBUG
224if 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))
229else
230 TEMPLATE_BIN_INST = kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
231endif
232
233
234ifeq ($(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
240
241else 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 += \
259 . \
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
346
347else # !os2, !win, !nt
348
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
403
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
427
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
453endif
454
455# On systems where it's possible, do split out the debug info from the binaries.
456if1of ($(KBUILD_TARGET), darwin win)
457 TEMPLATE_BIN_LD_DEBUG = split
458endif
459
460#
461# Template for building threaded binaries.
462#
463TEMPLATE_BIN-THREADED = Threaded command line binary
464TEMPLATE_BIN-THREADED_EXTENDS = BIN
465TEMPLATE_BIN-THREADED_EXTENDS_BY = appending
466if1of ($(KBUILD_TARGET), dragonfly freebsd gnuhurd gnukfbsd gnuknbsd linux netbsd openbsd)
467 TEMPLATE_BIN-THREADED_LIBS = pthread
468endif
469
470#
471# Template for building libraries for the tools.
472#
473TEMPLATE_LIB = Library for Commandline binary
474TEMPLATE_LIB_EXTENDS = BIN
475TEMPLATE_LIB_INST = lib/
476# for LIB_KDEP
477TEMPLATE_LIB_TOOL = $(TEMPLATE_BIN_TOOL)
478TEMPLATE_LIB_CLEAN.win = $(NO_SUCH_VARIABLE)
479TEMPLATE_LIB_LNK_DEPS.win = $(NO_SUCH_VARIABLE)
480TEMPLATE_LIB_POST_CMDS.win = $(NO_SUCH_VARIABLE)
481
482#
483# Template for static threaded binaries (windows).
484#
485TEMPLATE_BIN-STATIC-THREADED = Threaded command line binary
486TEMPLATE_BIN-STATIC-THREADED_EXTENDS = BIN-THREADED
487ifeq ($(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
495else
496 TEMPLATE_BIN-STATIC-THREADED_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) -static
497 TEMPLATE_BIN-STATIC-THREADED_LDFLAGS = $(TEMPLATE_BIN-THREADED_LDFLAGS) -static
498endif
499
500#
501# Template for static threaded libraries.
502#
503TEMPLATE_LIB-STATIC-THREADED = Threaded command line library
504TEMPLATE_LIB-STATIC-THREADED_EXTENDS = BIN-STATIC-THREADED
505TEMPLATE_LIB-STATIC-THREADED_INST = lib/
506TEMPLATE_LIB-STATIC-THREADED_POST_CMDS.win = $(NO_SUCH_VARIABLE)
507
508#
509# Template for build programs.
510# This currently does not do cross compilation, sorry.
511#
512TEMPLATE_BLD = Build program to be executed during the build but not installed.
513TEMPLATE_BLD_EXTENDS = BIN
514
515
516#
517# Library macros.
518#
519LIB_KDEP = $(PATH_OBJ)/kDep/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kDep$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
520LIB_KUTIL = $(PATH_OBJ)/kUtil/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kUtil$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
521
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette