VirtualBox

source: kBuild/trunk/Config.kmk@ 3600

Last change on this file since 3600 was 3600, checked in by bird, 14 months ago

Some linux.arm64 adjustments.

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