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

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

VCC80 and some VCC70 link fixes.

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