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