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

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

RCINCS.

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