VirtualBox

source: kBuild/trunk/Config.kmk@ 3637

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

Config.kmk,Makefile.kmk,src/misc/Makefile.kmk: Build adjustments for KBUILD_NEW_VCC (VC++ 2022).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 18.8 KB
Line 
1# $Id: Config.kmk 3637 2024-11-02 01:54: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
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_LIBS = \
268 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.$(KBUILD_TARGET_ARCH))_LIB)/vcruntime.lib \
269 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.$(KBUILD_TARGET_ARCH))_LIB)/oldnames.lib \
270 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.$(KBUILD_TARGET_ARCH))_LIB)/libcmt.lib \
271 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.$(KBUILD_TARGET_ARCH))_LIB)/libcpmt.lib
272 else
273 TEMPLATE_BIN_SDKS = WINSDK10-UM WINSDK10-UCRT
274 TEMPLATE_BIN_CFLAGS += -MD
275 TEMPLATE_BIN_LIBS = \
276 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.$(KBUILD_TARGET_ARCH))_LIB)/vcruntime.lib \
277 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.$(KBUILD_TARGET_ARCH))_LIB)/oldnames.lib \
278 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.$(KBUILD_TARGET_ARCH))_LIB)/msvcrt.lib
279 endif
280 else ifeq ($(KBUILD_TYPE),profile)
281 TEMPLATE_BIN_SDKS = WINPSDKINCS
282 TEMPLATE_BIN_CFLAGS += -MT
283 TEMPLATE_BIN_LIBS = \
284 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2.lib \
285 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \
286 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
287 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \
288 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib \
289 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \
290 $(PATH_SDK_WINPSDKINCS_LIB)/AdvAPI32.lib \
291 $(PATH_SDK_WINPSDKINCS_LIB)/User32.lib
292 else
293 TEMPLATE_BIN_SDKS = WINPSDK71
294 ifdef KBUILD_WITH_STATIC_MSVCRT
295 TEMPLATE_BIN_CFLAGS += -MT
296 TEMPLATE_BIN_LIBS = \
297 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
298 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \
299 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib
300 else
301 TEMPLATE_BIN_CFLAGS += -MD
302 TEMPLATE_BIN_LIBS.amd64 = \
303 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/oldnames.lib \
304 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/msvcrt.lib
305 TEMPLATE_BIN_LIBS.x86 = \
306 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/oldnames.lib \
307 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/msvcrt.lib
308 endif
309 endif
310 # HACK ALERT! Using kmk_builting_redirect here to bypass some shell quoting issue.
311 ifdef KBUILD_NEW_VCC # The OLD CRT will use the codepage default to the locale rather than UTF-8, so APC and CRT ends
312 # up using different code pages when a locale other than "C" is used. Thus, only enable for new compiler.
313 TEMPLATE_BIN_POST_CMDS.win = \
314 $(QUIET)$(APPEND) -tn "$(out).manifest" \
315 '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' \
316 '<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">' \
317 ' <assemblyIdentity type="win32" name="$(notdir $(out))" version="$(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR).$(KBUILD_VERSION_PATCH).$(KBUILD_SVN_REV)"/>' \
318 ' <application>' \
319 ' <windowsSettings>' \
320 ' <activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>' \
321 ' </windowsSettings>' \
322 ' </application>' \
323 '</assembly>' \
324 $(NLTAB)$(QUIET)$(REDIRECT) -- $(requote sh,$(PATH_SDK_$(firstword $(TEMPLATE_$($(target)_TEMPLATE)_SDKS))_BIN)/mt.exe) \
325 -nologo -manifest '$(subst /,\,$(out).manifest)' '-outputresource:$(subst /,\,$(out));$(HASH)1' \
326 $(NLTAB)$(QUIET)$(RM) -f -- "$(out).manifest"
327 endif
328
329else # !os2, !win, !nt
330
331 ifeq ($(KBUILD_TARGET),darwin)
332 ifndef KBUILD_MACOSX_VERSION
333 export KBUILD_MACOSX_VERSION := $(expr $(firstword $(subst ., ,$(shell uname -r))) - 4)
334 endif
335 #ifndef KBUILD_XCODE_VERSION
336 # export KBUILD_XCODE_VERSION := $(shell xcodebuild -version | kmk_sed -e '/Xcode/!d' -e 's/Xcode *//')
337 #endif
338 ifndef KBUILD_MACOSX_TARGET_VERSION
339 if $(KBUILD_TARGET_ARCH) == amd64
340 KBUILD_MACOSX_TARGET_VERSION = 6
341 else if $(KBUILD_TARGET_ARCH) == arm64
342 KBUILD_MACOSX_TARGET_VERSION := 0
343 KBUILD_MACOSX_TARGET_MAJOR_VERSION := 11
344 else
345 KBUILD_MACOSX_TARGET_VERSION = 5
346 endif
347 endif
348 ifndef KBUILD_MACOSX_TARGET_MAJOR_VERSION
349 KBUILD_MACOSX_TARGET_MAJOR_VERSION := 10
350 endif
351 ifndef KBUILD_MACOSX_WHATEVER_MODE
352 if $(KBUILD_MACOSX_TARGET_VERSION) <= 4 && $(KBUILD_MACOSX_TARGET_MAJOR_VERSION) == 10
353 TOOL_GCC4MACHO_SUFFIX = -4.0
354 TOOL_GXX4MACHO_SUFFIX = -4.0
355 else if $(KBUILD_MACOSX_TARGET_VERSION) <= 9 && $(KBUILD_MACOSX_TARGET_MAJOR_VERSION) == 10 # dunno which exactly.
356 TOOL_GCC4MACHO_SUFFIX = -4.2
357 TOOL_GXX4MACHO_SUFFIX = -4.2
358 endif
359 ifndef KBUILD_MACOSX_SDK
360 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
361 ifeq ($(wildcard $(KBUILD_MACOSX_SDK)),)
362 KBUILD_MACOSX_SDK := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform$(KBUILD_MACOSX_SDK)
363 endif
364 ifeq ($(wildcard $(KBUILD_MACOSX_SDK)),)
365 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
366 endif
367 endif
368 ifeq ($(wildcard $(KBUILD_MACOSX_SDK)),)
369 $(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.)
370 endif
371 endif # !KBUILD_MACOSX_WHATEVER_MODE
372 TEMPLATE_BIN_TOOL = GCC4MACHO
373 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))
374 ifeq ($(USER),bird)
375 TEMPLATE_BIN_CFLAGS += -Wall $(GCC_Wextra) -pedantic -Wno-unused-parameter -Wno-long-long -Wshadow
376 TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS
377 endif
378 TEMPLATE_BIN_CFLAGS.profile = -O3 -pg
379 TEMPLATE_BIN_CFLAGS.release = -O3
380 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))
381 if $(KBUILD_MACOSX_TARGET_VERSION) == 4 && $(KBUILD_MACOSX_VERSION) >= 5 && $(KBUILD_MACOSX_TARGET_MAJOR_VERSION) == 10
382 TEMPLATE_BIN_LDFLAGS += -classic_ld
383 endif
384 TEMPLATE_BIN_LDFLAGS.profile = -pg
385
386 else # !darwin
387 # Use GCC3 when we're certain that the system is using GNU ld and ar.
388 ifeq ($(filter-out linux freebsd openbsd netbsd,$(KBUILD_TARGET)),)
389 TEMPLATE_BIN_TOOL = GCC3
390 else
391 TEMPLATE_BIN_TOOL = GCC3PLAIN
392 endif
393 TEMPLATE_BIN_CFLAGS = -g
394 ifeq ($(USER),bird)
395 TEMPLATE_BIN_CFLAGS += -Wall $(GCC_Wextra) -pedantic -Wno-unused-parameter -Wshadow
396 TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS
397 endif
398 TEMPLATE_BIN_LDFLAGS = -g
399 TEMPLATE_BIN_LDFLAGS.profile = -pg -p
400 TEMPLATE_BIN_CFLAGS.release = -O3
401 TEMPLATE_BIN_CFLAGS.profile = -O3 -pg -p
402 ifeq ($(KBUILD_TARGET),freebsd)
403 TEMPLATE_BIN_INCS += $(PATH_GNUMAKE_SRC)/glob /usr/local/include
404 endif
405 ifeq ($(KBUILD_TARGET),linux)
406 TEMPLATE_BIN_LIBS += rt
407 endif
408 endif
409
410 # Make sure we get the right bit count in the output.
411 TEMPLATE_BIN_CFLAGS.x86 += -m32
412 TEMPLATE_BIN_CFLAGS.x32 += -mx32
413 TEMPLATE_BIN_CFLAGS.sparc32 += -m32
414 TEMPLATE_BIN_CFLAGS.amd64 += -m64
415 TEMPLATE_BIN_CFLAGS.sparc64 += -m64
416 TEMPLATE_BIN_CXXFLAGS.x86 += -m32
417 TEMPLATE_BIN_CXXFLAGS.x32 += -mx32
418 TEMPLATE_BIN_CXXFLAGS.sparc32 += -m32
419 TEMPLATE_BIN_CXXFLAGS.amd64 += -m64
420 TEMPLATE_BIN_CXXFLAGS.sparc64 += -m64
421 TEMPLATE_BIN_LDFLAGS.x86 += -m32
422 TEMPLATE_BIN_LDFLAGS.x32 += -mx32
423 TEMPLATE_BIN_LDFLAGS.sparc32 += -m32
424 TEMPLATE_BIN_LDFLAGS.amd64 += -m64
425 TEMPLATE_BIN_LDFLAGS.sparc64 += -m64
426 ifeq ($(KBUILD_TARGET),solaris)
427 TEMPLATE_BIN_LIBS += rt dl
428 TEMPLATE_BIN_LDFLAGS += -Wl,-i
429 TEMPLATE_BIN_DEFS.x86 += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE
430 TEMPLATE_BIN_DEFS.sparc32 += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE
431 endif
432 ifeq ($(KBUILD_TARGET),netbsd)
433 TEMPLATE_BIN_LIBS += util
434 endif
435endif
436
437# On systems where it's possible, do split out the debug info from the binaries.
438if1of ($(KBUILD_TARGET), darwin win)
439 TEMPLATE_BIN_LD_DEBUG = split
440endif
441
442#
443# Template for building threaded binaries.
444#
445TEMPLATE_BIN-THREADED = Threaded command line binary
446TEMPLATE_BIN-THREADED_EXTENDS = BIN
447TEMPLATE_BIN-THREADED_EXTENDS_BY = appending
448if1of ($(KBUILD_TARGET), dragonfly freebsd gnuhurd gnukfbsd gnuknbsd linux netbsd openbsd)
449 TEMPLATE_BIN-THREADED_LIBS = pthread
450endif
451
452#
453# Template for building libraries for the tools.
454#
455TEMPLATE_LIB = Library for Commandline binary
456TEMPLATE_LIB_EXTENDS = BIN
457TEMPLATE_LIB_INST = lib/
458# for LIB_KDEP
459TEMPLATE_LIB_TOOL = $(TEMPLATE_BIN_TOOL)
460TEMPLATE_LIB_CLEAN.win = $(NO_SUCH_VARIABLE)
461TEMPLATE_LIB_LNK_DEPS.win = $(NO_SUCH_VARIABLE)
462TEMPLATE_LIB_POST_CMDS.win = $(NO_SUCH_VARIABLE)
463
464#
465# Template for static threaded binaries (windows).
466#
467TEMPLATE_BIN-STATIC-THREADED = Threaded command line binary
468TEMPLATE_BIN-STATIC-THREADED_EXTENDS = BIN-THREADED
469ifeq ($(filter-out win nt,$(KBUILD_TARGET)),)
470 TEMPLATE_BIN-STATIC-THREADED_CFLAGS = $(filter-out -MD,$(TEMPLATE_BIN-THREADED_CFLAGS)) -MT
471 TEMPLATE_BIN-STATIC-THREADED_LIBS.amd64 = $(filter-out %/msvcrt.lib,$(TEMPLATE_BIN-THREADED_LIBS.amd64)) \
472 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/libcmt.lib \
473 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.amd64)_LIB)/libcpmt.lib
474 TEMPLATE_BIN-STATIC-THREADED_LIBS.x86 = $(filter-out %/msvcrt.lib,$(TEMPLATE_BIN-THREADED_LIBS.x86)) \
475 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/libcmt.lib \
476 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL.x86)_LIB)/libcpmt.lib
477else
478 TEMPLATE_BIN-STATIC-THREADED_CFLAGS = $(TEMPLATE_BIN-THREADED_CFLAGS) -static
479 TEMPLATE_BIN-STATIC-THREADED_LDFLAGS = $(TEMPLATE_BIN-THREADED_LDFLAGS) -static
480endif
481
482#
483# Template for static threaded libraries.
484#
485TEMPLATE_LIB-STATIC-THREADED = Threaded command line library
486TEMPLATE_LIB-STATIC-THREADED_EXTENDS = BIN-STATIC-THREADED
487TEMPLATE_LIB-STATIC-THREADED_INST = lib/
488TEMPLATE_LIB-STATIC-THREADED_POST_CMDS.win = $(NO_SUCH_VARIABLE)
489
490#
491# Template for build programs.
492# This currently does not do cross compilation, sorry.
493#
494TEMPLATE_BLD = Build program to be executed during the build but not installed.
495TEMPLATE_BLD_EXTENDS = BIN
496
497
498#
499# Library macros.
500#
501LIB_KDEP = $(PATH_OBJ)/kDep/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kDep$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
502LIB_KUTIL = $(PATH_OBJ)/kUtil/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kUtil$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
503
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