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

Last change on this file since 757 was 735, checked in by bird, 19 years ago

VCC*_OLD_DEPS

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