VirtualBox

source: kBuild/trunk/Config.kmk@ 2421

Last change on this file since 2421 was 2421, checked in by bird, 14 years ago

OpenBSD hacks.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.9 KB
Line 
1# $Id: Config.kmk 2421 2010-10-17 21:27:53Z bird $
2## @file
3# Build Configuration.
4#
5
6#
7# Copyright (c) 2005-2010 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 = 98
36KBUILD_VERSION = 0.1.98
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/entries),)
52# Generate from svn info
53KBUILD_SVN_INFO_KMK := $(PATH_OBJ)/SvnInfo.kmk
54KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK)
55
56$(PATH_OBJ)/SvnInfo.ts +| $(KBUILD_SVN_INFO_KMK): $(wildcard $(PATH_ROOT)/.svn $(PATH_ROOT)/.svn/entries $(PATH_ROOT)/.svn/all-wcprops $(PATH_ROOT)/.svn/format $(PATH_ROOT)/.svn/props $(PATH_ROOT)/.svn/prop-base )
57 $(call MSG_GENERATE,,$(KBUILD_SVN_INFO_KMK))
58 @$(RM) -f $@ [email protected]
59 @$(MKDIR) -p $(@D)
60 @$(REDIRECT) -o [email protected] -E 'LC_ALL=C' -- svn info $(DEPTH)
61 @$(SED) \
62 -e 's/URL: */KBUILD_SVN_URL := /' \
63 -e 's/Revision: */KBUILD_SVN_REV := /' \
64 -e '/KBUILD_SVN_/!d' \
65 --append $@ \
66 [email protected]
67 @$(RM) -f [email protected]
68 @$(CP) --changed -fv $@ $(KBUILD_SVN_INFO_KMK)
69
70 ifeq ($(DEPTH),.)
71OTHER_CLEAN += $(KBUILD_SVN_INFO_KMK) $(PATH_OBJ)/SvnInfo.ts
72 endif
73
74else
75# Some incomplete source export...
76KBUILD_SVN_INFO_KMK := $(PATH_OBJ)/SvnInfo.kmk
77KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK)
78$(warning Neither SvnInfo nor .svn/* was found in the root. Will have to cook up something too keep the build happy.)
79$(KBUILD_SVN_INFO_KMK):
80 $(RM) -f $@
81 $(MKDIR) -p $(@D)
82 $(APPEND) $@ 'KBUILD_SVN_REV := 0'
83 $(APPEND) $@ 'KBUILD_SVN_URL := /dev/null'
84
85 ifeq ($(DEPTH),.)
86OTHER_CLEAN += $(KBUILD_SVN_INFO_KMK)
87 endif
88
89endif
90include $(KBUILD_SVN_INFO_KMK)
91
92
93#
94# Where to fine the GNU Make stuff (for FreeBSD and Windows).
95#
96PATH_GNUMAKE_SRC ?= $(PATH_ROOT)/src/kmk
97
98
99#
100# Various platform specific hacks.
101#
102ifn1of ($(KBUILD_TARGET), openbsd)
103 GCC_Wextra = -Wextra
104endif
105if1of ($(KBUILD_TARGET), openbsd)
106 TOOL_FLEX_LEX = gflex
107endif
108
109#
110# The OS and Architecture indicators.
111#
112DEFS.darwin += KBUILD_OS_DARWIN
113DEFS.freebsd += KBUILD_OS_FREEBSD
114DEFS.linux += KBUILD_OS_LINUX
115DEFS.netbsd += KBUILD_OS_NETBSD
116DEFS.openbsd += KBUILD_OS_OPENBSD
117DEFS.os2 += KBUILD_OS_OS2
118DEFS.solaris += KBUILD_OS_SOLARIS
119DEFS.win += KBUILD_OS_WINDOWS
120
121DEFS.x86 += KBUILD_ARCH_X86
122DEFS.amd64 += KBUILD_ARCH_AMD64
123
124
125#
126# Check if we're building a *nix installation.
127#
128# There are a few optional overrides here for customizing the install location
129# and how it is installed:
130# MY_INST_BIN - the bin/ directory (the trailing slash is mandatory).
131# MY_INST_DATA - the share/kBuild/ directory (the trailing slash is mandatory).
132# MY_INST_DOC - the share/doc/kBuild-x.y.z/ directory (the trailing slash is mandatory).
133# MY_INST_UID - the default install UID or user name.
134# MY_INST_GID - the default install GID or group name.
135# MY_INST_MODE - the default install mode mask, ",a+x" is added for executables and files.
136# MY_INST_DATA_UID - data specialization.
137# MY_INST_DATA_GID - data specialization.
138# MY_INST_DATA_MODE - data specialization.
139# MY_INST_DOC_UID - doc specialization.
140# MY_INST_DOC_GID - doc specialization.
141# MY_INST_DOC_MODE - doc specialization.
142# MY_INST_BIN_UID - binary (executable) specialization.
143# MY_INST_BIN_GID - binary (executable) specialization.
144# MY_INST_BIN_MODE - binary (executable) specialization.
145#
146# When running kmk install, you can use PATH_INS like you use DESTDIR in other makefile
147# systems. (These things will be improved in 0.2.x btw, so will be possible to enable a
148# mode where PREFIX and DESTDIR will.)
149#
150#
151ifdef NIX_INSTALL_DIR
152 MY_INST_ROOT := $(patsubst /%,%,$(NIX_INSTALL_DIR))/
153 ifndef MY_INST_BIN
154 MY_INST_BIN := $(MY_INST_ROOT)bin/
155 endif
156 ifndef MY_INST_DATA
157 MY_INST_DATA := $(MY_INST_ROOT)share/kBuild/
158 endif
159 ifndef MY_INST_DOC
160 MY_INST_DOC := $(MY_INST_ROOT)share/doc/kBuild-$(KBUILD_VERSION)/
161 endif
162 if !defined(MY_INST_BIN_MODE) && defined(MY_INST_MODE)
163 MY_INST_BIN_MODE := $(MY_INST_MODE),a+x
164 endif
165
166DEFS += \
167 KBUILD_PATH=\"/$(patsubst %/,%,$(MY_INST_DATA))\" \
168 KBUILD_BIN_PATH=\"/$(patsubst %/,%,$(MY_INST_BIN))\"
169endif
170
171
172#
173# Templates for installing docs and make scripts.
174#
175TEMPLATE_DATA = Data installation template.
176TEMPLATE_DATA_INST = $(MY_INST_DATA)
177TEMPLATE_DATA_MODE ?= $(firstword $(MY_INST_DATA_MODE) $(MY_INST_MODE) a+r)
178TEMPLATE_DATA_UID ?= $(firstword $(MY_INST_DATA_UID) $(MY_INST_UID))
179TEMPLATE_DATA_GID ?= $(firstword $(MY_INST_DATA_GID) $(MY_INST_GID))
180
181TEMPLATE_DOC = Documentation installation template.
182TEMPLATE_DOC_INST = $(MY_INST_DOC)
183TEMPLATE_DOC_MODE ?= $(firstword $(MY_INST_DOC_MODE) $(MY_INST_MODE) a+r)
184TEMPLATE_DOC_UID ?= $(firstword $(MY_INST_DOC_UID) $(MY_INST_UID))
185TEMPLATE_DOC_GID ?= $(firstword $(MY_INST_DOC_GID) $(MY_INST_GID))
186
187
188#
189# Template for building commandline tools.
190#
191TEMPLATE_BIN = Command line binary
192
193TEMPLATE_BIN_INCS = $(PATH_ROOT)/src/lib
194TEMPLATE_BIN_DEFS.profile = NDEBUG
195TEMPLATE_BIN_DEFS.release = NDEBUG
196if defined(NIX_INSTALL_DIR) && !defined(KBUILD_BOOTSTRAP)
197 TEMPLATE_BIN_INST = $(MY_INST_BIN)
198 TEMPLATE_BIN_MODE ?= $(firstword $(MY_INST_BIN_MODE) a+rx)
199 TEMPLATE_BIN_UID ?= $(firstword $(MY_INST_BIN_UID) $(MY_INST_UID))
200 TEMPLATE_BIN_GID ?= $(firstword $(MY_INST_BIN_GID) $(MY_INST_GID))
201else
202 TEMPLATE_BIN_INST = kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
203endif
204
205
206ifeq ($(KBUILD_TARGET),os2)
207TEMPLATE_BIN_TOOL = GCC3OMF
208TEMPLATE_BIN_CFLAGS = -g
209TEMPLATE_BIN_CFLAGS.profile = -pg
210TEMPLATE_BIN_CFLAGS.release = -O3
211TEMPLATE_BIN_LDFLAGS = -Zhigh-mem -Zstack=1024 -g
212endif
213
214ifeq ($(KBUILD_TARGET),darwin)
215 ifndef KBUILD_MACOSX_VERSION
216 export KBUILD_MACOSX_VERSION := $(expr $(firstword $(subst ., ,$(shell uname -r))) - 4)
217 endif
218 ifndef KBUILD_MACOSX_TARGET_VERSION
219 if $(KBUILD_TARGET_ARCH) == amd64
220 KBUILD_MACOSX_TARGET_VERSION = 6
221 else
222 KBUILD_MACOSX_TARGET_VERSION = 4
223 endif
224 endif
225 if $(KBUILD_MACOSX_TARGET_VERSION) == 4
226 TOOL_GCC4MACHO_SUFFIX = -4.0
227 TOOL_GXX4MACHO_SUFFIX = -4.0
228 else if $(KBUILD_MACOSX_TARGET_VERSION) >= 5
229 TOOL_GCC4MACHO_SUFFIX = -4.2
230 TOOL_GXX4MACHO_SUFFIX = -4.2
231 endif
232 KBUILD_MACOSX_SDK ?= /Developer/SDKs/MacOSX10.$(KBUILD_MACOSX_TARGET_VERSION)$(if-expr $(KBUILD_MACOSX_TARGET_VERSION)==4,u,).sdk
233 TEMPLATE_BIN_TOOL = GCC4MACHO
234 TEMPLATE_BIN_CFLAGS = -g -mmacosx-version-min=10.$(KBUILD_MACOSX_TARGET_VERSION) -isysroot $(KBUILD_MACOSX_SDK)
235 ifeq ($(USER),bird)
236 TEMPLATE_BIN_CFLAGS += -Wall $(GCC_Wextra) -pedantic -Wno-unused-parameter
237 TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS
238 endif
239 TEMPLATE_BIN_CFLAGS.profile = -O3 -pg
240 TEMPLATE_BIN_CFLAGS.release = -O3
241 TEMPLATE_BIN_LDFLAGS = -g -mmacosx-version-min=10.$(KBUILD_MACOSX_TARGET_VERSION) -Wl,-syslibroot,$(KBUILD_MACOSX_SDK)
242 if $(KBUILD_MACOSX_TARGET_VERSION) == 4 && $(KBUILD_MACOSX_VERSION) >= 5
243 TEMPLATE_BIN_LDFLAGS += -classic_ld
244 endif
245 TEMPLATE_BIN_LDFLAGS.profile = -pg
246endif
247
248ifeq ($(filter-out win nt,$(KBUILD_TARGET)),)
249 ifeq ($(KBUILD_TARGET_ARCH),x86)
250 include $(KBUILD_PATH)/tools/VCC70.kmk # fixme! template expanding does something bad to _LIBS /me thinks.
251 TEMPLATE_BIN_TOOL = VCC70
252 TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__
253 else ifeq ($(KBUILD_TARGET_ARCH),amd64)
254 TEMPLATE_BIN_TOOL = VCC80AMD64
255 TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__ __WIN64__ WIN64 \
256 _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_WARNINGS
257 endif
258 TEMPLATE_BIN_CFLAGS = -W3 -Zi -Zl
259 TEMPLATE_BIN_CFLAGS.release = -O2
260 TEMPLATE_BIN_CFLAGS.profile = -O2 -GH -Gh
261 TEMPLATE_BIN_INCS += \
262 . \
263 $(PATH_GNUMAKE_SRC)/w32/include \
264 $(PATH_GNUMAKE_SRC)/glob
265 TEMPLATE_BIN_LDFLAGS = /SUBSYSTEM:console /INCREMENTAL:no /NOD /DEBUG
266 ifeq ($(KBUILD_TYPE),profile)
267 TEMPLATE_BIN_SDKS = WINPSDKINCS
268 TEMPLATE_BIN_CFLAGS += -MT
269 TEMPLATE_BIN_LIBS = \
270 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2.lib \
271 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \
272 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
273 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \
274 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib \
275 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \
276 $(PATH_SDK_WINPSDKINCS_LIB)/AdvAPI32.lib \
277 $(PATH_SDK_WINPSDKINCS_LIB)/User32.lib
278 else
279 TEMPLATE_BIN_SDKS = WINPSDK
280 TEMPLATE_BIN_CFLAGS += -MD
281 TEMPLATE_BIN_LIBS = \
282 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
283 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcrt.lib
284 # $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcprt.lib - avoid this to save space!
285 endif
286endif
287
288ifndef TEMPLATE_BIN_TOOL
289 # Use GCC3 when we're certain that the system is using GNU ld and ar.
290 ifeq ($(filter-out linux freebsd openbsd netbsd,$(KBUILD_TARGET)),)
291 TEMPLATE_BIN_TOOL = GCC3
292 else
293 TEMPLATE_BIN_TOOL = GCC3PLAIN
294 endif
295 TEMPLATE_BIN_CFLAGS = -g
296 ifeq ($(USER),bird)
297 TEMPLATE_BIN_CFLAGS += -Wall $(GCC_Wextra) -pedantic -Wno-unused-parameter
298 TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS
299 endif
300 TEMPLATE_BIN_LDFLAGS = -g
301 TEMPLATE_BIN_LDFLAGS.profile = -pg -p
302 TEMPLATE_BIN_CFLAGS.release = -O3
303 TEMPLATE_BIN_CFLAGS.profile = -O3 -pg -p
304 ifeq ($(KBUILD_TARGET),freebsd)
305 TEMPLATE_BIN_INCS += $(PATH_GNUMAKE_SRC)/glob /usr/local/include
306 endif
307 ifeq ($(KBUILD_TARGET),linux)
308 TEMPLATE_BIN_LIBS += rt
309 endif
310 TEMPLATE_BIN_CFLAGS.x86 += -m32
311 TEMPLATE_BIN_CFLAGS.sparc32 += -m32
312 TEMPLATE_BIN_CFLAGS.amd64 += -m64
313 TEMPLATE_BIN_CFLAGS.sparc64 += -m64
314 TEMPLATE_BIN_CXXFLAGS.x86 += -m32
315 TEMPLATE_BIN_CXXFLAGS.sparc32+= -m32
316 TEMPLATE_BIN_CXXFLAGS.amd64 += -m64
317 TEMPLATE_BIN_CXXFLAGS.sparc64+= -m64
318 TEMPLATE_BIN_LDFLAGS.x86 += -m32
319 TEMPLATE_BIN_LDFLAGS.sparc32 += -m32
320 TEMPLATE_BIN_LDFLAGS.amd64 += -m64
321 TEMPLATE_BIN_LDFLAGS.sparc64 += -m64
322 ifeq ($(KBUILD_TARGET),solaris)
323 TEMPLATE_BIN_LIBS += rt
324 TEMPLATE_BIN_LDFLAGS += -Wl,-i
325 endif
326endif
327
328#
329# Template for building threaded binaries.
330#
331TEMPLATE_BIN-THREADED = Threaded command line binary
332TEMPLATE_BIN-THREADED_EXTENDS = BIN
333TEMPLATE_BIN-THREADED_EXTENDS_BY = appending
334if1of ($(KBUILD_TARGET), dragonfly freebsd openbsd)
335 TEMPLATE_BIN-THREADED_LIBS = pthread
336endif
337
338#
339# Template for building libraries for the tools.
340#
341TEMPLATE_LIB = Library for Commandline binary
342TEMPLATE_LIB_EXTENDS = BIN
343TEMPLATE_LIB_INST = lib/
344# for LIB_KDEP
345TEMPLATE_LIB_TOOL = $(TEMPLATE_BIN_TOOL)
346
347
348LIB_KDEP = $(PATH_OBJ)/kDep/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kDep$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
349LIB_KUTIL = $(PATH_OBJ)/kUtil/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kUtil$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
350
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