1 | # $Id: Config.kmk 1828 2008-10-11 07:12:36Z 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 2 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, write to the Free Software
|
---|
23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
24 | #
|
---|
25 | #
|
---|
26 |
|
---|
27 | # Enable automatic installation of what's built.
|
---|
28 | KBUILD_DO_AUTO_INSTALL := 1
|
---|
29 |
|
---|
30 |
|
---|
31 | #
|
---|
32 | # The kBuild version.
|
---|
33 | #
|
---|
34 | KBUILD_VERSION_MAJOR = 0
|
---|
35 | KBUILD_VERSION_MINOR = 1
|
---|
36 | KBUILD_VERSION_PATCH = 4
|
---|
37 | KBUILD_VERSION = 0.1.4
|
---|
38 | DEFS += \
|
---|
39 | KBUILD_VERSION_MAJOR=$(KBUILD_VERSION_MAJOR) \
|
---|
40 | KBUILD_VERSION_MINOR=$(KBUILD_VERSION_MINOR) \
|
---|
41 | KBUILD_VERSION_PATCH=$(KBUILD_VERSION_PATCH)
|
---|
42 |
|
---|
43 | #
|
---|
44 | # Get the svn version.
|
---|
45 | # This is shipped with the tarballs in a SvnInfo.kmk in the root.
|
---|
46 | #
|
---|
47 | ifneq ($(wildcard $(PATH_ROOT)/SvnInfo.kmk),)
|
---|
48 | # Shipped
|
---|
49 | KBUILD_SVN_INFO_KMK := $(PATH_ROOT)/SvnInfo.kmk
|
---|
50 | KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK)
|
---|
51 |
|
---|
52 | else ifneq ($(wildcard $(PATH_ROOT)/.svn/entries),)
|
---|
53 | # Generate from svn info
|
---|
54 | KBUILD_SVN_INFO_KMK := $(PATH_OBJ)/SvnInfo.kmk
|
---|
55 | KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK)
|
---|
56 |
|
---|
57 | $(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 )
|
---|
58 | $(call MSG_GENERATE,,$(KBUILD_SVN_INFO_KMK))
|
---|
59 | @$(RM) -f $@ [email protected]
|
---|
60 | @$(MKDIR) -p $(@D)
|
---|
61 | @$(REDIRECT) -o [email protected] -E 'LC_ALL=C' -- svn info $(DEPTH)
|
---|
62 | @$(SED) \
|
---|
63 | -e 's/URL: */KBUILD_SVN_URL := /' \
|
---|
64 | -e 's/Revision: */KBUILD_SVN_REV := /' \
|
---|
65 | -e '/KBUILD_SVN_/!d' \
|
---|
66 | --append $@ \
|
---|
67 | [email protected]
|
---|
68 | @$(RM) -f [email protected]
|
---|
69 | @$(CP) --changed -fv $@ $(KBUILD_SVN_INFO_KMK)
|
---|
70 |
|
---|
71 | ifeq ($(DEPTH),.)
|
---|
72 | OTHER_CLEAN += $(KBUILD_SVN_INFO_KMK) $(PATH_OBJ)/SvnInfo.ts
|
---|
73 | endif
|
---|
74 |
|
---|
75 | else
|
---|
76 | # Some incomplete source export...
|
---|
77 | KBUILD_SVN_INFO_KMK := $(PATH_OBJ)/SvnInfo.kmk
|
---|
78 | KBUILD_SVN_INFO_DEP := $(KBUILD_SVN_INFO_KMK)
|
---|
79 | $(warning Neither SvnInfo nor .svn/* was found in the root. Will have to cook up something too keep the build happy.)
|
---|
80 | $(KBUILD_SVN_INFO_KMK):
|
---|
81 | $(RM) -f $@
|
---|
82 | $(MKDIR) -p $(@D)
|
---|
83 | $(APPEND) $@ 'KBUILD_SVN_REV := 0'
|
---|
84 | $(APPEND) $@ 'KBUILD_SVN_URL := /dev/null'
|
---|
85 |
|
---|
86 | ifeq ($(DEPTH),.)
|
---|
87 | OTHER_CLEAN += $(KBUILD_SVN_INFO_KMK)
|
---|
88 | endif
|
---|
89 |
|
---|
90 | endif
|
---|
91 | include $(KBUILD_SVN_INFO_KMK)
|
---|
92 |
|
---|
93 |
|
---|
94 | #
|
---|
95 | # The OS and Architecture indicators.
|
---|
96 | #
|
---|
97 | DEFS.darwin += KBUILD_OS_DARWIN
|
---|
98 | DEFS.freebsd += KBUILD_OS_FREEBSD
|
---|
99 | DEFS.linux += KBUILD_OS_LINUX
|
---|
100 | DEFS.netbsd += KBUILD_OS_NETBSD
|
---|
101 | DEFS.openbsd += KBUILD_OS_OPENBSD
|
---|
102 | DEFS.os2 += KBUILD_OS_OS2
|
---|
103 | DEFS.solaris += KBUILD_OS_SOLARIS
|
---|
104 | DEFS.win += KBUILD_OS_WINDOWS
|
---|
105 |
|
---|
106 | DEFS.x86 += KBUILD_ARCH_X86
|
---|
107 | DEFS.amd64 += KBUILD_ARCH_AMD64
|
---|
108 |
|
---|
109 |
|
---|
110 | #
|
---|
111 | # Check if we're building a *nix installation.
|
---|
112 | #
|
---|
113 | ifdef NIX_INSTALL_DIR
|
---|
114 | NIX_INSTALL_DIR_BIN := $(patsubst /%,%,$(NIX_INSTALL_DIR))/bin
|
---|
115 | NIX_INSTALL_DIR_SHARE := $(patsubst /%,%,$(NIX_INSTALL_DIR))/share/kBuild
|
---|
116 | DEFS += \
|
---|
117 | KBUILD_PATH=\"/$(NIX_INSTALL_DIR_SHARE)\" \
|
---|
118 | KBUILD_BIN_PATH=\"/$(NIX_INSTALL_DIR_BIN)\"
|
---|
119 | endif
|
---|
120 |
|
---|
121 | #
|
---|
122 | # Where to fine the GNU Make stuff (for FreeBSD and Windows).
|
---|
123 | #
|
---|
124 | PATH_GNUMAKE_SRC ?= $(PATH_ROOT)/src/kmk
|
---|
125 |
|
---|
126 |
|
---|
127 | #
|
---|
128 | # Template for building commandline tools.
|
---|
129 | #
|
---|
130 | TEMPLATE_BIN = Commandline binary
|
---|
131 |
|
---|
132 | TEMPLATE_BIN_INCS = $(PATH_ROOT)/src/lib
|
---|
133 | TEMPLATE_BIN_DEFS.profile = NDEBUG
|
---|
134 | TEMPLATE_BIN_DEFS.release = NDEBUG
|
---|
135 |
|
---|
136 | ifeq ($(KBUILD_TARGET),os2)
|
---|
137 | TEMPLATE_BIN_TOOL = GCC3OMF
|
---|
138 | TEMPLATE_BIN_CFLAGS = -g
|
---|
139 | TEMPLATE_BIN_CFLAGS.profile = -pg
|
---|
140 | TEMPLATE_BIN_CFLAGS.release = -O3
|
---|
141 | TEMPLATE_BIN_LDFLAGS = -Zhigh-mem -Zstack=1024 -g
|
---|
142 | ifdef NIX_INSTALL_DIR
|
---|
143 | TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
|
---|
144 | else
|
---|
145 | TEMPLATE_BIN_INST = kBuild/bin/os2.x86/
|
---|
146 | endif
|
---|
147 | endif
|
---|
148 |
|
---|
149 | ifeq ($(KBUILD_TARGET),darwin)
|
---|
150 | ifndef KBUILD_MACOSX_VERSION
|
---|
151 | export KBUILD_MACOSX_VERSION := $(firstword $(subst ., ,$(shell uname -r)))
|
---|
152 | endif
|
---|
153 | KBUILD_MACOSX_SDK ?= /Developer/SDKs/MacOSX10.4u.sdk
|
---|
154 | TEMPLATE_BIN_TOOL = GCC4MACHO
|
---|
155 | TEMPLATE_BIN_CFLAGS = -g -mmacosx-version-min=10.4 -isysroot $(KBUILD_MACOSX_SDK)
|
---|
156 | ifeq ($(USER),bird)
|
---|
157 | TEMPLATE_BIN_CFLAGS += -Wall -Wextra -pedantic -Wno-unused-parameter
|
---|
158 | TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS
|
---|
159 | endif
|
---|
160 | TEMPLATE_BIN_CFLAGS.profile = -O3 -pg
|
---|
161 | TEMPLATE_BIN_CFLAGS.release = -O3
|
---|
162 | TEMPLATE_BIN_LDFLAGS = -g -mmacosx-version-min=10.4 -Wl,-syslibroot,$(KBUILD_MACOSX_SDK)
|
---|
163 | ifneq ($(int-ge $(KBUILD_MACOSX_VERSION),9),) # >= 10.5
|
---|
164 | TEMPLATE_BIN_LDFLAGS += -classic_ld
|
---|
165 | endif
|
---|
166 | TEMPLATE_BIN_LDFLAGS.profile = -pg
|
---|
167 | ifdef NIX_INSTALL_DIR
|
---|
168 | TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
|
---|
169 | else
|
---|
170 | TEMPLATE_BIN_INST = kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
|
---|
171 | endif
|
---|
172 | endif
|
---|
173 |
|
---|
174 | ifeq ($(filter-out win nt,$(KBUILD_TARGET)),)
|
---|
175 | ifeq ($(KBUILD_TARGET_ARCH),x86)
|
---|
176 | include $(KBUILD_PATH)/tools/VCC70.kmk # fixme! template expanding does something bad to _LIBS /me thinks.
|
---|
177 | TEMPLATE_BIN_TOOL = VCC70
|
---|
178 | TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__
|
---|
179 | else ifeq ($(KBUILD_TARGET_ARCH),amd64)
|
---|
180 | TEMPLATE_BIN_TOOL = VCC80AMD64
|
---|
181 | TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__ __WIN64__ WIN64 \
|
---|
182 | _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_WARNINGS
|
---|
183 | endif
|
---|
184 | TEMPLATE_BIN_CFLAGS = -W3 -Zi -Zl
|
---|
185 | TEMPLATE_BIN_CFLAGS.release = -O2
|
---|
186 | TEMPLATE_BIN_CFLAGS.profile = -O2 -GH -Gh
|
---|
187 | TEMPLATE_BIN_INCS += \
|
---|
188 | . \
|
---|
189 | $(PATH_GNUMAKE_SRC)/w32/include \
|
---|
190 | $(PATH_GNUMAKE_SRC)/glob
|
---|
191 | TEMPLATE_BIN_LDFLAGS = /SUBSYSTEM:console /INCREMENTAL:no /NOD /DEBUG
|
---|
192 | ifeq ($(KBUILD_TYPE),profile)
|
---|
193 | TEMPLATE_BIN_SDKS = WINPSDKINCS
|
---|
194 | TEMPLATE_BIN_CFLAGS += -MT
|
---|
195 | TEMPLATE_BIN_LIBS = \
|
---|
196 | D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2.lib \
|
---|
197 | D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \
|
---|
198 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
|
---|
199 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \
|
---|
200 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib \
|
---|
201 | D:/coding/kStuff/svn/trunk/out/win.$(KBUILD_TARGET_ARCH)/release/kStuff/lib/kPrf2WinApiWrappersImp.lib \
|
---|
202 | $(PATH_SDK_WINPSDKINCS_LIB)/AdvAPI32.lib \
|
---|
203 | $(PATH_SDK_WINPSDKINCS_LIB)/User32.lib
|
---|
204 | else
|
---|
205 | TEMPLATE_BIN_SDKS = WINPSDK
|
---|
206 | TEMPLATE_BIN_CFLAGS += -MD
|
---|
207 | TEMPLATE_BIN_LIBS = \
|
---|
208 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
|
---|
209 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcrt.lib
|
---|
210 | # $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcprt.lib - avoid this to save space!
|
---|
211 | endif
|
---|
212 | ifdef NIX_INSTALL_DIR
|
---|
213 | TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
|
---|
214 | else
|
---|
215 | TEMPLATE_BIN_INST = kBuild/bin/win.$(KBUILD_TARGET_ARCH)/
|
---|
216 | endif
|
---|
217 | endif
|
---|
218 |
|
---|
219 | ifndef TEMPLATE_BIN_TOOL
|
---|
220 | # Use GCC3 when we're certain that the system is using GNU ld and ar.
|
---|
221 | ifeq ($(filter-out linux freebsd openbsd netbsd,$(KBUILD_TARGET)),)
|
---|
222 | TEMPLATE_BIN_TOOL = GCC3
|
---|
223 | else
|
---|
224 | TEMPLATE_BIN_TOOL = GCC3PLAIN
|
---|
225 | endif
|
---|
226 | TEMPLATE_BIN_CFLAGS = -g
|
---|
227 | ifeq ($(USER),bird)
|
---|
228 | TEMPLATE_BIN_CFLAGS += -Wall -Wextra -pedantic -Wno-unused-parameter
|
---|
229 | TEMPLATE_BIN_DEFS += NO_ENUM_BITFIELDS
|
---|
230 | endif
|
---|
231 | TEMPLATE_BIN_LDFLAGS = -g
|
---|
232 | TEMPLATE_BIN_LDFLAGS.profile = -pg -p
|
---|
233 | TEMPLATE_BIN_CFLAGS.release = -O3
|
---|
234 | TEMPLATE_BIN_CFLAGS.profile = -O3 -pg -p
|
---|
235 | ifeq ($(KBUILD_TARGET),freebsd)
|
---|
236 | TEMPLATE_BIN_INCS += $(PATH_GNUMAKE_SRC)/glob /usr/local/include
|
---|
237 | endif
|
---|
238 | ifeq ($(KBUILD_TARGET),linux)
|
---|
239 | TEMPLATE_BIN_LIBS += rt
|
---|
240 | endif
|
---|
241 | ifeq ($(KBUILD_TARGET),solaris)
|
---|
242 | TEMPLATE_BIN_CFLAGS.x86 += -m32
|
---|
243 | TEMPLATE_BIN_CFLAGS.amd64 += -m64
|
---|
244 | TEMPLATE_BIN_CXXFLAGS.x86 += -m32
|
---|
245 | TEMPLATE_BIN_CXXFLAGS.amd64 += -m64
|
---|
246 | TEMPLATE_BIN_LDFLAGS.x86 += -m32
|
---|
247 | TEMPLATE_BIN_LDFLAGS.amd64 += -m64
|
---|
248 | TEMPLATE_BIN_LIBS += rt
|
---|
249 | TEMPLATE_BIN_LDFLAGS += -Wl,-i
|
---|
250 | endif
|
---|
251 | ifdef NIX_INSTALL_DIR
|
---|
252 | TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
|
---|
253 | else
|
---|
254 | TEMPLATE_BIN_INST = kBuild/bin/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/
|
---|
255 | endif
|
---|
256 | endif
|
---|
257 |
|
---|
258 | #
|
---|
259 | # Template for building libraries for the tools.
|
---|
260 | #
|
---|
261 | TEMPLATE_LIB = Library for Commandline binary
|
---|
262 | TEMPLATE_LIB_EXTENDS = BIN
|
---|
263 | TEMPLATE_LIB_INST = lib/
|
---|
264 | # for LIB_KDEP
|
---|
265 | TEMPLATE_LIB_TOOL = $(TEMPLATE_BIN_TOOL)
|
---|
266 |
|
---|
267 |
|
---|
268 | LIB_KDEP = $(PATH_OBJ)/kDep/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kDep$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
|
---|
269 | LIB_KUTIL = $(PATH_OBJ)/kUtil/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kUtil$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
|
---|
270 |
|
---|