1 | # $Id: VCC70.kmk 641 2006-12-01 18:32:45Z bird $
|
---|
2 | ## @file
|
---|
3 | #
|
---|
4 | # kBuild Tool Config - Visual C++ 7.0 (aka Visual .NET)
|
---|
5 | #
|
---|
6 | # Copyright (c) 2004-2006 knut st. osmundsen <bird-srcspam@anduin.net>
|
---|
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 |
|
---|
28 | TOOL_VCC70 := Visual C++ 7.0
|
---|
29 | ifndef PATH_TOOL_VCC70
|
---|
30 | PATH_TOOL_VCC70 := $(wildcard $(PATH_DEV)/x86.win32/vcc/v7)
|
---|
31 | ifeq ($(PATH_TOOL_VCC70),)
|
---|
32 | PATH_TOOL_VCC70 := $(PATH_DEV)/x86.win32/vcc70
|
---|
33 | endif
|
---|
34 | endif
|
---|
35 | PATH_TOOL_VCC70_LIB ?= $(PATH_TOOL_VCC70)/lib
|
---|
36 |
|
---|
37 | TOOL_VCC70_CC := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70)/bin/cl.exe
|
---|
38 | TOOL_VCC70_COBJSUFF := .obj
|
---|
39 | TOOL_VCC70_CFLAGS := -TC -c -nologo
|
---|
40 | TOOL_VCC70_CFLAGS.debug := -Od -Zi
|
---|
41 | TOOL_VCC70_CFLAGS.release := -O2
|
---|
42 | TOOL_VCC70_CFLAGS.profile := -O2
|
---|
43 | TOOL_VCC70_CINCS := $(PATH_TOOL_VCC70)/include
|
---|
44 | TOOL_VCC70_CDEFS :=
|
---|
45 |
|
---|
46 | TOOL_VCC70_CXX := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70)/bin/cl.exe
|
---|
47 | TOOL_VCC70_CXXOBJSUFF := .obj
|
---|
48 | TOOL_VCC70_CXXFLAGS := -TP -c -nologo
|
---|
49 | TOOL_VCC70_CXXFLAGS.debug := -Od -Zi
|
---|
50 | TOOL_VCC70_CXXFLAGS.release := -O2
|
---|
51 | TOOL_VCC70_CXXFLAGS.profile := -O2
|
---|
52 | TOOL_VCC70_CXXINCS := $(PATH_TOOL_VCC70)/include
|
---|
53 | TOOL_VCC70_CXXDEFS :=
|
---|
54 |
|
---|
55 | TOOL_VCC70_AS := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70)/bin/ml.exe
|
---|
56 | TOOL_VCC70_ASOBJSUFF := .obj
|
---|
57 |
|
---|
58 | TOOL_VCC70_RC := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70)/bin/rc.exe
|
---|
59 | TOOL_VCC70_RCOBJSUFF := .res
|
---|
60 |
|
---|
61 | TOOL_VCC70_AR := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70)/bin/lib.exe
|
---|
62 | TOOL_VCC70_ARFLAGS := -nologo
|
---|
63 | TOOL_VCC70_ARLIBSUFF := .lib
|
---|
64 |
|
---|
65 | TOOL_VCC70_LD := $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70)/bin/link.exe
|
---|
66 | TOOL_VCC70_LDFLAGS := -nologo
|
---|
67 | TOOL_VCC70_LDFLAGS.debug := -debug
|
---|
68 | TOOL_VCC70_LDFLAGS.release :=
|
---|
69 |
|
---|
70 | ## Constructs the correct .pdb name (the name is lowercased).
|
---|
71 | # @param $(1) Base name, no extention.
|
---|
72 | # @param $(2) The extension.
|
---|
73 | ifeq ($(filter tolower,$(KMK_FEATURES)),tolower)
|
---|
74 | TOOL_VCC70_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
|
---|
75 | else # this fallback is incorrect and won't work on a case sensitive FS.
|
---|
76 | TOOL_VCC70_PDB = $(1).$(2)
|
---|
77 | endif
|
---|
78 |
|
---|
79 | #ifeq ($(BUILD_PLATFORM),win32)
|
---|
80 | VCC70_NEW_DEPS = 1
|
---|
81 | #endif
|
---|
82 |
|
---|
83 |
|
---|
84 |
|
---|
85 | ## Compile C source.
|
---|
86 | # @param $(target) Normalized main target name.
|
---|
87 | # @param $(source) Source filename (relative).
|
---|
88 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
89 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
90 | # @param $(flags) Flags.
|
---|
91 | # @param $(defs) Definitions. No -D or something.
|
---|
92 | # @param $(incs) Includes. No -I or something.
|
---|
93 | # @param $(dirdep) Directory creation dependency.
|
---|
94 | # @param $(deps) Other dependencies.
|
---|
95 | #
|
---|
96 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
97 | # @param $(objsuff) Object suffix.
|
---|
98 | TOOL_VCC70_COMPILE_C_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb)
|
---|
99 | TOOL_VCC70_COMPILE_C_DEPEND =
|
---|
100 | TOOL_VCC70_COMPILE_C_DEPORD =
|
---|
101 | ifdef VCC70_NEW_DEPS
|
---|
102 | define TOOL_VCC70_COMPILE_C_CMDS
|
---|
103 | $(TOOL_VCC70_CC) -c\
|
---|
104 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
105 | -Fd$(outbase)-obj.pdb \
|
---|
106 | -FD\
|
---|
107 | -Fo$(obj)\
|
---|
108 | $(subst /,\\,$(call ABSPATH,$(source)))
|
---|
109 | $(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
|
---|
110 | endef
|
---|
111 | else
|
---|
112 | define TOOL_VCC70_COMPILE_C_CMDS
|
---|
113 | $(TOOL_VCC70_CC) -c\
|
---|
114 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
115 | -Fd$(outbase)-obj.pdb \
|
---|
116 | -Fo$(obj)\
|
---|
117 | $(subst /,\\,$(call ABSPATH,$(source)))
|
---|
118 | $(TOOL_VCC70_CC) -E\
|
---|
119 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
120 | $(subst /,\\,$(call ABSPATH,$(source)))\
|
---|
121 | | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
|
---|
122 | endef
|
---|
123 | endif
|
---|
124 |
|
---|
125 |
|
---|
126 | ## Compile C++ source.
|
---|
127 | # @param $(target) Normalized main target name.
|
---|
128 | # @param $(source) Source filename (relative).
|
---|
129 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
130 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
131 | # @param $(flags) Flags.
|
---|
132 | # @param $(defs) Definitions. No -D or something.
|
---|
133 | # @param $(incs) Includes. No -I or something.
|
---|
134 | # @param $(dirdep) Directory creation dependency.
|
---|
135 | # @param $(deps) Other dependencies.
|
---|
136 | #
|
---|
137 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
138 | # @param $(objsuff) Object suffix.
|
---|
139 | TOOL_VCC70_COMPILE_CXX_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb)
|
---|
140 | TOOL_VCC70_COMPILE_CXX_DEPEND =
|
---|
141 | TOOL_VCC70_COMPILE_CXX_DEPORD =
|
---|
142 | ifdef VCC70_NEW_DEPS
|
---|
143 | define TOOL_VCC70_COMPILE_CXX_CMDS
|
---|
144 | $(TOOL_VCC70_CXX) -c\
|
---|
145 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
146 | -Fd$(outbase)-obj.pdb \
|
---|
147 | -FD\
|
---|
148 | -Fo$(obj)\
|
---|
149 | $(subst /,\\,$(call ABSPATH,$(source)))
|
---|
150 | $(DEP_IDB) -f -s -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
|
---|
151 | endef
|
---|
152 | else
|
---|
153 | define TOOL_VCC70_COMPILE_CXX_CMDS
|
---|
154 | $(TOOL_VCC70_CXX) -c\
|
---|
155 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
156 | -Fd$(outbase)-obj.pdb \
|
---|
157 | -Fo$(obj)\
|
---|
158 | $(subst /,\\,$(call ABSPATH,$(source)))
|
---|
159 | $(TOOL_VCC70_CXX) -E\
|
---|
160 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
---|
161 | $(subst /,\\,$(call ABSPATH,$(source)))\
|
---|
162 | | $(DEP_PRE) -f -s -o $(dep) -t $(obj) -
|
---|
163 | endef
|
---|
164 | endif
|
---|
165 |
|
---|
166 |
|
---|
167 | ## Compile resource source.
|
---|
168 | # @param $(target) Normalized main target name.
|
---|
169 | # @param $(source) Source filename (relative).
|
---|
170 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
171 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
172 | # @param $(flags) Flags.
|
---|
173 | # @param $(defs) Definitions. No -D or something.
|
---|
174 | # @param $(incs) Includes. No -I or something.
|
---|
175 | # @param $(dirdep) Directory creation dependency.
|
---|
176 | # @param $(deps) Other dependencies.
|
---|
177 | #
|
---|
178 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
179 | # @param $(objsuff) Object suffix.
|
---|
180 | TOOL_VCC70_COMPILE_RC_OUTPUT =
|
---|
181 | TOOL_VCC70_COMPILE_RC_DEPEND =
|
---|
182 | TOOL_VCC70_COMPILE_RC_DEPORD =
|
---|
183 | define TOOL_VCC70_COMPILE_RC_CMDS
|
---|
184 | $(TOOL_VCC70_RC) \
|
---|
185 | $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
|
---|
186 | /fo$(obj)\
|
---|
187 | $(subst /,\\,$(call ABSPATH,$(source)))
|
---|
188 | endef
|
---|
189 |
|
---|
190 |
|
---|
191 | ## Link library
|
---|
192 | # @param $(target) Normalized main target name.
|
---|
193 | # @param $(out) Library name.
|
---|
194 | # @param $(objs) Object files to put in the library.
|
---|
195 | # @param $(flags) Flags.
|
---|
196 | # @param $(dirdep) Directory creation dependency.
|
---|
197 | # @param $(deps) Other dependencies.
|
---|
198 | # @param $(othersrc) Unhandled sources.
|
---|
199 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
200 | #
|
---|
201 | TOOL_VCC70_LINK_LIBRARY_OUTPUT = $(outbase).lst $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase),pdb) $(outbase).pdb
|
---|
202 | TOOL_VCC70_LINK_LIBRARY_DEPEND = $(othersrc)
|
---|
203 | TOOL_VCC70_LINK_LIBRARY_DEPORD =
|
---|
204 | define TOOL_VCC70_LINK_LIBRARY_CMDS
|
---|
205 | $(TOOL_VCC70_AR) $(flags) /OUT:$(out) $(subst /,\\,$(objs) $(filter %.a %.lib,$(othersrc))) \
|
---|
206 | $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def))
|
---|
207 | endef
|
---|
208 |
|
---|
209 |
|
---|
210 | ## Link program
|
---|
211 | # @param $(target) Normalized main target name.
|
---|
212 | # @param $(out) Program name.
|
---|
213 | # @param $(objs) Object files to link together.
|
---|
214 | # @param $(libs) Libraries to search.
|
---|
215 | # @param $(libpath) Library search paths.
|
---|
216 | # @param $(flags) Flags.
|
---|
217 | # @param $(dirdep) Directory creation dependency.
|
---|
218 | # @param $(deps) Other dependencies.
|
---|
219 | # @param $(othersrc) Unhandled sources.
|
---|
220 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
221 | # @param $(custom_post) Custom step invoked after linking.
|
---|
222 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
223 | #
|
---|
224 | TOOL_VCC70_LINK_PROGRAM_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase),pdb) $(outbase).pdb $(outbase).ilk
|
---|
225 | TOOL_VCC70_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
|
---|
226 | TOOL_VCC70_LINK_PROGRAM_DEPORD =
|
---|
227 | define TOOL_VCC70_LINK_PROGRAM_CMDS
|
---|
228 | $(TOOL_VCC70_LD) $(flags) \
|
---|
229 | /OUT:$(out) \
|
---|
230 | /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
|
---|
231 | /MAP:$(outbase).map \
|
---|
232 | $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
|
---|
233 | $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
|
---|
234 | $(foreach p,$(libpath), /LIBPATH:$(p)) \
|
---|
235 | $(subst /,\\,$(objs)) \
|
---|
236 | $(subst /,\\,$(libs))
|
---|
237 | endef
|
---|
238 |
|
---|
239 |
|
---|
240 | ## Link DLL.
|
---|
241 | # @param $(target) Normalized main target name.
|
---|
242 | # @param $(out) DLL name.
|
---|
243 | # @param $(objs) Object files to link together.
|
---|
244 | # @param $(libs) Libraries to search.
|
---|
245 | # @param $(libpath) Library search paths.
|
---|
246 | # @param $(flags) Flags.
|
---|
247 | # @param $(dirdep) Directory creation dependency.
|
---|
248 | # @param $(deps) Other dependencies.
|
---|
249 | # @param $(othersrc) Unhandled sources.
|
---|
250 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
251 | # @param $(custom_post) Custom step invoked after linking.
|
---|
252 | #
|
---|
253 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
254 | TOOL_VCC70_LINK_DLL_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase),pdb) $(outbase).pdb $(outbase).ilk
|
---|
255 | TOOL_VCC70_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
|
---|
256 | TOOL_VCC70_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_LIB))
|
---|
257 | define TOOL_VCC70_LINK_DLL_CMDS
|
---|
258 | $(TOOL_VCC70_LD) $(flags) \
|
---|
259 | /OUT:$(out) \
|
---|
260 | /IMPLIB:$(outbase).lib \
|
---|
261 | /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
|
---|
262 | /MAP:$(outbase).map \
|
---|
263 | /DLL \
|
---|
264 | $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
|
---|
265 | $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
|
---|
266 | $(foreach p,$(libpath), /LIBPATH:$(p)) \
|
---|
267 | $(subst /,\\,$(objs)) \
|
---|
268 | $(subst /,\\,$(libs))
|
---|
269 | ifeq ($(filter %.exp .def,$(othersrc)),)
|
---|
270 | if test -f $(outbase).exp; then $(CP_EXT) $(outbase).exp $(PATH_LIB)/; fi
|
---|
271 | if test -f $(outbase).lib; then $(CP_EXT) $(outbase).lib $(PATH_LIB)/; fi
|
---|
272 | endif
|
---|
273 | $(eval _DIRS += $(PATH_LIB))
|
---|
274 | endef
|
---|
275 |
|
---|
276 |
|
---|
277 | ## Link system module (windows aka driver, linux aka kernel module)
|
---|
278 | # @param $(target) Normalized main target name.
|
---|
279 | # @param $(out) System module name.
|
---|
280 | # @param $(objs) Object files to link together.
|
---|
281 | # @param $(libs) Libraries to search.
|
---|
282 | # @param $(libpath) Library search paths.
|
---|
283 | # @param $(flags) Flags.
|
---|
284 | # @param $(dirdep) Directory creation dependency.
|
---|
285 | # @param $(deps) Other dependencies.
|
---|
286 | # @param $(othersrc) Unhandled sources.
|
---|
287 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
288 | # @param $(custom_post) Custom step invoked after linking.
|
---|
289 | #
|
---|
290 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
291 | TOOL_VCC70_LINK_SYSMOD_OUTPUT = $(outbase).map $(outbase).lib $(outbase).exp $(call TOOL_VCC70_PDB, $(outbase),pdb) $(outbase).pdb $(outbase).ilk
|
---|
292 | TOOL_VCC70_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
|
---|
293 | TOOL_VCC70_LINK_SYSMOD_DEPORD =
|
---|
294 | define TOOL_VCC70_LINK_SYSMOD_CMDS
|
---|
295 | $(TOOL_VCC70_LD) $(flags) \
|
---|
296 | /OUT:$(out) \
|
---|
297 | /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
|
---|
298 | /MAP:$(outbase).map \
|
---|
299 | $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
|
---|
300 | $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
|
---|
301 | $(foreach p,$(libpath), /LIBPATH:$(p)) \
|
---|
302 | $(subst /,\\,$(objs)) \
|
---|
303 | $(subst /,\\,$(libs))
|
---|
304 | endef
|
---|
305 |
|
---|