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

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

Resource file compilation.

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