source: trunk/kBuild/tools/VCC80X86.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.1 KB
RevLine 
[434]1# $Id: VCC80X86.kmk 3303 2020-01-14 15:09:44Z bird $
2## @file
[667]3# kBuild Tool Config - Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting x86.
[434]4#
[1547]5
6#
[3121]7# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
[434]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#
[434]33
[667]34TOOL_VCC80X86 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting x86.
[434]35
[667]36# Tool Specific Properties
37ifndef PATH_TOOL_VCC80X86
[2726]38 PATH_TOOL_VCC80X86 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v8*)
[667]39 ifeq ($(PATH_TOOL_VCC80X86),)
[706]40 PATH_TOOL_VCC80X86 := $(PATH_TOOL_VCC80)
41 endif
42 ifeq ($(PATH_TOOL_VCC80X86),)
[857]43 PATH_TOOL_VCC80X86 := $(PATH_TOOL_VCC80AMD64)
[667]44 endif
[706]45 ifeq ($(PATH_TOOL_VCC80X86),)
[2726]46 PATH_TOOL_VCC80X86 := $(wildcard $(KBUILD_DEVTOOLS)/x86.win32/vcc/v8*)
[706]47 endif
[857]48 ifeq ($(PATH_TOOL_VCC80X86),)
[2726]49 PATH_TOOL_VCC80X86 := $(wildcard $(KBUILD_DEVTOOLS)/win.amd64/vcc/v8*)
[857]50 endif
[667]51 ifneq ($(PATH_TOOL_VCC80X86),)
[857]52 PATH_TOOL_VCC80X86 := $(lastword $(sort $(PATH_TOOL_VCC80X86)))
[667]53 else
54 $(warning kBuild: PATH_TOOL_VCC80X86 cannot be determined!)
[2726]55 PATH_TOOL_VCC80X86 := $(KBUILD_DEVTOOLS)/x86.win/vcc/v8
[667]56 endif
57else
58 # Resolve any fancy stuff once and for all.
59 PATH_TOOL_VCC80X86 := $(PATH_TOOL_VCC80X86)
60endif
61PATH_TOOL_VCC80X86_BIN ?= $(PATH_TOOL_VCC80X86)/bin
62PATH_TOOL_VCC80X86_LIB ?= $(PATH_TOOL_VCC80X86)/lib
63PATH_TOOL_VCC80X86_INC ?= $(PATH_TOOL_VCC80X86)/include
64PATH_TOOL_VCC80X86_ATLMFC ?= $(PATH_TOOL_VCC80X86)/atlmfc
65PATH_TOOL_VCC80X86_ATLMFC_INC ?= $(PATH_TOOL_VCC80X86_ATLMFC)/include
66PATH_TOOL_VCC80X86_ATLMFC_LIB ?= $(PATH_TOOL_VCC80X86_ATLMFC)/lib
67TOOL_VCC80X86_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/cl.exe
68TOOL_VCC80X86_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/cl.exe
69TOOL_VCC80X86_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/ml.exe
70TOOL_VCC80X86_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/rc.exe
71TOOL_VCC80X86_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/lib.exe
72TOOL_VCC80X86_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/link.exe
73TOOL_VCC80X86_MT ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80X86_BIN)/mt.exe
[735]74## Disabled fast DEP_IDB based dependencies.
[768]75#VCC80X86_OLD_DEPS = 1
[434]76
77## Constructs the correct .pdb name (the name is lowercased).
78# @param $(1) Base name, no extention.
79# @param $(2) The extension.
[1354]80TOOL_VCC80X86_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
[434]81
[437]82
[667]83# General Properties used by kBuild
84TOOL_VCC80X86_COBJSUFF ?= .obj
85TOOL_VCC80X86_CFLAGS ?= -TC -c -nologo
86TOOL_VCC80X86_CFLAGS.debug ?= -Zi
87TOOL_VCC80X86_CFLAGS.release ?= -O2
88TOOL_VCC80X86_CFLAGS.profile ?= -O2
89TOOL_VCC80X86_CINCS ?= $(PATH_TOOL_VCC80X86_INC)
90TOOL_VCC80X86_CDEFS ?=
[434]91
[667]92TOOL_VCC80X86_CXXOBJSUFF ?= .obj
93TOOL_VCC80X86_CXXFLAGS ?= -TP -c -nologo
94TOOL_VCC80X86_CXXFLAGS.debug ?= -Zi
95TOOL_VCC80X86_CXXFLAGS.release ?= -O2
96TOOL_VCC80X86_CXXFLAGS.profile ?= -O2
97TOOL_VCC80X86_CXXINCS ?= $(PATH_TOOL_VCC80X86_INC) $(PATH_TOOL_VCC80X86_ATLMFC_INC)
98TOOL_VCC80X86_CXXDEFS ?=
[434]99
[667]100TOOL_VCC80X86_ASOBJSUFF ?= .obj
[434]101
[667]102TOOL_VCC80X86_RCOBJSUFF ?= .res
103TOOL_VCC80X86_RCINCS ?= $(PATH_TOOL_VCC80X86_INC) $(PATH_TOOL_VCC80X86_ATLMFC_INC)
104
105TOOL_VCC80X86_ARFLAGS ?= -nologo
106TOOL_VCC80X86_ARLIBSUFF ?= .lib
107
108TOOL_VCC80X86_LDFLAGS ?= -nologo -machine:x86
109TOOL_VCC80X86_LDFLAGS.debug ?= -debug
110TOOL_VCC80X86_LDFLAGS.release ?=
111
112
113
[434]114## Compile C source.
115# @param $(target) Normalized main target name.
116# @param $(source) Source filename (relative).
117# @param $(obj) Object file name. This shall be (re)created by the compilation.
118# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
119# @param $(flags) Flags.
120# @param $(defs) Definitions. No -D or something.
121# @param $(incs) Includes. No -I or something.
122# @param $(dirdep) Directory creation dependency.
123# @param $(deps) Other dependencies.
124#
125# @param $(outbase) Output basename (full). Use this for list files and such.
126# @param $(objsuff) Object suffix.
[667]127TOOL_VCC80X86_COMPILE_C_DEPEND =
[434]128TOOL_VCC80X86_COMPILE_C_DEPORD =
[1129]129TOOL_VCC80X86_COMPILE_C_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
130TOOL_VCC80X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb)
[434]131define TOOL_VCC80X86_COMPILE_C_CMDS
[696]132 $(QUIET)$(TOOL_VCC80X86_CC) -c\
[434]133 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
134 -Fd$(outbase)-obj.pdb \
135 -FD\
136 -Fo$(obj)\
[697]137 $(subst /,\\,$(abspath $(source)))
[2237]138 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
[434]139endef
140
141
142## Compile C++ source.
143# @param $(target) Normalized main target name.
144# @param $(source) Source filename (relative).
145# @param $(obj) Object file name. This shall be (re)created by the compilation.
146# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
147# @param $(flags) Flags.
148# @param $(defs) Definitions. No -D or something.
149# @param $(incs) Includes. No -I or something.
150# @param $(dirdep) Directory creation dependency.
151# @param $(deps) Other dependencies.
152#
153# @param $(outbase) Output basename (full). Use this for list files and such.
154# @param $(objsuff) Object suffix.
155TOOL_VCC80X86_COMPILE_CXX_DEPEND =
156TOOL_VCC80X86_COMPILE_CXX_DEPORD =
[1129]157TOOL_VCC80X86_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,idb)
158TOOL_VCC80X86_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC80X86_PDB, $(outbase)-obj,pdb)
[434]159define TOOL_VCC80X86_COMPILE_CXX_CMDS
[696]160 $(QUIET)$(TOOL_VCC80X86_CXX) -c\
[434]161 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
162 -Fd$(outbase)-obj.pdb \
163 -FD\
164 -Fo$(obj)\
[697]165 $(subst /,\\,$(abspath $(source)))
[2237]166 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC80X86_PDB,$(outbase)-obj,idb)
[434]167endef
168
[667]169## @todo configure the assembler template.
[434]170
[641]171## Compile resource source.
172# @param $(target) Normalized main target name.
173# @param $(source) Source filename (relative).
174# @param $(obj) Object file name. This shall be (re)created by the compilation.
175# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
176# @param $(flags) Flags.
177# @param $(defs) Definitions. No -D or something.
178# @param $(incs) Includes. No -I or something.
179# @param $(dirdep) Directory creation dependency.
180# @param $(deps) Other dependencies.
181#
182# @param $(outbase) Output basename (full). Use this for list files and such.
183# @param $(objsuff) Object suffix.
184TOOL_VCC80X86_COMPILE_RC_DEPEND =
185TOOL_VCC80X86_COMPILE_RC_DEPORD =
[1031]186TOOL_VCC80X86_COMPILE_RC_OUTPUT =
[641]187define TOOL_VCC80X86_COMPILE_RC_CMDS
[696]188 $(QUIET)$(TOOL_VCC80X86_RC) \
[641]189 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
190 /fo$(obj)\
[697]191 $(subst /,\\,$(abspath $(source)))
[641]192endef
193
194
[434]195## Link library
196# @param $(target) Normalized main target name.
197# @param $(out) Library name.
198# @param $(objs) Object files to put in the library.
199# @param $(flags) Flags.
200# @param $(dirdep) Directory creation dependency.
201# @param $(deps) Other dependencies.
202# @param $(othersrc) Unhandled sources.
203# @param $(outbase) Output basename (full). Use this for list files and such.
204#
205TOOL_VCC80X86_LINK_LIBRARY_DEPEND = $(othersrc)
206TOOL_VCC80X86_LINK_LIBRARY_DEPORD =
[1031]207TOOL_VCC80X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
[2273]208TOOL_VCC80X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
[434]209define TOOL_VCC80X86_LINK_LIBRARY_CMDS
[2557]210 $(QUIET)$(APPEND) -tn $(outbase).rsp \
[768]211 $(foreach arg,\
212 $(subst /,\\,$(objs) \
213 $(filter-out %.def,$(othersrc))) \
214 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
215 ,\"$(arg)\")
216 $(QUIET)$(TOOL_VCC80X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
217endef
[434]218
219
220## Link program
221# @param $(target) Normalized main target name.
222# @param $(out) Program name.
223# @param $(objs) Object files to link together.
224# @param $(libs) Libraries to search.
225# @param $(libpath) Library search paths.
226# @param $(flags) Flags.
227# @param $(dirdep) Directory creation dependency.
228# @param $(deps) Other dependencies.
229# @param $(othersrc) Unhandled sources.
230# @param $(custom_pre) Custom step invoked before linking.
231# @param $(custom_post) Custom step invoked after linking.
232# @param $(outbase) Output basename (full). Use this for list files and such.
233#
234TOOL_VCC80X86_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
235TOOL_VCC80X86_LINK_PROGRAM_DEPORD =
[2524]236TOOL_VCC80X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
[3303]237TOOL_VCC80X86_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
[2524]238TOOL_VCC80X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
239TOOL_VCC80X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
[434]240define TOOL_VCC80X86_LINK_PROGRAM_CMDS
[2557]241 $(QUIET)$(APPEND) -tn $(outbase).rsp \
242 $(foreach arg,\
243 $(subst /,\\,$(objs)) \
244 $(subst /,\\,$(libs)) \
245 ,\"$(arg)\")
[696]246 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
[434]247 /OUT:$(out) \
[437]248 /MAPINFO:EXPORTS /INCREMENTAL:NO \
[434]249 /MAP:$(outbase).map \
250 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
251 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
252 $(foreach p,$(libpath), /LIBPATH:$(p)) \
[2557]253 @$(outbase).rsp
[1295]254 $(QUIET)$(TEST) -f $(out).manifest -- \
255 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
[434]256endef
257
258
259## Link DLL.
260# @param $(target) Normalized main target name.
261# @param $(out) DLL name.
262# @param $(objs) Object files to link together.
263# @param $(libs) Libraries to search.
264# @param $(libpath) Library search paths.
265# @param $(flags) Flags.
266# @param $(dirdep) Directory creation dependency.
267# @param $(deps) Other dependencies.
268# @param $(othersrc) Unhandled sources.
269# @param $(custom_pre) Custom step invoked before linking.
270# @param $(custom_post) Custom step invoked after linking.
271#
272# @param $(outbase) Output basename (full). Use this for list files and such.
273TOOL_VCC80X86_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
[2487]274TOOL_VCC80X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
[3303]275TOOL_VCC80X86_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
276TOOL_VCC80X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest
277TOOL_VCC80X86_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp $(outbase).map $(outbase).rsp
[2524]278TOOL_VCC80X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
279TOOL_VCC80X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
[434]280define TOOL_VCC80X86_LINK_DLL_CMDS
[2557]281 $(QUIET)$(APPEND) -tn $(outbase).rsp \
282 $(foreach arg,\
283 $(subst /,\\,$(objs)) \
284 $(subst /,\\,$(libs)) \
285 ,\"$(arg)\")
[696]286 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
[434]287 /OUT:$(out) \
288 /IMPLIB:$(outbase).lib \
[437]289 /MAPINFO:EXPORTS /INCREMENTAL:NO \
[434]290 /MAP:$(outbase).map \
291 /DLL \
292 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
293 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
294 $(foreach p,$(libpath), /LIBPATH:$(p)) \
[2557]295 @$(outbase).rsp
[1295]296 $(QUIET)$(TEST) -f $(out).manifest -- \
[1312]297 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
[2487]298 $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
299$(eval _DIRS += $(PATH_STAGE_LIB))
[434]300endef
301
302
303## Link system module (windows aka driver, linux aka kernel module)
304# @param $(target) Normalized main target name.
305# @param $(out) System module name.
306# @param $(objs) Object files to link together.
307# @param $(libs) Libraries to search.
308# @param $(libpath) Library search paths.
309# @param $(flags) Flags.
310# @param $(dirdep) Directory creation dependency.
311# @param $(deps) Other dependencies.
312# @param $(othersrc) Unhandled sources.
313# @param $(custom_pre) Custom step invoked before linking.
314# @param $(custom_post) Custom step invoked after linking.
315#
316# @param $(outbase) Output basename (full). Use this for list files and such.
317TOOL_VCC80X86_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
318TOOL_VCC80X86_LINK_SYSMOD_DEPORD =
[2524]319TOOL_VCC80X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
[3303]320TOOL_VCC80X86_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
[2524]321TOOL_VCC80X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
322TOOL_VCC80X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
[434]323define TOOL_VCC80X86_LINK_SYSMOD_CMDS
[2557]324 $(QUIET)$(APPEND) -tn $(outbase).rsp \
325 $(foreach arg,\
326 $(subst /,\\,$(objs)) \
327 $(subst /,\\,$(libs)) \
328 ,\"$(arg)\")
[696]329 $(QUIET)$(TOOL_VCC80X86_LD) $(flags) \
[434]330 /OUT:$(out) \
[437]331 /MAPINFO:EXPORTS /INCREMENTAL:NO \
[434]332 /MAP:$(outbase).map \
333 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
334 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
335 $(foreach p,$(libpath), /LIBPATH:$(p)) \
[2557]336 @$(outbase).rsp
[1295]337 $(QUIET)$(TEST) -f $(out).manifest -- \
[1312]338 $(TOOL_VCC80X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
[434]339endef
340
Note: See TracBrowser for help on using the repository browser.