1 | # $Id: Config.kmk 1274 2007-11-29 20:45:51Z bird $
|
---|
2 | ## @file
|
---|
3 | #
|
---|
4 | # Build Configuration.
|
---|
5 | #
|
---|
6 | # Copyright (c) 2005-2007 knut st. osmundsen <[email protected]>
|
---|
7 | #
|
---|
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 = 2
|
---|
37 | KBUILD_VERSION = "0.1.2"
|
---|
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 | # The OS and Architecture indicators.
|
---|
45 | #
|
---|
46 | DEFS.darwin += KBUILD_OS_DARWIN
|
---|
47 | DEFS.freebsd += KBUILD_OS_FREEBSD
|
---|
48 | DEFS.linux += KBUILD_OS_LINUX
|
---|
49 | DEFS.netbsd += KBUILD_OS_NETBSD
|
---|
50 | DEFS.openbsd += KBUILD_OS_OPENBSD
|
---|
51 | DEFS.os2 += KBUILD_OS_OS2
|
---|
52 | DEFS.solaris += KBUILD_OS_SOLARIS
|
---|
53 | DEFS.win += KBUILD_OS_WINDOWS
|
---|
54 |
|
---|
55 | DEFS.x86 += KBUILD_ARCH_X86
|
---|
56 | DEFS.amd64 += KBUILD_ARCH_AMD64
|
---|
57 |
|
---|
58 |
|
---|
59 | #
|
---|
60 | # Check if we're building a *nix installation.
|
---|
61 | #
|
---|
62 | ifdef NIX_INSTALL_DIR
|
---|
63 | NIX_INSTALL_DIR_BIN := $(patsubst /%,%,$(NIX_INSTALL_DIR))/bin
|
---|
64 | NIX_INSTALL_DIR_SHARE := $(patsubst /%,%,$(NIX_INSTALL_DIR))/share/kBuild
|
---|
65 | DEFS += \
|
---|
66 | PATH_KBUILD=\"/$(NIX_INSTALL_DIR_SHARE)\" \
|
---|
67 | PATH_KBUILD_BIN=\"/$(NIX_INSTALL_DIR_BIN)\"
|
---|
68 | endif
|
---|
69 |
|
---|
70 | #
|
---|
71 | # Where to fine the GNU Make stuff (for FreeBSD and Windows).
|
---|
72 | #
|
---|
73 | PATH_GNUMAKE_SRC ?= $(PATH_ROOT)/src/kmk
|
---|
74 |
|
---|
75 |
|
---|
76 | #
|
---|
77 | # Template for building commandline tools.
|
---|
78 | #
|
---|
79 | TEMPLATE_BIN = Commandline binary
|
---|
80 |
|
---|
81 | TEMPLATE_BIN_INCS = $(PATH_ROOT)/src/lib
|
---|
82 |
|
---|
83 | ifeq ($(BUILD_TARGET),os2)
|
---|
84 | TEMPLATE_BIN_TOOL = GCC3OMF
|
---|
85 | TEMPLATE_BIN_CFLAGS.profile = -pg
|
---|
86 | TEMPLATE_BIN_CFLAGS.release = -O3
|
---|
87 | TEMPLATE_BIN_LDFLAGS = -Zhigh-mem -Zstack=1024
|
---|
88 | ifdef NIX_INSTALL_DIR
|
---|
89 | TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
|
---|
90 | else
|
---|
91 | TEMPLATE_BIN_INST = kBuild/bin/os2.x86/
|
---|
92 | endif
|
---|
93 | endif
|
---|
94 |
|
---|
95 | ifeq ($(BUILD_TARGET),darwin)
|
---|
96 | TEMPLATE_BIN_TOOL = GCC4MACHO
|
---|
97 | TEMPLATE_BIN_CFLAGS.profile =
|
---|
98 | TEMPLATE_BIN_CFLAGS.release = -O3
|
---|
99 | TEMPLATE_BIN_LDFLAGS =
|
---|
100 | ifdef NIX_INSTALL_DIR
|
---|
101 | TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
|
---|
102 | else
|
---|
103 | TEMPLATE_BIN_INST = kBuild/bin/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/
|
---|
104 | endif
|
---|
105 | endif
|
---|
106 |
|
---|
107 | ifeq ($(filter-out win nt,$(BUILD_TARGET)),)
|
---|
108 | ifeq ($(BUILD_TARGET_ARCH),x86)
|
---|
109 | include $(PATH_KBUILD)/tools/VCC70.kmk # fixme! template expanding does something bad to _LIBS /me thinks.
|
---|
110 | TEMPLATE_BIN_TOOL = VCC70
|
---|
111 | TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__
|
---|
112 | else ifeq ($(BUILD_TARGET_ARCH),amd64)
|
---|
113 | TEMPLATE_BIN_TOOL = VCC80AMD64
|
---|
114 | TEMPLATE_BIN_DEFS = WINDOWS32 _CONSOLE __WIN__ WIN32 __WIN32__ __WIN64__ WIN64 \
|
---|
115 | _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_WARNINGS
|
---|
116 | endif
|
---|
117 | TEMPLATE_BIN_DEFS.release = NDEBUG
|
---|
118 | TEMPLATE_BIN_SDKS = WINPSDK
|
---|
119 | TEMPLATE_BIN_CFLAGS = -W3 -Zi -Zl
|
---|
120 | TEMPLATE_BIN_CFLAGS.release = -O2
|
---|
121 | TEMPLATE_BIN_CFLAGS.profile = -O2 -GH -Gh
|
---|
122 | TEMPLATE_BIN_INCS += \
|
---|
123 | . \
|
---|
124 | $(PATH_GNUMAKE_SRC)/w32/include \
|
---|
125 | $(PATH_GNUMAKE_SRC)/glob
|
---|
126 | TEMPLATE_BIN_LDFLAGS = /SUBSYSTEM:console /INCREMENTAL:no /NOD /DEBUG
|
---|
127 | ifeq (1,0)
|
---|
128 | TEMPLATE_BIN_CFLAGS += -MT
|
---|
129 | TEMPLATE_BIN_LIBS = \
|
---|
130 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
|
---|
131 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcmt.lib \
|
---|
132 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/libcpmt.lib
|
---|
133 | else
|
---|
134 | TEMPLATE_BIN_CFLAGS += -MD
|
---|
135 | TEMPLATE_BIN_LIBS = \
|
---|
136 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/oldnames.lib \
|
---|
137 | $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcrt.lib
|
---|
138 | # $(PATH_TOOL_$(TEMPLATE_BIN_TOOL)_LIB)/msvcprt.lib - avoid this to save space!
|
---|
139 | endif
|
---|
140 | TEMPLATE_BIN_LIBS.profile = Y:/coding/libc/svn/trunk/out/win.$(BUILD_TARGET_ARCH)/debug/kStuff/lib/kPrf2.lib
|
---|
141 | ifdef NIX_INSTALL_DIR
|
---|
142 | TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
|
---|
143 | else
|
---|
144 | TEMPLATE_BIN_INST = kBuild/bin/win.$(BUILD_TARGET_ARCH)/
|
---|
145 | endif
|
---|
146 | endif
|
---|
147 |
|
---|
148 | ifndef TEMPLATE_BIN_TOOL
|
---|
149 | # Use GCC3 when we're certain that the system is using GNU ld and ar.
|
---|
150 | ifeq ($(filter-out linux freebsd openbsd netbsd,$(BUILD_TARGET)),)
|
---|
151 | TEMPLATE_BIN_TOOL = GCC3
|
---|
152 | else
|
---|
153 | TEMPLATE_BIN_TOOL = GCC3PLAIN
|
---|
154 | endif
|
---|
155 | TEMPLATE_BIN_CFLAGS.release = -O3
|
---|
156 | ifeq ($(BUILD_TARGET),freebsd)
|
---|
157 | TEMPLATE_BIN_INCS += $(PATH_GNUMAKE_SRC)/glob /usr/local/include
|
---|
158 | endif
|
---|
159 | ifeq ($(BUILD_TARGET),linux)
|
---|
160 | TEMPLATE_BIN_LIBS += rt
|
---|
161 | endif
|
---|
162 | ifeq ($(BUILD_TARGET),solaris)
|
---|
163 | TEMPLATE_BIN_CFLAGS.x86 += -m32
|
---|
164 | TEMPLATE_BIN_CFLAGS.amd64 += -m64
|
---|
165 | TEMPLATE_BIN_CXXFLAGS.x86 += -m32
|
---|
166 | TEMPLATE_BIN_CXXFLAGS.amd64 += -m64
|
---|
167 | TEMPLATE_BIN_LDFLAGS.x86 += -m32
|
---|
168 | TEMPLATE_BIN_LDFLAGS.amd64 += -m64
|
---|
169 | TEMPLATE_BIN_LIBS += rt
|
---|
170 | TEMPLATE_BIN_LDFLAGS += -Wl,-i
|
---|
171 | endif
|
---|
172 | ifdef NIX_INSTALL_DIR
|
---|
173 | TEMPLATE_BIN_INST = $(NIX_INSTALL_DIR_BIN)/
|
---|
174 | else
|
---|
175 | TEMPLATE_BIN_INST = kBuild/bin/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/
|
---|
176 | endif
|
---|
177 | endif
|
---|
178 |
|
---|
179 | #
|
---|
180 | # Template for building libraries for the tools.
|
---|
181 | #
|
---|
182 | TEMPLATE_LIB = Library for Commandline binary
|
---|
183 | TEMPLATE_LIB_EXTENDS = BIN
|
---|
184 | TEMPLATE_LIB_INST = lib/
|
---|
185 | # for LIB_KDEP
|
---|
186 | TEMPLATE_LIB_TOOL = $(TEMPLATE_BIN_TOOL)
|
---|
187 |
|
---|
188 |
|
---|
189 | LIB_KDEP = $(PATH_OBJ)/src/lib/kDep/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kDep$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
|
---|
190 | LIB_KUTIL = $(PATH_OBJ)/src/lib/kUtil/$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBPREF)kUtil$(TOOL_$(TEMPLATE_LIB_TOOL)_ARLIBSUFF)
|
---|
191 |
|
---|