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

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

use ?= everywhere.

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