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

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

Moving stuff about.

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