source: trunk/kBuild/tools/VCC70.kmk

Last change on this file 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
RevLine 
[80]1# $Id: VCC70.kmk 3303 2020-01-14 15:09:44Z bird $
2## @file
[667]3# kBuild Tool Config - Visual C++ 7.0 (aka Visual Studio .NET), targeting x86.
[80]4#
[1547]5
6#
[3121]7# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
[80]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#
[1547]26# As a special exception you are granted permission to include this file, via
[2182]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.
[1547]29# This exception does not however invalidate any other reasons why the makefile,
30# program, whatever should not be covered the GPL.
31#
32#
[768]33
[667]34TOOL_VCC70 := Visual C++ 7.0 (aka Visual Studio .NET), targeting x86.
[80]35
[667]36# Tool Specific Properties
[448]37ifndef PATH_TOOL_VCC70
[692]38 PATH_TOOL_VCC70 := $(firstword $(wildcard \
[2726]39 $(KBUILD_DEVTOOLS)/win.x86/vcc/v7 \
40 $(KBUILD_DEVTOOLS)/x86.win32/vcc/v7 \
41 $(KBUILD_DEVTOOLS)/x86.win32/vcc70) )
[677]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)
[448]46endif
[677]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
[735]69## Disabled fast DEP_IDB based dependencies.
[768]70#VCC70_OLD_DEPS = 1
[80]71
[313]72## Constructs the correct .pdb name (the name is lowercased).
73# @param $(1) Base name, no extention.
[391]74# @param $(2) The extension.
[667]75TOOL_VCC70_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
[80]76
[667]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 ?=
[313]85
[667]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 ?=
[397]93
[667]94TOOL_VCC70_ASOBJSUFF ?= .obj
[397]95
[667]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
[80]107## Compile C source.
108# @param $(target) Normalized main target name.
109# @param $(source) Source filename (relative).
[235]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.
[80]112# @param $(flags) Flags.
113# @param $(defs) Definitions. No -D or something.
114# @param $(incs) Includes. No -I or something.
[235]115# @param $(dirdep) Directory creation dependency.
116# @param $(deps) Other dependencies.
[80]117#
118# @param $(outbase) Output basename (full). Use this for list files and such.
[235]119# @param $(objsuff) Object suffix.
[1011]120TOOL_VCC70_COMPILE_C_DONT_PURGE_OUTPUT =
121TOOL_VCC70_COMPILE_C_DEPEND =
122TOOL_VCC70_COMPILE_C_DEPORD =
[1418]123#ifdef KBUILD_USE_KOBJCACHE
[1057]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)
[2182]138# $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
[1057]139#endef
[1418]140#else # !KBUILD_USE_KOBJCACHE
[1129]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)
[391]143define TOOL_VCC70_COMPILE_C_CMDS
[696]144 $(QUIET)$(TOOL_VCC70_CC) -c\
[391]145 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
146 -Fd$(outbase)-obj.pdb \
[1006]147 -FD\
[391]148 -Fo$(obj)\
[697]149 $(subst /,\\,$(abspath $(source)))
[2237]150 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
[80]151endef
[1418]152#endif # !KBUILD_USE_KOBJCACHE
[80]153
154
155## Compile C++ source.
156# @param $(target) Normalized main target name.
157# @param $(source) Source filename (relative).
[235]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.
[80]160# @param $(flags) Flags.
161# @param $(defs) Definitions. No -D or something.
162# @param $(incs) Includes. No -I or something.
[235]163# @param $(dirdep) Directory creation dependency.
164# @param $(deps) Other dependencies.
[80]165#
166# @param $(outbase) Output basename (full). Use this for list files and such.
[235]167# @param $(objsuff) Object suffix.
[1011]168TOOL_VCC70_COMPILE_CXX_DONT_PURGE_OUTPUT =
169TOOL_VCC70_COMPILE_CXX_DEPEND =
170TOOL_VCC70_COMPILE_CXX_DEPORD =
[1418]171#ifdef KBUILD_USE_KOBJCACHE
[1057]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)
[2182]186# $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
[1057]187#endef
[1418]188#else # !KBUILD_USE_KOBJCACHE
[1129]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)
[391]191define TOOL_VCC70_COMPILE_CXX_CMDS
[696]192 $(QUIET)$(TOOL_VCC70_CXX) -c\
[391]193 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
194 -Fd$(outbase)-obj.pdb \
[1006]195 -FD\
[391]196 -Fo$(obj)\
[697]197 $(subst /,\\,$(abspath $(source)))
[2237]198 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC70_PDB,$(outbase)-obj,idb)
[80]199endef
[1418]200#endif # !KBUILD_USE_KOBJCACHE
[80]201
202
[641]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
[696]220 $(QUIET)$(TOOL_VCC70_RC) \
[641]221 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
222 /fo$(obj)\
[697]223 $(subst /,\\,$(abspath $(source)))
[641]224endef
225
226
[80]227## Link library
228# @param $(target) Normalized main target name.
[380]229# @param $(out) Library name.
[80]230# @param $(objs) Object files to put in the library.
231# @param $(flags) Flags.
[235]232# @param $(dirdep) Directory creation dependency.
[380]233# @param $(deps) Other dependencies.
[235]234# @param $(othersrc) Unhandled sources.
[380]235# @param $(outbase) Output basename (full). Use this for list files and such.
[80]236#
[380]237TOOL_VCC70_LINK_LIBRARY_DEPEND = $(othersrc)
238TOOL_VCC70_LINK_LIBRARY_DEPORD =
[1057]239TOOL_VCC70_LINK_LIBRARY_OUTPUT = $(outbase).rsp
240TOOL_VCC70_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
[380]241define TOOL_VCC70_LINK_LIBRARY_CMDS
[2557]242 $(QUIET)$(APPEND) -tn $(outbase).rsp \
[768]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
[80]250
251
252## Link program
[235]253# @param $(target) Normalized main target name.
[353]254# @param $(out) Program name.
[235]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.
[380]264# @param $(outbase) Output basename (full). Use this for list files and such.
[80]265#
[3303]266TOOL_VCC70_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk
267TOOL_VCC70_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
[2524]268TOOL_VCC70_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
269TOOL_VCC70_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
[380]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
[2557]273 $(QUIET)$(APPEND) -tn $(outbase).rsp \
274 $(foreach arg,\
275 $(subst /,\\,$(objs)) \
276 $(subst /,\\,$(libs)) \
277 ,\"$(arg)\")
[696]278 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
[353]279 /OUT:$(out) \
[434]280 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
[129]281 /MAP:$(outbase).map \
[130]282 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
[162]283 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
[130]284 $(foreach p,$(libpath), /LIBPATH:$(p)) \
[2557]285 @$(outbase).rsp
[80]286endef
287
[83]288
[380]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.
[235]298# @param $(othersrc) Unhandled sources.
299# @param $(custom_pre) Custom step invoked before linking.
300# @param $(custom_post) Custom step invoked after linking.
[83]301#
302# @param $(outbase) Output basename (full). Use this for list files and such.
[3303]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
[2524]306TOOL_VCC70_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
307TOOL_VCC70_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
[380]308TOOL_VCC70_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
[2487]309TOOL_VCC70_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
[380]310define TOOL_VCC70_LINK_DLL_CMDS
[2557]311 $(QUIET)$(APPEND) -tn $(outbase).rsp \
312 $(foreach arg,\
313 $(subst /,\\,$(objs)) \
314 $(subst /,\\,$(libs)) \
315 ,\"$(arg)\")
[696]316 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
[353]317 /OUT:$(out) \
[380]318 /IMPLIB:$(outbase).lib \
[434]319 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
[129]320 /MAP:$(outbase).map \
[380]321 /DLL \
[130]322 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
[162]323 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
[130]324 $(foreach p,$(libpath), /LIBPATH:$(p)) \
[2557]325 @$(outbase).rsp
[2487]326 $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
327$(eval _DIRS += $(PATH_STAGE_LIB))
[83]328endef
329
[130]330
[380]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.
[353]340# @param $(othersrc) Unhandled sources.
[235]341# @param $(custom_pre) Custom step invoked before linking.
342# @param $(custom_post) Custom step invoked after linking.
[130]343#
344# @param $(outbase) Output basename (full). Use this for list files and such.
[2524]345TOOL_VCC70_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk
[3303]346TOOL_VCC70_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
[2524]347TOOL_VCC70_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
348TOOL_VCC70_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
[380]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
[2557]352 $(QUIET)$(APPEND) -tn $(outbase).rsp \
353 $(foreach arg,\
354 $(subst /,\\,$(objs)) \
355 $(subst /,\\,$(libs)) \
356 ,\"$(arg)\")
[696]357 $(QUIET)$(TOOL_VCC70_LD) $(flags) \
[353]358 /OUT:$(out) \
[434]359 /MAPINFO:EXPORTS /INCREMENTAL:NO /MAPINFO:LINES \
[130]360 /MAP:$(outbase).map \
361 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
[162]362 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
[130]363 $(foreach p,$(libpath), /LIBPATH:$(p)) \
[2557]364 @$(outbase).rsp
[130]365endef
366
Note: See TracBrowser for help on using the repository browser.