source: trunk/kBuild/tools/VCC70.kmk@ 686

Last change on this file since 686 was 677, checked in by bird, 19 years ago

pathless VCC

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