source: trunk/kBuild/tools/VCC80AMD64.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.3 KB
RevLine 
[434]1# $Id: VCC80AMD64.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 AMD64.
[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
[2018]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_VCC80AMD64 := Visual C++ 8.0 (aka Visual .NET 2005, or MSC v14), targeting AMD64.
[434]35
[667]36# Tool Specific Properties
37ifndef PATH_TOOL_VCC80AMD64
[2726]38 PATH_TOOL_VCC80AMD64 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v8*)
[667]39 ifeq ($(PATH_TOOL_VCC80AMD64),)
[706]40 PATH_TOOL_VCC80AMD64 := $(PATH_TOOL_VCC80)
[667]41 endif
42 ifeq ($(PATH_TOOL_VCC80AMD64),)
[848]43 PATH_TOOL_VCC80AMD64 := $(PATH_TOOL_VCC80X86)
[706]44 endif
45 ifeq ($(PATH_TOOL_VCC80AMD64),)
[2726]46 PATH_TOOL_VCC80AMD64 := $(wildcard $(KBUILD_DEVTOOLS)/win.x86/vcc/v8*)
[667]47 endif
48 ifneq ($(PATH_TOOL_VCC80AMD64),)
[857]49 PATH_TOOL_VCC80AMD64 := $(lastword $(sort $(PATH_TOOL_VCC80AMD64)))
[667]50 else
51 $(warning kBuild: PATH_TOOL_VCC80AMD64 cannot be determined!)
[2726]52 PATH_TOOL_VCC80AMD64 := $(KBUILD_DEVTOOLS)/win.x86/vcc/v8
[667]53 endif
[434]54else
[667]55 # Resolve any fancy stuff once and for all.
56 PATH_TOOL_VCC80AMD64 := $(PATH_TOOL_VCC80AMD64)
[434]57endif
[1504]58ifeq ($(KBUILD_HOST).$(KBUILD_HOST_ARCH),win.amd64)
[669]59PATH_TOOL_VCC80AMD64_BIN ?= $(PATH_TOOL_VCC80AMD64)/bin/amd64
[667]60else
[669]61PATH_TOOL_VCC80AMD64_BIN ?= $(PATH_TOOL_VCC80AMD64)/bin/x86_amd64
[667]62endif
[669]63PATH_TOOL_VCC80AMD64_LIB ?= $(PATH_TOOL_VCC80AMD64)/lib/amd64
64PATH_TOOL_VCC80AMD64_INC ?= $(PATH_TOOL_VCC80AMD64)/include
[848]65PATH_TOOL_VCC80AMD64_ATLMFC ?= $(PATH_TOOL_VCC80AMD64)/atlmfc
[667]66PATH_TOOL_VCC80AMD64_ATLMFC_INC ?= $(PATH_TOOL_VCC80AMD64_ATLMFC)/include
[669]67PATH_TOOL_VCC80AMD64_ATLMFC_LIB ?= $(PATH_TOOL_VCC80AMD64_ATLMFC)/lib/amd64
[667]68TOOL_VCC80AMD64_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/cl.exe
69TOOL_VCC80AMD64_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/cl.exe
70TOOL_VCC80AMD64_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/ml64.exe
71TOOL_VCC80AMD64_RC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/../rc.exe
72TOOL_VCC80AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/lib.exe
73TOOL_VCC80AMD64_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/link.exe
74TOOL_VCC80AMD64_MT ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC80AMD64_BIN)/../mt.exe
[735]75## Disabled fast DEP_IDB based dependencies.
76#VCC80AMD64_OLD_DEPS = 1
[434]77
78## Constructs the correct .pdb name (the name is lowercased).
79# @param $(1) Base name, no extention.
80# @param $(2) The extension.
[667]81TOOL_VCC80AMD64_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
[434]82
[667]83TOOL_VCC80AMD64_COBJSUFF ?= .obj
84TOOL_VCC80AMD64_CFLAGS ?= -TC -c -nologo
85TOOL_VCC80AMD64_CFLAGS.debug ?= -Od -Zi
86TOOL_VCC80AMD64_CFLAGS.release ?= -O2
87TOOL_VCC80AMD64_CFLAGS.profile ?= -O2
88TOOL_VCC80AMD64_CINCS ?= $(PATH_TOOL_VCC80AMD64_INC)
89TOOL_VCC80AMD64_CDEFS ?=
[434]90
[667]91TOOL_VCC80AMD64_CXXOBJSUFF ?= .obj
92TOOL_VCC80AMD64_CXXFLAGS ?= -TP -c -nologo
93TOOL_VCC80AMD64_CXXFLAGS.debug ?= -Od -Zi
94TOOL_VCC80AMD64_CXXFLAGS.release ?= -O2
95TOOL_VCC80AMD64_CXXFLAGS.profile ?= -O2
96TOOL_VCC80AMD64_CXXINCS ?= $(PATH_TOOL_VCC80AMD64_INC) $(PATH_TOOL_VCC80AMD64_ATLMFC_INC)
97TOOL_VCC80AMD64_CXXDEFS ?=
[434]98
[667]99TOOL_VCC80AMD64_ASOBJSUFF ?= .obj
[434]100
[667]101TOOL_VCC80AMD64_RCOBJSUFF ?= .res
102TOOL_VCC80AMD64_RCINCS ?= $(PATH_TOOL_VCC80AMD64_INC) $(PATH_TOOL_VCC80AMD64_ATLMFC_INC)
103
104TOOL_VCC80AMD64_ARFLAGS ?= -nologo -machine:amd64
105TOOL_VCC80AMD64_ARLIBSUFF ?= .lib
106
107TOOL_VCC80AMD64_LDFLAGS ?= -nologo -machine:amd64
108TOOL_VCC80AMD64_LDFLAGS.debug ?= -debug
109TOOL_VCC80AMD64_LDFLAGS.release ?=
110
111
112
[434]113## Compile C source.
114# @param $(target) Normalized main target name.
115# @param $(source) Source filename (relative).
116# @param $(obj) Object file name. This shall be (re)created by the compilation.
117# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
118# @param $(flags) Flags.
119# @param $(defs) Definitions. No -D or something.
120# @param $(incs) Includes. No -I or something.
121# @param $(dirdep) Directory creation dependency.
122# @param $(deps) Other dependencies.
123#
124# @param $(outbase) Output basename (full). Use this for list files and such.
125# @param $(objsuff) Object suffix.
[667]126TOOL_VCC80AMD64_COMPILE_C_DEPEND =
[434]127TOOL_VCC80AMD64_COMPILE_C_DEPORD =
[1129]128TOOL_VCC80AMD64_COMPILE_C_OUTPUT = $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,idb)
129TOOL_VCC80AMD64_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,pdb)
[434]130define TOOL_VCC80AMD64_COMPILE_C_CMDS
[696]131 $(QUIET)$(TOOL_VCC80AMD64_CC) -c\
[434]132 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
133 -Fd$(outbase)-obj.pdb \
134 -FD\
135 -Fo$(obj)\
[697]136 $(subst /,\\,$(abspath $(source)))
[2237]137 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC80AMD64_PDB,$(outbase)-obj,idb)
[434]138endef
139
140
141## Compile C++ source.
142# @param $(target) Normalized main target name.
143# @param $(source) Source filename (relative).
144# @param $(obj) Object file name. This shall be (re)created by the compilation.
145# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
146# @param $(flags) Flags.
147# @param $(defs) Definitions. No -D or something.
148# @param $(incs) Includes. No -I or something.
149# @param $(dirdep) Directory creation dependency.
150# @param $(deps) Other dependencies.
151#
152# @param $(outbase) Output basename (full). Use this for list files and such.
153# @param $(objsuff) Object suffix.
154TOOL_VCC80AMD64_COMPILE_CXX_DEPEND =
155TOOL_VCC80AMD64_COMPILE_CXX_DEPORD =
[1129]156TOOL_VCC80AMD64_COMPILE_CXX_OUTPUT = $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,idb)
157TOOL_VCC80AMD64_COMPILE_CXX_OUTPUT_MAYBE = $(call TOOL_VCC80AMD64_PDB, $(outbase)-obj,pdb)
[434]158define TOOL_VCC80AMD64_COMPILE_CXX_CMDS
[696]159 $(QUIET)$(TOOL_VCC80AMD64_CXX) -c\
[434]160 $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
161 -Fd$(outbase)-obj.pdb \
162 -FD\
163 -Fo$(obj)\
[697]164 $(subst /,\\,$(abspath $(source)))
[2237]165 $(QUIET)$(DEP_IDB) -f -s -q -o $(dep) -t $(obj) $(call TOOL_VCC80AMD64_PDB,$(outbase)-obj,idb)
[434]166endef
167
168
[641]169## Compile resource source.
170# @param $(target) Normalized main target name.
171# @param $(source) Source filename (relative).
172# @param $(obj) Object file name. This shall be (re)created by the compilation.
173# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
174# @param $(flags) Flags.
175# @param $(defs) Definitions. No -D or something.
176# @param $(incs) Includes. No -I or something.
177# @param $(dirdep) Directory creation dependency.
178# @param $(deps) Other dependencies.
179#
180# @param $(outbase) Output basename (full). Use this for list files and such.
181# @param $(objsuff) Object suffix.
182TOOL_VCC80AMD64_COMPILE_RC_DEPEND =
183TOOL_VCC80AMD64_COMPILE_RC_DEPORD =
[1031]184TOOL_VCC80AMD64_COMPILE_RC_OUTPUT =
[641]185define TOOL_VCC80AMD64_COMPILE_RC_CMDS
[696]186 $(QUIET)$(TOOL_VCC80AMD64_RC) \
[641]187 $(flags) $(addprefix /i, $(subst /,\\,$(incs))) $(addprefix /d, $(defs))\
188 /fo$(obj)\
[697]189 $(subst /,\\,$(abspath $(source)))
[641]190endef
191
192
[434]193## Link library
194# @param $(target) Normalized main target name.
195# @param $(out) Library name.
196# @param $(objs) Object files to put in the library.
197# @param $(flags) Flags.
198# @param $(dirdep) Directory creation dependency.
199# @param $(deps) Other dependencies.
200# @param $(othersrc) Unhandled sources.
201# @param $(outbase) Output basename (full). Use this for list files and such.
202#
203TOOL_VCC80AMD64_LINK_LIBRARY_DEPEND = $(othersrc)
204TOOL_VCC80AMD64_LINK_LIBRARY_DEPORD =
[1031]205TOOL_VCC80AMD64_LINK_LIBRARY_OUTPUT = $(outbase).rsp
206TOOL_VCC80AMD64_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
[434]207define TOOL_VCC80AMD64_LINK_LIBRARY_CMDS
[2557]208 $(QUIET)$(APPEND) -tn $(outbase).rsp \
[768]209 $(foreach arg,\
210 $(subst /,\\,$(objs) \
211 $(filter-out %.def,$(othersrc))) \
212 $(addprefix /DEF:,$(filter %.def,$(othersrc))) \
213 ,\"$(arg)\")
214 $(QUIET)$(TOOL_VCC80AMD64_AR) $(flags) /OUT:$(out) @$(outbase).rsp
215endef
[434]216
217
218## Link program
219# @param $(target) Normalized main target name.
220# @param $(out) Program name.
221# @param $(objs) Object files to link together.
222# @param $(libs) Libraries to search.
223# @param $(libpath) Library search paths.
224# @param $(flags) Flags.
225# @param $(dirdep) Directory creation dependency.
226# @param $(deps) Other dependencies.
227# @param $(othersrc) Unhandled sources.
228# @param $(custom_pre) Custom step invoked before linking.
229# @param $(custom_post) Custom step invoked after linking.
230# @param $(outbase) Output basename (full). Use this for list files and such.
231#
232TOOL_VCC80AMD64_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
233TOOL_VCC80AMD64_LINK_PROGRAM_DEPORD =
[2524]234TOOL_VCC80AMD64_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
[3303]235TOOL_VCC80AMD64_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
[2524]236TOOL_VCC80AMD64_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
237TOOL_VCC80AMD64_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
[434]238define TOOL_VCC80AMD64_LINK_PROGRAM_CMDS
[2557]239 $(QUIET)$(APPEND) -tn $(outbase).rsp \
240 $(foreach arg,\
241 $(subst /,\\,$(objs)) \
242 $(subst /,\\,$(libs)) \
243 ,\"$(arg)\")
[696]244 $(QUIET)$(TOOL_VCC80AMD64_LD) $(flags) \
[434]245 /OUT:$(out) \
[437]246 /MAPINFO:EXPORTS /INCREMENTAL:NO \
[434]247 /MAP:$(outbase).map \
248 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
249 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
250 $(foreach p,$(libpath), /LIBPATH:$(p)) \
[2557]251 @$(outbase).rsp
[1295]252 $(QUIET)$(TEST) -f $(out).manifest -- \
253 $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
[434]254endef
255
256
257## Link DLL.
258# @param $(target) Normalized main target name.
259# @param $(out) DLL name.
260# @param $(objs) Object files to link together.
261# @param $(libs) Libraries to search.
262# @param $(libpath) Library search paths.
263# @param $(flags) Flags.
264# @param $(dirdep) Directory creation dependency.
265# @param $(deps) Other dependencies.
266# @param $(othersrc) Unhandled sources.
267# @param $(custom_pre) Custom step invoked before linking.
268# @param $(custom_post) Custom step invoked after linking.
269#
270# @param $(outbase) Output basename (full). Use this for list files and such.
271TOOL_VCC80AMD64_LINK_DLL_DEPEND = $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
[2487]272TOOL_VCC80AMD64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
[3303]273TOOL_VCC80AMD64_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
274TOOL_VCC80AMD64_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest
275TOOL_VCC80AMD64_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
[2524]276TOOL_VCC80AMD64_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
277TOOL_VCC80AMD64_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
[434]278define TOOL_VCC80AMD64_LINK_DLL_CMDS
[2557]279 $(QUIET)$(APPEND) -tn $(outbase).rsp \
280 $(foreach arg,\
281 $(subst /,\\,$(objs)) \
282 $(subst /,\\,$(libs)) \
283 ,\"$(arg)\")
[696]284 $(QUIET)$(TOOL_VCC80AMD64_LD) $(flags) \
[434]285 /OUT:$(out) \
286 /IMPLIB:$(outbase).lib \
[437]287 /MAPINFO:EXPORTS /INCREMENTAL:NO \
[434]288 /MAP:$(outbase).map \
289 /DLL \
290 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
291 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
292 $(foreach p,$(libpath), /LIBPATH:$(p)) \
[2557]293 @$(outbase).rsp
[1295]294 $(QUIET)$(TEST) -f $(out).manifest -- \
[1312]295 $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
[2487]296 $(QUIET)$(CP) --changed --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
297$(eval _DIRS += $(PATH_STAGE_LIB))
[434]298endef
299
300
301## Link system module (windows aka driver, linux aka kernel module)
302# @param $(target) Normalized main target name.
303# @param $(out) System module name.
304# @param $(objs) Object files to link together.
305# @param $(libs) Libraries to search.
306# @param $(libpath) Library search paths.
307# @param $(flags) Flags.
308# @param $(dirdep) Directory creation dependency.
309# @param $(deps) Other dependencies.
310# @param $(othersrc) Unhandled sources.
311# @param $(custom_pre) Custom step invoked before linking.
312# @param $(custom_post) Custom step invoked after linking.
313#
314# @param $(outbase) Output basename (full). Use this for list files and such.
315TOOL_VCC80AMD64_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
316TOOL_VCC80AMD64_LINK_SYSMOD_DEPORD =
[2524]317TOOL_VCC80AMD64_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
[3303]318TOOL_VCC80AMD64_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
[2524]319TOOL_VCC80AMD64_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
320TOOL_VCC80AMD64_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
[434]321define TOOL_VCC80AMD64_LINK_SYSMOD_CMDS
[2557]322 $(QUIET)$(APPEND) -tn $(outbase).rsp \
323 $(foreach arg,\
324 $(subst /,\\,$(objs)) \
325 $(subst /,\\,$(libs)) \
326 ,\"$(arg)\")
[696]327 $(QUIET)$(TOOL_VCC80AMD64_LD) $(flags) \
[434]328 /OUT:$(out) \
[437]329 /MAPINFO:EXPORTS /INCREMENTAL:NO \
[434]330 /MAP:$(outbase).map \
331 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
332 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
333 $(foreach p,$(libpath), /LIBPATH:$(p)) \
[2557]334 @$(outbase).rsp
[1295]335 $(QUIET)$(TEST) -f $(out).manifest -- \
[1312]336 $(TOOL_VCC80AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
[434]337endef
338
Note: See TracBrowser for help on using the repository browser.