VirtualBox

source: kBuild/trunk/Config.kmk@ 2091

Last change on this file since 2091 was 2044, checked in by bird, 16 years ago

Config.kmk: set -m32/m64 on all standard GCC3 platforms and also for sparc32/64.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 9.0 KB
Line 
1# $Id: Config.kmk 2044 2008-11-03 12:29:45Z bird $
2## @file
3# Build Configuration.
4#
5
6#
7# Copyright (c) 2005-2008 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 = 5
36KBUILD_VERSION = 0.1.5
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# The OS and Architecture indicators.
95#
96DEFS.darwin += KBUILD_OS_DARWIN
97DEFS.freebsd += KBUILD_OS_FREEBSD
98DEFS.linux += KBUILD_OS_LINUX
99DEFS.netbsd += KBUILD_OS_NETBSD
100DEFS.openbsd += KBUILD_OS_OPENBSD
101DEFS.os2 += KBUILD_OS_OS2
102DEFS.solaris += KBUILD_OS_SOLARIS
103DEFS.win += KBUILD_OS_WINDOWS
104
105DEFS.x86 += KBUILD_ARCH_X86
106DEFS.amd64 += KBUILD_ARCH_AMD64
107
108
109#
110# Check if we're building a *nix installation.
111#
112ifdef NIX_INSTALL_DIR
113NIX_INSTALL_DIR_BIN := $(patsubst /%,%,$(NIX_INSTALL_DIR))/bin
114NIX_INSTALL_DIR_SHARE := $(patsubst /%,%,$(NIX_INSTALL_DIR))/share/kBuild
115DEFS += \
116 KBUILD_PATH=\"/$(NIX_INSTALL_DIR_SHARE)\" \
117 KBUILD_BIN_PATH=\"/$(NIX_INSTALL_DIR_BIN)\"
118endif
119
120#
121# Where to fine the GNU Make stuff (for FreeBSD and Windows).
122#
123PATH_GNUMAKE_SRC ?= $(PATH_ROOT)/src/kmk
124
125
126#
127# Template for building commandline tools.
128#
129TEMPLATE_BIN = Commandline binary
130
131TEMPLATE_BIN_INCS = $(PATH_ROOT)/src/lib
132TEMPLATE_BIN_DEFS.profile = NDEBUG
133TEMPLATE_BIN_DEFS.release = NDEBUG
134
135ifeq ($(KBUILD_TARGET),os2)
136TEMPLATE_BIN_TOOL = GCC3OMF
137TEMPLATE_BIN_CFLAGS = -g
138TEMPLATE_BIN_CFLAGS.profile = -pg
139TEMPLATE_BIN_CFLAGS.release = -O3
140TEMPLATE_BIN_LDFLAGS = -Zhigh-mem -Zstack=1024 -g
141 ifdef NIX_INSTALL_DIR
142TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
143 else
144TEMPLATE_BIN_INST = kBuild/bin/os2.x86/
145 endif
146endif
147
148ifeq ($(KBUILD_TARGET),darwin)
149 ifndef KBUILD_MACOSX_VERSION
150 export KBUILD_MACOSX_VERSION := $(firstword $(subst ., ,$(shell uname -r)))
151 endif
152 KBUILD_MACOSX_SDK ?= /Developer/SDKs/MacOSX10.4u.sdk
153 TEMPLATE_BIN_TOOL = GCC4MACHO
154 TEMPLATE_BIN_CFLAGS = -g -mmacosx-version-min=10.4 -isysroot $(KBUILD_MACOSX_SDK)
155 ifeq ($(USER),bird)
156 TEMPLATE_BIN_CFLAGS += -Wall -Wextra -pedantic -Wno-unused-parameter
157 TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS
158 endif
159 TEMPLATE_BIN_CFLAGS.profile = -O3 -pg
160 TEMPLATE_BIN_CFLAGS.release = -O3
161 TEMPLATE_BIN_LDFLAGS = -g -mmacosx-version-min=10.4 -Wl,-syslibroot,$(KBUILD_MACOSX_SDK)
162 ifneq ($(int-ge $(KBUILD_MACOSX_VERSION),9),) # >= 10.5
163 TEMPLATE_BIN_LDFLAGS += -classic_ld
164 endif
165 TEMPLATE_BIN_LDFLAGS.profile = -pg
166 ifdef NIX_INSTALL_DIR
167 TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
168 else
169 TEMPLATE_BIN_INST = kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
170 endif
171endif
172
173ifeq ($(filter-out win nt,$(KBUILD_TARGET)),)
174 ifeq ($(KBUILD_TARGET_ARCH),x86)
175 include $(KBUILD_PATH)/tools/VCC70.kmk # fixme! template expanding does something bad to _LIBS /me thinks.
176 TEMPLATE_BIN_TOOL = VCC70
177 TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__
178 else ifeq ($(KBUILD_TARGET_ARCH),amd64)
179 TEMPLATE_BIN_TOOL = VCC80AMD64
180 TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__ __WIN64__ WIN64 \
181 _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_WARNINGS
182 endif
183 TEMPLATE_BIN_CFLAGS = -W3 -Zi -Zl
184 TEMPLATE_BIN_CFLAGS.release = -O2
185 TEMPLATE_BIN_CFLAGS.profile = -O2 -GH -Gh
186 TEMPLATE_BIN_INCS += \
187 . \
188 $(PATH_GNUMAKE_SRC)/w32/include \
189 $(PATH_GNUMAKE_SRC)/glob
190 TEMPLATE_BIN_LDFLAGS = /SUBSYSTEM:console /INCREMENTAL:no /NOD /DEBUG
191 ifeq ($(KBUILD_TYPE),profile)
192 TEMPLATE_BIN_SDKS = WINPSDKINCS
193 TEMPLATE_BIN_CFLAGS += -MT
194 TEMPLATE_BIN_LIBS = \
195 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2.lib \
196 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \
197 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
198 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \
199 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib \
200 D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \
201 $(PATH_SDK_WINPSDKINCS_LIB)/AdvAPI32.lib \
202 $(PATH_SDK_WINPSDKINCS_LIB)/User32.lib
203 else
204 TEMPLATE_BIN_SDKS = WINPSDK
205 TEMPLATE_BIN_CFLAGS += -MD
206 TEMPLATE_BIN_LIBS = \
207 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
208 $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcrt.lib
209 # $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcprt.lib - avoid this to save space!
210 endif
211 ifdef NIX_INSTALL_DIR
212 TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
213 else
214 TEMPLATE_BIN_INST = kBuild/bin/win.$(KBUILD_TARGET_ARCH)/
215 endif
216endif
217
218ifndef TEMPLATE_BIN_TOOL
219 # Use GCC3 when we're certain that the system is using GNU ld and ar.
220 ifeq ($(filter-out linux freebsd openbsd netbsd,$(KBUILD_TARGET)),)
221 TEMPLATE_BIN_TOOL = GCC3
222 else
223 TEMPLATE_BIN_TOOL = GCC3PLAIN
224 endif
225 TEMPLATE_BIN_CFLAGS = -g
226 ifeq ($(USER),bird)
227 TEMPLATE_BIN_CFLAGS += -Wall -Wextra -pedantic -Wno-unused-parameter
228 TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS
229 endif
230 TEMPLATE_BIN_LDFLAGS = -g
231 TEMPLATE_BIN_LDFLAGS.profile = -pg -p
232 TEMPLATE_BIN_CFLAGS.release = -O3
233 TEMPLATE_BIN_CFLAGS.profile = -O3 -pg -p
234 ifeq ($(KBUILD_TARGET),freebsd)
235 TEMPLATE_BIN_INCS += $(PATH_GNUMAKE_SRC)/glob /usr/local/include
236 endif
237 ifeq ($(KBUILD_TARGET),linux)
238 TEMPLATE_BIN_LIBS += rt
239 endif
240 TEMPLATE_BIN_CFLAGS.x86 += -m32
241 TEMPLATE_BIN_CFLAGS.sparc32 += -m32
242 TEMPLATE_BIN_CFLAGS.amd64 += -m64
243 TEMPLATE_BIN_CFLAGS.sparc64 += -m64
244 TEMPLATE_BIN_CXXFLAGS.x86 += -m32
245 TEMPLATE_BIN_CXXFLAGS.sparc32+= -m32
246 TEMPLATE_BIN_CXXFLAGS.amd64 += -m64
247 TEMPLATE_BIN_CXXFLAGS.sparc64+= -m64
248 TEMPLATE_BIN_LDFLAGS.x86 += -m32
249 TEMPLATE_BIN_LDFLAGS.sparc32 += -m32
250 TEMPLATE_BIN_LDFLAGS.amd64 += -m64
251 TEMPLATE_BIN_LDFLAGS.sparc64 += -m64
252 ifeq ($(KBUILD_TARGET),solaris)
253 TEMPLATE_BIN_LIBS += rt
254 TEMPLATE_BIN_LDFLAGS += -Wl,-i
255 endif
256 ifdef NIX_INSTALL_DIR
257 TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
258 else
259 TEMPLATE_BIN_INST = kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
260 endif
261endif
262
263#
264# Template for building libraries for the tools.
265#
266TEMPLATE_LIB = Library for Commandline binary
267TEMPLATE_LIB_EXTENDS = BIN
268TEMPLATE_LIB_INST = lib/
269# for LIB_KDEP
270TEMPLATE_LIB_TOOL = $(TEMPLATE_BIN_TOOL)
271
272
273LIB_KDEP = $(PATH_OBJ)/kDep/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kDep$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
274LIB_KUTIL = $(PATH_OBJ)/kUtil/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kUtil$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
275
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