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

Last change on this file since 3403 was 3303, checked in by bird, 6 years ago

VCC*.kmk,OPENWATCOM*.kmk: Try preserve .map and .rsp files so they can be inspected if linking fails. Fixed mssing .rsp cleaning up in OPENWATCOM.kmk for the archiver.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 14.6 KB
Line 
1# $Id: VCC70.kmk 3303 2020-01-14 15:09:44Z bird $
2## @file
3# kBuild Tool Config - Visual C++ 7.0 (aka Visual Studio .NET), targeting x86.
4#
5
6#
7# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
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# As a special exception you are granted permission to include this file, via
27# the kmk include directive, as you wish without this in itself causing the
28# resulting makefile, program or whatever to be covered by the GPL license.
29# This exception does not however invalidate any other reasons why the makefile,
30# program, whatever should not be covered the GPL.
31#
32#
33
34TOOL_VCC70 := Visual C++ 7.0 (aka Visual Studio .NET), targeting x86.
35
36# Tool Specific Properties
37ifndef PATH_TOOL_VCC70
38 PATH_TOOL_VCC70 := $(firstword $(wildcard \
39 $(KBUILD_DEVTOOLS)/win.x86/vcc/v7 \
40 $(KBUILD_DEVTOOLS)/x86.win32/vcc/v7 \
41 $(KBUILD_DEVTOOLS)/x86.win32/vcc70) )
42 # if not found, we'll enter 'pathless' mode.
43else
44 # Resolve any fancy stuff once and for all.
45 PATH_TOOL_VCC70 := $(PATH_TOOL_VCC70)
46endif
47ifneq ($(PATH_TOOL_VCC70),)
48 PATH_TOOL_VCC70_BIN ?= $(PATH_TOOL_VCC70)/bin
49 PATH_TOOL_VCC70_LIB ?= $(PATH_TOOL_VCC70)/lib
50 PATH_TOOL_VCC70_INC ?= $(PATH_TOOL_VCC70)/include
51 PATH_TOOL_VCC70_ATLMFC ?= $(PATH_TOOL_VCC70)/atlmfc
52 PATH_TOOL_VCC70_ATLMFC_INC ?= $(PATH_TOOL_VCC70_ATLMFC)/include
53 PATH_TOOL_VCC70_ATLMFC_LIB ?= $(PATH_TOOL_VCC70_ATLMFC)/lib
54 TOOL_VCC70_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/cl.exe
55 TOOL_VCC70_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/cl.exe
56 TOOL_VCC70_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/ml.exe
57 TOOL_VCC70_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/rc.exe
58 TOOL_VCC70_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/lib.exe
59 TOOL_VCC70_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC70_BIN)/link.exe
60else
61 # Pathless, relies on the environment.
62 TOOL_VCC70_CC ?= $(EXEC_X86_WIN32) cl.exe
63 TOOL_VCC70_CXX ?= $(EXEC_X86_WIN32) cl.exe
64 TOOL_VCC70_AS ?= $(EXEC_X86_WIN32) ml.exe
65 TOOL_VCC70_RC ?= $(EXEC_X86_WIN32) rc.exe
66 TOOL_VCC70_AR ?= $(EXEC_X86_WIN32) lib.exe
67 TOOL_VCC70_LD ?= $(EXEC_X86_WIN32) link.exe
68endif
69## Disabled fast DEP_IDB based dependencies.
70#VCC70_OLD_DEPS = 1
71
72## Constructs the correct .pdb name (the name is lowercased).
73# @param $(1) Base name, no extention.
74# @param $(2) The extension.
75TOOL_VCC70_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
76
77# General Properties used by kBuild
78TOOL_VCC70_COBJSUFF ?= .obj
79TOOL_VCC70_CFLAGS ?= -TC -c -nologo
80TOOL_VCC70_CFLAGS.debug ?= -Od -Zi
81TOOL_VCC70_CFLAGS.release ?= -O2
82TOOL_VCC70_CFLAGS.profile ?= -O2
83TOOL_VCC70_CINCS ?= $(PATH_TOOL_VCC70_INC)
84TOOL_VCC70_CDEFS ?=
85
86TOOL_VCC70_CXXOBJSUFF ?= .obj
87TOOL_VCC70_CXXFLAGS ?= -TP -c -nologo
88TOOL_VCC70_CXXFLAGS.debug ?= -Od -Zi
89TOOL_VCC70_CXXFLAGS.release ?= -O2
90TOOL_VCC70_CXXFLAGS.profile ?= -O2
91TOOL_VCC70_CXXINCS ?= $(PATH_TOOL_VCC70_INC) $(PATH_TOOL_VCC70_ATLMFC_INC)
92TOOL_VCC70_CXXDEFS ?=
93
94TOOL_VCC70_ASOBJSUFF ?= .obj
95
96TOOL_VCC70_RCOBJSUFF ?= .res
97TOOL_VCC70_RCINCS ?= $(PATH_TOOL_VCC70_INC) $(PATH_TOOL_VCC70_ATLMFC_INC)
98
99TOOL_VCC70_ARFLAGS ?= -nologo
100TOOL_VCC70_ARLIBSUFF ?= .lib
101
102TOOL_VCC70_LDFLAGS ?= -nologo
103TOOL_VCC70_LDFLAGS.debug ?= -debug
104TOOL_VCC70_LDFLAGS.release ?=
105
106
107## Compile C source.
108# @param $(target) Normalized main target name.
109# @param $(source) Source filename (relative).
110# @param $(obj) Object file name. This shall be (re)created by the compilation.
111# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
112# @param $(flags) Flags.
113# @param $(defs) Definitions. No -D or something.
114# @param $(incs) Includes. No -I or something.
115# @param $(dirdep) Directory creation dependency.
116# @param $(deps) Other dependencies.
117#
118# @param $(outbase) Output basename (full). Use this for list files and such.
119# @param $(objsuff) Object suffix.
120TOOL_VCC70_COMPILE_C_DONT_PURGE_OUTPUT =
121TOOL_VCC70_COMPILE_C_DEPEND =
122TOOL_VCC70_COMPILE_C_DEPORD =
123#ifdef KBUILD_USE_KOBJCACHE
124#TOOL_VCC70_COMPILE_C_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb) $(outbase).i
125#TOOL_VCC70_COMPILE_C_USESES_KOBJCACHE = 1
126#define TOOL_VCC70_COMPILE_C_CMDS
127# $(QUIET)$(KOBJCACHE) -f $(outbase).koc -r --kObjCache-cpp $(outbase).i \
128# $(TOOL_VCC70_CC) -E \
129# $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
130# $(subst /,\\,$(abspath $(source))) \
131# --kObjCache-cc $(obj) \
132# $(TOOL_VCC70_CC) -c -TC\
133# $(flags) \
134# -Fd$(outbase)-obj.pdb \
135# -FD\
136# -Fo$(obj)\
137# $(subst /,\\,$(outbase).i)
138# $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
139#endef
140#else # !KBUILD_USE_KOBJCACHE
141TOOL_VCC70_COMPILE_C_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,idb)
142TOOL_VCC70_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb)
143define TOOL_VCC70_COMPILE_C_CMDS
144 $(QUIET)$(TOOL_VCC70_CC) -c\
145 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
146 -Fd$(outbase)-obj.pdb \
147 -FD\
148 -Fo$(obj)\
149 $(subst /,\\,$(abspath $(source)))
150 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
151endef
152#endif # !KBUILD_USE_KOBJCACHE
153
154
155## Compile C++ source.
156# @param $(target) Normalized main target name.
157# @param $(source) Source filename (relative).
158# @param $(obj) Object file name. This shall be (re)created by the compilation.
159# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
160# @param $(flags) Flags.
161# @param $(defs) Definitions. No -D or something.
162# @param $(incs) Includes. No -I or something.
163# @param $(dirdep) Directory creation dependency.
164# @param $(deps) Other dependencies.
165#
166# @param $(outbase) Output basename (full). Use this for list files and such.
167# @param $(objsuff) Object suffix.
168TOOL_VCC70_COMPILE_CXX_DONT_PURGE_OUTPUT =
169TOOL_VCC70_COMPILE_CXX_DEPEND =
170TOOL_VCC70_COMPILE_CXX_DEPORD =
171#ifdef KBUILD_USE_KOBJCACHE
172#TOOL_VCC70_COMPILE_CXX_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC70_PDB, $(outbase)-obj,idb) $(outbase).ii
173#TOOL_VCC70_COMPILE_CXX_USES_KOBJCACHE = 1
174#define TOOL_VCC70_COMPILE_CXX_CMDS
175# $(QUIET)$(KOBJCACHE) -f $(outbase).koc -r --kObjCache-cpp $(outbase).ii \
176# $(TOOL_VCC70_CC) -E \
177# $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
178# $(subst /,\\,$(abspath $(source))) \
179# --kObjCache-cc $(obj) \
180# $(TOOL_VCC70_CC) -c -TP\
181# $(flags) \
182# -Fd$(outbase)-obj.pdb \
183# -FD\
184# -Fo$(obj)\
185# $(subst /,\\,$(outbase).ii)
186# $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
187#endef
188#else # !KBUILD_USE_KOBJCACHE
189TOOL_VCC70_COMPILE_CXX_OUTPUT = $(call TOOL_VCC70_PDB, $(outbase)-obj,idb)
190TOOL_VCC70_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC70_PDB, $(outbase)-obj,pdb)
191define TOOL_VCC70_COMPILE_CXX_CMDS
192 $(QUIET)$(TOOL_VCC70_CXX) -c\
193 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
194 -Fd$(outbase)-obj.pdb \
195 -FD\
196 -Fo$(obj)\
197 $(subst /,\\,$(abspath $(source)))
198 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
199endef
200#endif # !KBUILD_USE_KOBJCACHE
201
202
203## Compile resource source.
204# @param $(target) Normalized main target name.
205# @param $(source) Source filename (relative).
206# @param $(obj) Object file name. This shall be (re)created by the compilation.
207# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
208# @param $(flags) Flags.
209# @param $(defs) Definitions. No -D or something.
210# @param $(incs) Includes. No -I or something.
211# @param $(dirdep) Directory creation dependency.
212# @param $(deps) Other dependencies.
213#
214# @param $(outbase) Output basename (full). Use this for list files and such.
215# @param $(objsuff) Object suffix.
216TOOL_VCC70_COMPILE_RC_OUTPUT =
217TOOL_VCC70_COMPILE_RC_DEPEND =
218TOOL_VCC70_COMPILE_RC_DEPORD =
219define TOOL_VCC70_COMPILE_RC_CMDS
220 $(QUIET)$(TOOL_VCC70_RC) \
221 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
222 /fo$(obj)\
223 $(subst /,\\,$(abspath $(source)))
224endef
225
226
227## Link library
228# @param $(target) Normalized main target name.
229# @param $(out) Library name.
230# @param $(objs) Object files to put in the library.
231# @param $(flags) Flags.
232# @param $(dirdep) Directory creation dependency.
233# @param $(deps) Other dependencies.
234# @param $(othersrc) Unhandled sources.
235# @param $(outbase) Output basename (full). Use this for list files and such.
236#
237TOOL_VCC70_LINK_LIBRARY_DEPEND = $(othersrc)
238TOOL_VCC70_LINK_LIBRARY_DEPORD =
239TOOL_VCC70_LINK_LIBRARY_OUTPUT = $(outbase).rsp
240TOOL_VCC70_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
241define TOOL_VCC70_LINK_LIBRARY_CMDS
242 $(QUIET)$(APPEND) -tn $(outbase).rsp \
243 $(foreach arg,\
244 $(subst /,\\,$(objs) \
245 $(filter-out %.def,$(othersrc))) \
246 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
247 ,\"$(arg)\")
248 $(QUIET)$(TOOL_VCC70_AR) $(flags) /OUT:$(out) @$(outbase).rsp
249endef
250
251
252## Link program
253# @param $(target) Normalized main target name.
254# @param $(out) Program name.
255# @param $(objs) Object files to link together.
256# @param $(libs) Libraries to search.
257# @param $(libpath) Library search paths.
258# @param $(flags) Flags.
259# @param $(dirdep) Directory creation dependency.
260# @param $(deps) Other dependencies.
261# @param $(othersrc) Unhandled sources.
262# @param $(custom_pre) Custom step invoked before linking.
263# @param $(custom_post) Custom step invoked after linking.
264# @param $(outbase) Output basename (full). Use this for list files and such.
265#
266TOOL_VCC70_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk
267TOOL_VCC70_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
268TOOL_VCC70_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
269TOOL_VCC70_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
270TOOL_VCC70_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
271TOOL_VCC70_LINK_PROGRAM_DEPORD =
272define TOOL_VCC70_LINK_PROGRAM_CMDS
273 $(QUIET)$(APPEND) -tn $(outbase).rsp \
274 $(foreach arg,\
275 $(subst /,\\,$(objs)) \
276 $(subst /,\\,$(libs)) \
277 ,\"$(arg)\")
278 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
279 /OUT:$(out) \
280 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
281 /MAP:$(outbase).map \
282 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
283 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
284 $(foreach p,$(libpath), /LIBPATH:$(p)) \
285 @$(outbase).rsp
286endef
287
288
289## Link DLL.
290# @param $(target) Normalized main target name.
291# @param $(out) DLL name.
292# @param $(objs) Object files to link together.
293# @param $(libs) Libraries to search.
294# @param $(libpath) Library search paths.
295# @param $(flags) Flags.
296# @param $(dirdep) Directory creation dependency.
297# @param $(deps) Other dependencies.
298# @param $(othersrc) Unhandled sources.
299# @param $(custom_pre) Custom step invoked before linking.
300# @param $(custom_post) Custom step invoked after linking.
301#
302# @param $(outbase) Output basename (full). Use this for list files and such.
303TOOL_VCC70_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
304TOOL_VCC70_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk
305TOOL_VCC70_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp $(outbase).map $(outbase).rsp
306TOOL_VCC70_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
307TOOL_VCC70_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
308TOOL_VCC70_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
309TOOL_VCC70_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
310define TOOL_VCC70_LINK_DLL_CMDS
311 $(QUIET)$(APPEND) -tn $(outbase).rsp \
312 $(foreach arg,\
313 $(subst /,\\,$(objs)) \
314 $(subst /,\\,$(libs)) \
315 ,\"$(arg)\")
316 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
317 /OUT:$(out) \
318 /IMPLIB:$(outbase).lib \
319 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
320 /MAP:$(outbase).map \
321 /DLL \
322 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
323 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
324 $(foreach p,$(libpath), /LIBPATH:$(p)) \
325 @$(outbase).rsp
326 $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
327$(eval _DIRS += $(PATH_STAGE_LIB))
328endef
329
330
331## Link system module (windows aka driver, linux aka kernel module)
332# @param $(target) Normalized main target name.
333# @param $(out) System module name.
334# @param $(objs) Object files to link together.
335# @param $(libs) Libraries to search.
336# @param $(libpath) Library search paths.
337# @param $(flags) Flags.
338# @param $(dirdep) Directory creation dependency.
339# @param $(deps) Other dependencies.
340# @param $(othersrc) Unhandled sources.
341# @param $(custom_pre) Custom step invoked before linking.
342# @param $(custom_post) Custom step invoked after linking.
343#
344# @param $(outbase) Output basename (full). Use this for list files and such.
345TOOL_VCC70_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk
346TOOL_VCC70_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
347TOOL_VCC70_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
348TOOL_VCC70_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
349TOOL_VCC70_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
350TOOL_VCC70_LINK_SYSMOD_DEPORD =
351define TOOL_VCC70_LINK_SYSMOD_CMDS
352 $(QUIET)$(APPEND) -tn $(outbase).rsp \
353 $(foreach arg,\
354 $(subst /,\\,$(objs)) \
355 $(subst /,\\,$(libs)) \
356 ,\"$(arg)\")
357 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
358 /OUT:$(out) \
359 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
360 /MAP:$(outbase).map \
361 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
362 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
363 $(foreach p,$(libpath), /LIBPATH:$(p)) \
364 @$(outbase).rsp
365endef
366
Note: See TracBrowser for help on using the repository browser.