VirtualBox

source: kBuild/trunk/Config.kmk@ 3576

Last change on this file since 3576 was 3572, checked in by bird, 2 years ago

Config.kmk,src/kmk/Makefile.kmk: Added temporary kludge for inconsistent quoting and escaping of DEFS properties among the compiler tools.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 18.5 KB
Line 
1# $Id: Config.kmk 3572 2022-10-24 08:36:35Z 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.
128ifn1of ($(KBUILD_TARGET), win)
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
148
149
150#
151# Check if we're building a *nix installation.
152#
153# There are a few optional overrides here for customizing the install location
154# and how it is installed:
155# MY_INST_BIN - the bin/ directory (the trailing slash is mandatory).
156# MY_INST_DATA - the share/kBuild/ directory (the trailing slash is mandatory).
157# MY_INST_DOC - the share/doc/kBuild-x.y.z/ directory (the trailing slash is mandatory).
158# MY_INST_UID - the default install UID or user name.
159# MY_INST_GID - the default install GID or group name.
160# MY_INST_MODE - the default install mode mask, ",a+x" is added for executables and files.
161# MY_INST_DATA_UID - data specialization.
162# MY_INST_DATA_GID - data specialization.
163# MY_INST_DATA_MODE - data specialization.
164# MY_INST_DOC_UID - doc specialization.
165# MY_INST_DOC_GID - doc specialization.
166# MY_INST_DOC_MODE - doc specialization.
167# MY_INST_BIN_UID - binary (executable) specialization.
168# MY_INST_BIN_GID - binary (executable) specialization.
169# MY_INST_BIN_MODE - binary (executable) specialization.
170#
171# When running kmk install, you can use PATH_INS like you use DESTDIR in other makefile
172# systems. (These things will be improved in 0.2.x btw, so will be possible to enable a
173# mode where PREFIX and DESTDIR will.)
174#
175#
176ifdef NIX_INSTALL_DIR
177 MY_INST_ROOT := $(patsubst /%,%,$(NIX_INSTALL_DIR))/
178 ifndef MY_INST_BIN
179 MY_INST_BIN := $(MY_INST_ROOT)bin/
180 endif
181 ifndef MY_INST_DATA
182 MY_INST_DATA := $(MY_INST_ROOT)share/kBuild/
183 endif
184 ifndef MY_INST_DOC
185 MY_INST_DOC := $(MY_INST_ROOT)share/doc/kBuild-$(KBUILD_VERSION)/
186 endif
187 if !defined(MY_INST_BIN_MODE) && defined(MY_INST_MODE)
188 MY_INST_BIN_MODE := $(MY_INST_MODE),a+x
189 endif
190
191DEFS += \
192 KBUILD_PATH=$(TMP_QUOTE_SLASH)"/$(patsubst %/,%,$(MY_INST_DATA))$(TMP_QUOTE_SLASH)" \
193 KBUILD_BIN_PATH=$(TMP_QUOTE_SLASH)"/$(patsubst %/,%,$(MY_INST_BIN))$(TMP_QUOTE_SLASH)"
194endif
195
196
197#
198# Templates for installing docs and make scripts.
199#
200TEMPLATE_DATA = Data installation template.
201TEMPLATE_DATA_INST = $(MY_INST_DATA)
202TEMPLATE_DATA_MODE ?= $(firstword $(MY_INST_DATA_MODE) $(MY_INST_MODE) a+r)
203TEMPLATE_DATA_UID ?= $(firstword $(MY_INST_DATA_UID) $(MY_INST_UID))
204TEMPLATE_DATA_GID ?= $(firstword $(MY_INST_DATA_GID) $(MY_INST_GID))
205
206TEMPLATE_DOC = Documentation installation template.
207TEMPLATE_DOC_INST = $(MY_INST_DOC)
208TEMPLATE_DOC_MODE ?= $(firstword $(MY_INST_DOC_MODE) $(MY_INST_MODE) a+r)
209TEMPLATE_DOC_UID ?= $(firstword $(MY_INST_DOC_UID) $(MY_INST_UID))
210TEMPLATE_DOC_GID ?= $(firstword $(MY_INST_DOC_GID) $(MY_INST_GID))
211
212
213#
214# Template for building commandline tools.
215#
216TEMPLATE_BIN = Command line binary
217
218TEMPLATE_BIN_INCS = \
219 $(PATH_ROOT)/src/lib \
220 $(PATH_ROOT)/src/lib/kStuff/include
221TEMPLATE_BIN_DEFS.profile = NDEBUG
222TEMPLATE_BIN_DEFS.release = NDEBUG
223if defined(NIX_INSTALL_DIR) && !defined(KBUILD_BOOTSTRAP)
224 TEMPLATE_BIN_INST = $(MY_INST_BIN)
225 TEMPLATE_BIN_MODE ?= $(firstword $(MY_INST_BIN_MODE) a+rx)
226 TEMPLATE_BIN_UID ?= $(firstword $(MY_INST_BIN_UID) $(MY_INST_UID))
227 TEMPLATE_BIN_GID ?= $(firstword $(MY_INST_BIN_GID) $(MY_INST_GID))
228else
229 TEMPLATE_BIN_INST = kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
230endif
231
232
233ifeq ($(KBUILD_TARGET),os2)
234 TEMPLATE_BIN_TOOL = GCC3OMF
235 TEMPLATE_BIN_CFLAGS = -g
236 TEMPLATE_BIN_CFLAGS.profile = -pg
237 TEMPLATE_BIN_CFLAGS.release = -O3
238 TEMPLATE_BIN_LDFLAGS = -Zhigh-mem -Zstack=1024 -g
239
240else if1of ($(KBUILD_TARGET), win nt)
241 ifdef KBUILD_NEW_VCC
242 TEMPLATE_BIN_TOOL = VCC142
243 TEMPLATE_BIN_TOOL.x86 = VCC142X86
244 TEMPLATE_BIN_TOOL.amd64 = VCC142AMD64
245 else
246 TEMPLATE_BIN_TOOL = VCC100
247 TEMPLATE_BIN_TOOL.x86 = VCC100X86
248 TEMPLATE_BIN_TOOL.amd64 = VCC100AMD64
249 endif
250 TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_WARNINGS
251 TEMPLATE_BIN_DEFS.x86 = WIN32 __WIN32__
252 TEMPLATE_BIN_DEFS.amd64 = WIN32 __WIN32__ __WIN64__ WIN64
253 TEMPLATE_BIN_CFLAGS = -W3 -Zi -Zl
254 TEMPLATE_BIN_CFLAGS.release = -O2
255 TEMPLATE_BIN_CFLAGS.profile = -O2 -GH -Gh
256 TEMPLATE_BIN_INCS += \
257 . \
258 $(PATH_GNUMAKE_SRC)/w32/include \
259 $(PATH_GNUMAKE_SRC)/glob
260 TEMPLATE_BIN_LDFLAGS = /SUBSYSTEM:console /INCREMENTAL:no /NOD /DEBUG /OPT:REF /OPT:ICF /LargeAddressAware
261 ifdef KBUILD_NEW_VCC
262 ifdef KBUILD_WITH_STATIC_MSVCRT
263 TEMPLATE_BIN_SDKS = WINPSDK71 WINSDK10-UCRT-STATIC
264 TEMPLATE_BIN_CFLAGS += -MT
265 TEMPLATE_BIN_LIBS = \
266 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/vcruntime.lib \
267 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
268 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \
269 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib
270 else
271 TEMPLATE_BIN_SDKS = WINPSDK71 WINSDK10-UCRT
272 TEMPLATE_BIN_CFLAGS += -MD
273 TEMPLATE_BIN_LIBS = \
274 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/vcruntime.lib \
275 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
276 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcrt.lib
277 endif
278 else ifeq ($(KBUILD_TYPE),profile)
279 TEMPLATE_BIN_SDKS = WINPSDKINCS
280 TEMPLATE_BIN_CFLAGS += -MT
281 TEMPLATE_BIN_LIBS = \
282 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2.lib \
283 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \
284 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
285 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \
286 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib \
287 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \
288 $(PATH_SDK_WINPSDKINCS_LIB)/AdvAPI32.lib \
289 $(PATH_SDK_WINPSDKINCS_LIB)/User32.lib
290 else
291 TEMPLATE_BIN_SDKS = WINPSDK71
292 ifdef KBUILD_WITH_STATIC_MSVCRT
293 TEMPLATE_BIN_CFLAGS += -MT
294 TEMPLATE_BIN_LIBS = \
295 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
296 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \
297 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib
298 else
299 TEMPLATE_BIN_CFLAGS += -MD
300 TEMPLATE_BIN_LIBS.amd64 = \
301 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/oldnames.lib \
302 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/msvcrt.lib
303 TEMPLATE_BIN_LIBS.x86 = \
304 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/oldnames.lib \
305 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/msvcrt.lib
306 endif
307 endif
308 # HACK ALERT! Using kmk_builting_redirect here to bypass some shell quoting issue.
309 ifdef KBUILD_NEW_VCC # The OLD CRT will use the codepage default to the locale rather than UTF-8, so APC and CRT ends
310 # up using different code pages when a locale other than "C" is used. Thus, only enable for new compiler.
311 TEMPLATE_BIN_POST_CMDS.win = \
312 $(QUIET)$(APPEND) -tn "$(out).manifest" \
313 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' \
314 '<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">' \
315 ' <assemblyIdentity type="win32" name="$(notdir $(out))" version="$(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR).$(KBUILD_VERSION_PATCH).$(KBUILD_SVN_REV)"/>' \
316 ' <application>' \
317 ' <windowsSettings>' \
318 ' <activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>' \
319 ' </windowsSettings>' \
320 ' </application>' \
321 '</assembly>' \
322 $(NLTAB)$(QUIET)$(REDIRECT) -- $(requote sh,$(PATH_SDK_$(firstword $(TEMPLATE_$($(target)_TEMPLATE)_SDKS))_BIN)/mt.exe) \
323 -nologo -manifest '$(subst /,\,$(out).manifest)' '-outputresource:$(subst /,\,$(out));$(HASH)1' \
324 $(NLTAB)$(QUIET)$(RM) -f -- "$(out).manifest"
325 endif
326
327else # !os2, !win, !nt
328
329 ifeq ($(KBUILD_TARGET),darwin)
330 ifndef KBUILD_MACOSX_VERSION
331 export KBUILD_MACOSX_VERSION := $(expr $(firstword $(subst ., ,$(shell uname -r))) - 4)
332 endif
333 #ifndef KBUILD_XCODE_VERSION
334 # export KBUILD_XCODE_VERSION := $(shell xcodebuild -version | kmk_sed -e '/Xcode/!d' -e 's/Xcode *//')
335 #endif
336 ifndef KBUILD_MACOSX_TARGET_VERSION
337 if $(KBUILD_TARGET_ARCH) == amd64
338 KBUILD_MACOSX_TARGET_VERSION = 6
339 else if $(KBUILD_TARGET_ARCH) == arm64
340 KBUILD_MACOSX_TARGET_VERSION := 0
341 KBUILD_MACOSX_TARGET_MAJOR_VERSION := 11
342 else
343 KBUILD_MACOSX_TARGET_VERSION = 5
344 endif
345 endif
346 ifndef KBUILD_MACOSX_TARGET_MAJOR_VERSION
347 KBUILD_MACOSX_TARGET_MAJOR_VERSION := 10
348 endif
349 ifndef KBUILD_MACOSX_WHATEVER_MODE
350 if $(KBUILD_MACOSX_TARGET_VERSION) <= 4 && $(KBUILD_MACOSX_TARGET_MAJOR_VERSION) == 10
351 TOOL_GCC4MACHO_SUFFIX = -4.0
352 TOOL_GXX4MACHO_SUFFIX = -4.0
353 else if $(KBUILD_MACOSX_TARGET_VERSION) <= 9 && $(KBUILD_MACOSX_TARGET_MAJOR_VERSION) == 10 # dunno which exactly.
354 TOOL_GCC4MACHO_SUFFIX = -4.2
355 TOOL_GXX4MACHO_SUFFIX = -4.2
356 endif
357 ifndef KBUILD_MACOSX_SDK
358 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
359 ifeq ($(wildcard $(KBUILD_MACOSX_SDK)),)
360 KBUILD_MACOSX_SDK := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform$(KBUILD_MACOSX_SDK)
361 endif
362 ifeq ($(wildcard $(KBUILD_MACOSX_SDK)),)
363 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
364 endif
365 endif
366 ifeq ($(wildcard $(KBUILD_MACOSX_SDK)),)
367 $(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.)
368 endif
369 endif # !KBUILD_MACOSX_WHATEVER_MODE
370 TEMPLATE_BIN_TOOL = GCC4MACHO
371 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))
372 ifeq ($(USER),bird)
373 TEMPLATE_BIN_CFLAGS += -Wall $(GCC_Wextra) -pedantic -Wno-unused-parameter -Wno-long-long -Wshadow
374 TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS
375 endif
376 TEMPLATE_BIN_CFLAGS.profile = -O3 -pg
377 TEMPLATE_BIN_CFLAGS.release = -O3
378 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))
379 if $(KBUILD_MACOSX_TARGET_VERSION) == 4 && $(KBUILD_MACOSX_VERSION) >= 5 && $(KBUILD_MACOSX_TARGET_MAJOR_VERSION) == 10
380 TEMPLATE_BIN_LDFLAGS += -classic_ld
381 endif
382 TEMPLATE_BIN_LDFLAGS.profile = -pg
383
384 else # !darwin
385 # Use GCC3 when we're certain that the system is using GNU ld and ar.
386 ifeq ($(filter-out linux freebsd openbsd netbsd,$(KBUILD_TARGET)),)
387 TEMPLATE_BIN_TOOL = GCC3
388 else
389 TEMPLATE_BIN_TOOL = GCC3PLAIN
390 endif
391 TEMPLATE_BIN_CFLAGS = -g
392 ifeq ($(USER),bird)
393 TEMPLATE_BIN_CFLAGS += -Wall $(GCC_Wextra) -pedantic -Wno-unused-parameter -Wshadow
394 TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS
395 endif
396 TEMPLATE_BIN_LDFLAGS = -g
397 TEMPLATE_BIN_LDFLAGS.profile = -pg -p
398 TEMPLATE_BIN_CFLAGS.release = -O3
399 TEMPLATE_BIN_CFLAGS.profile = -O3 -pg -p
400 ifeq ($(KBUILD_TARGET),freebsd)
401 TEMPLATE_BIN_INCS += $(PATH_GNUMAKE_SRC)/glob /usr/local/include
402 endif
403 ifeq ($(KBUILD_TARGET),linux)
404 TEMPLATE_BIN_LIBS += rt
405 endif
406 endif
407
408 # Make sure we get the right bit count in the output.
409 TEMPLATE_BIN_CFLAGS.x86 += -m32
410 TEMPLATE_BIN_CFLAGS.x32 += -mx32
411 TEMPLATE_BIN_CFLAGS.sparc32 += -m32
412 TEMPLATE_BIN_CFLAGS.amd64 += -m64
413 TEMPLATE_BIN_CFLAGS.sparc64 += -m64
414 TEMPLATE_BIN_CXXFLAGS.x86 += -m32
415 TEMPLATE_BIN_CXXFLAGS.x32 += -mx32
416 TEMPLATE_BIN_CXXFLAGS.sparc32 += -m32
417 TEMPLATE_BIN_CXXFLAGS.amd64 += -m64
418 TEMPLATE_BIN_CXXFLAGS.sparc64 += -m64
419 TEMPLATE_BIN_LDFLAGS.x86 += -m32
420 TEMPLATE_BIN_LDFLAGS.x32 += -mx32
421 TEMPLATE_BIN_LDFLAGS.sparc32 += -m32
422 TEMPLATE_BIN_LDFLAGS.amd64 += -m64
423 TEMPLATE_BIN_LDFLAGS.sparc64 += -m64
424 ifeq ($(KBUILD_TARGET),solaris)
425 TEMPLATE_BIN_LIBS += rt dl
426 TEMPLATE_BIN_LDFLAGS += -Wl,-i
427 TEMPLATE_BIN_DEFS.x86 += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE
428 TEMPLATE_BIN_DEFS.sparc32 += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE
429 endif
430 ifeq ($(KBUILD_TARGET),netbsd)
431 TEMPLATE_BIN_LIBS += util
432 endif
433endif
434
435# On systems where it's possible, do split out the debug info from the binaries.
436if1of ($(KBUILD_TARGET), darwin win)
437 TEMPLATE_BIN_LD_DEBUG = split
438endif
439
440#
441# Template for building threaded binaries.
442#
443TEMPLATE_BIN-THREADED = Threaded command line binary
444TEMPLATE_BIN-THREADED_EXTENDS = BIN
445TEMPLATE_BIN-THREADED_EXTENDS_BY = appending
446if1of ($(KBUILD_TARGET), dragonfly freebsd gnuhurd gnukfbsd gnuknbsd linux netbsd openbsd)
447 TEMPLATE_BIN-THREADED_LIBS = pthread
448endif
449
450#
451# Template for building libraries for the tools.
452#
453TEMPLATE_LIB = Library for Commandline binary
454TEMPLATE_LIB_EXTENDS = BIN
455TEMPLATE_LIB_INST = lib/
456# for LIB_KDEP
457TEMPLATE_LIB_TOOL = $(TEMPLATE_BIN_TOOL)
458TEMPLATE_LIB_CLEAN.win = $(NO_SUCH_VARIABLE)
459TEMPLATE_LIB_LNK_DEPS.win = $(NO_SUCH_VARIABLE)
460TEMPLATE_LIB_POST_CMDS.win = $(NO_SUCH_VARIABLE)
461
462#
463# Template for static threaded binaries (windows).
464#
465TEMPLATE_BIN-STATIC-THREADED = Threaded command line binary
466TEMPLATE_BIN-STATIC-THREADED_EXTENDS = BIN-THREADED
467ifeq ($(filter-out win nt,$(KBUILD_TARGET)),)
468 TEMPLATE_BIN-STATIC-THREADED_CFLAGS = $(filter-out -MD,$(TEMPLATE_BIN-THREADED_CFLAGS)) -MT
469 TEMPLATE_BIN-STATIC-THREADED_LIBS.amd64 = $(filter-out %/msvcrt.lib,$(TEMPLATE_BIN-THREADED_LIBS.amd64)) \
470 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/libcmt.lib \
471 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/libcpmt.lib
472 TEMPLATE_BIN-STATIC-THREADED_LIBS.x86 = $(filter-out %/msvcrt.lib,$(TEMPLATE_BIN-THREADED_LIBS.x86)) \
473 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/libcmt.lib \
474 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/libcpmt.lib
475else
476 TEMPLATE_BIN-STATIC-THREADED_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) -static
477 TEMPLATE_BIN-STATIC-THREADED_LDFLAGS = $(TEMPLATE_BIN-THREADED_LDFLAGS) -static
478endif
479
480#
481# Template for static threaded libraries.
482#
483TEMPLATE_LIB-STATIC-THREADED = Threaded command line library
484TEMPLATE_LIB-STATIC-THREADED_EXTENDS = BIN-STATIC-THREADED
485TEMPLATE_LIB-STATIC-THREADED_INST = lib/
486TEMPLATE_LIB-STATIC-THREADED_POST_CMDS.win = $(NO_SUCH_VARIABLE)
487
488#
489# Template for build programs.
490# This currently does not do cross compilation, sorry.
491#
492TEMPLATE_BLD = Build program to be executed during the build but not installed.
493TEMPLATE_BLD_EXTENDS = BIN
494
495
496#
497# Library macros.
498#
499LIB_KDEP = $(PATH_OBJ)/kDep/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kDep$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
500LIB_KUTIL = $(PATH_OBJ)/kUtil/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kUtil$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
501
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