source: trunk/kBuild/tools/VCC140AMD64.kmk

Last change on this file was 3597, checked in by bird, 2 years ago

win-common.kmk,tools/VCC14[012]*.kmk,retry-10-delay-500ms.sh: Retry mt.exe operations as we sometimes run into a race with AV software when adding a manifest right after linking.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 20.5 KB
RevLine 
[434]1# $Id: VCC140AMD64.kmk 3597 2023-06-16 20:56:17Z bird $
2## @file
[3343]3# kBuild Tool Config - Visual C++ 14.0 (aka Visual 2015 and MSC v19.0x), targeting AMD64.
[434]4#
[1547]5
6#
[3323]7# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@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
[3343]34ifndef TOOL_VCC140
35 include $(KBUILD_PATH)/tools/VCC140.kmk
[3323]36endif
[434]37
[3343]38TOOL_VCC140AMD64 := Visual C++ 14.0 (aka Visual 2015 and MSC v19.0x), targeting AMD64
[3323]39
40#
[667]41# Tool Specific Properties
[3323]42#
[3343]43ifndef PATH_TOOL_VCC140AMD64_BIN
44 ifeq ($(KBUILD_HOST_ARCH),amd64)
45PATH_TOOL_VCC140AMD64_BIN := $(PATH_TOOL_VCC140_BASE_BIN)/amd64
46 else
47PATH_TOOL_VCC140AMD64_BIN := $(PATH_TOOL_VCC140_BASE_BIN)/x86_amd64
48 endif
[434]49else
[3343]50PATH_TOOL_VCC140AMD64_BIN := $(PATH_TOOL_VCC140AMD64_BIN)
[434]51endif
[3343]52PATH_TOOL_VCC140AMD64_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC140AMD64_BIN))
[3323]53
[3331]54# A bunch of DLLs are only in the subdir matching the host one, so we need to add it to the PATH when cross compiling.
[3343]55ifndef PATH_TOOL_VCC140AMD64_DLL_BIN
56 ifneq ($(PATH_TOOL_VCC140_HOST_DLL_BIN),$(PATH_TOOL_VCC140AMD64_BIN))
57PATH_TOOL_VCC140AMD64_DLL_BIN := $(PATH_TOOL_VCC140_HOST_DLL_BIN)
[3331]58 endif
59endif
60
[3343]61ifndef PATH_TOOL_VCC140AMD64_LIB
62PATH_TOOL_VCC140AMD64_LIB := $(PATH_TOOL_VCC140_LIB.amd64)
[3323]63endif
[3343]64ifndef PATH_TOOL_VCC140_ONECORE_LIB
65PATH_TOOL_VCC140_ONECORE_LIB := $(PATH_TOOL_VCC140_ONECORE_LIB.amd64)
[3323]66endif
67
[3343]68ifndef PATH_TOOL_VCC140AMD64_INC
69PATH_TOOL_VCC140AMD64_INC := $(PATH_TOOL_VCC140_INC)
[3323]70endif
71
[3343]72ifndef PATH_TOOL_VCC140AMD64_ATLMFC_INC
73PATH_TOOL_VCC140AMD64_ATLMFC_INC := $(PATH_TOOL_VCC140_ATLMFC_INC.amd64)
[3323]74endif
[3343]75ifndef PATH_TOOL_VCC140AMD64_ATLMFC_LIB
76PATH_TOOL_VCC140AMD64_ATLMFC_LIB := $(PATH_TOOL_VCC140_ATLMFC_LIB.amd64)
[3323]77endif
78
[3343]79TOOL_VCC140AMD64_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/cl.exe
80TOOL_VCC140AMD64_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/cl.exe
81TOOL_VCC140AMD64_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/ml64.exe
82#TOOL_VCC140AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/lib.exe - just an exec wrapper for the below
83TOOL_VCC140AMD64_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/link.exe /LIB
84TOOL_VCC140AMD64_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/link.exe
85TOOL_VCC140AMD64_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/dumpbin.exe
86TOOL_VCC140AMD64_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140AMD64_BIN_QSH)/editbin.exe
[3323]87
[3597]88TOOL_VCC140AMD64_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC140_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC140_RC_CACHED)
89TOOL_VCC140AMD64_MT ?= $(TOOL_VCC140AMD64_MT_RETRY) $(EXEC_X86_WIN32) $(call TOOL_VCC140_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC140_MT_CACHED)
90TOOL_VCC140AMD64_MT_RETRY ?= $(TOOL_VCC140_MT_RETRY)
[3323]91
[3343]92undefine TOOL_VCC140AMD64_USE_KSUBMIT # for now
93ifdef TOOL_VCC140AMD64_USE_KSUBMIT
[2870]94 ifeq ($(KBUILD_HOST),win)
[3343]95 ifneq ($(substr $(qdir un,$(PATH_TOOL_VCC140AMD64_BIN)),-3),64/)
96 TOOL_VCC140AMD64_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
[2870]97 else
[3343]98 TOOL_VCC140AMD64_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
[2870]99 endif
[3343]100 ifdef PATH_TOOL_VCC140AMD64_DLL_BIN
101 TOOL_VCC140AMD64_KSUBMIT := $(TOOL_VCC140AMD64_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC140AMD64_DLL_BIN));"
[3331]102 endif
[3343]103 TOOL_VCC140AMD64_KSUBMIT_DD := $(TOOL_VCC140AMD64_KSUBMIT) --
[2847]104 endif
105endif
[3343]106ifdef PATH_TOOL_VCC140AMD64_DLL_BIN
107 TOOL_VCC140AMD64_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC140AMD64_DLL_BIN));" --$(SP)
108 ifndef TOOL_VCC140AMD64_KSUBMIT_DD
109 TOOL_VCC140AMD64_KSUBMIT_DD := $(TOOL_VCC140AMD64_SETUP_ENV)
[3331]110 endif
111endif
[2604]112
[3343]113# Redist (more stuff in VCC140.kmk).
114PATH_TOOL_VCC140AMD64_REDIST ?= $(PATH_TOOL_VCC140_REDIST)/x64
115PATH_TOOL_VCC140AMD64_REDIST_CRT = $(PATH_TOOL_VCC140AMD64_REDIST)/$(TOOL_VCC140_REDIST_CRT_SUBDIR)
116PATH_TOOL_VCC140AMD64_REDIST_DEBUG ?= $(PATH_TOOL_VCC140_REDIST_DEBUG)/x64
[3592]117PATH_TOOL_VCC140AMD64_REDIST_DEBUG_CRT = $(PATH_TOOL_VCC140AMD64_REDIST_DEBUG)/$(TOOL_VCC140_REDIST_DEBUG_CRT_SUBDIR)
[3343]118TOOL_VCC140AMD64_REDIST_CRT_DLLS = $(TOOL_VCC140_REDIST_CRT_DLLS.amd64)
119TOOL_VCC140AMD64_REDIST_CONCRT_DLLS = $(TOOL_VCC140_REDIST_CONCRT_DLLS.amd64)
120TOOL_VCC140AMD64_REDIST_CPP_DLLS = $(TOOL_VCC140_REDIST_CPP_DLLS.amd64)
121TOOL_VCC140AMD64_REDIST_WINRT_DLLS = $(TOOL_VCC140_REDIST_WINRT_DLLS.amd64)
[2604]122
[3340]123
[3323]124#
125# Properties used by kBuild
126#
[3343]127TOOL_VCC140AMD64_COBJSUFF ?= .obj
128TOOL_VCC140AMD64_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
129TOOL_VCC140AMD64_CFLAGS.debug ?=
130TOOL_VCC140AMD64_CFLAGS.dbgopt ?= -O2
131TOOL_VCC140AMD64_CFLAGS.release ?= -O2
132TOOL_VCC140AMD64_CFLAGS.profile ?= -O2
133TOOL_VCC140AMD64_CINCS ?= $(PATH_TOOL_VCC140AMD64_INC)
134TOOL_VCC140AMD64_CDEFS ?=
[434]135
[3343]136TOOL_VCC140AMD64_CXXOBJSUFF ?= .obj
137TOOL_VCC140AMD64_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
138TOOL_VCC140AMD64_CXXFLAGS.debug ?=
139TOOL_VCC140AMD64_CXXFLAGS.dbgopt ?= -O2
140TOOL_VCC140AMD64_CXXFLAGS.release ?= -O2
141TOOL_VCC140AMD64_CXXFLAGS.profile ?= -O2
142TOOL_VCC140AMD64_CXXINCS ?= $(PATH_TOOL_VCC140AMD64_INC) $(PATH_TOOL_VCC140AMD64_ATLMFC_INC)
143TOOL_VCC140AMD64_CXXDEFS ?=
[434]144
[3343]145TOOL_VCC140AMD64_ASOBJSUFF ?= .obj
[2954]146
[3343]147TOOL_VCC140AMD64_RCOBJSUFF ?= .res
148TOOL_VCC140AMD64_RCINCS ?= $(PATH_TOOL_VCC140AMD64_INC) $(PATH_TOOL_VCC140AMD64_ATLMFC_INC)
[434]149
[3343]150TOOL_VCC140AMD64_ARFLAGS ?= -nologo -machine:amd64
151TOOL_VCC140AMD64_ARLIBSUFF ?= .lib
[434]152
[3343]153TOOL_VCC140AMD64_LDFLAGS ?= -nologo -machine:amd64
154TOOL_VCC140AMD64_LDFLAGS.debug ?= -debug
155TOOL_VCC140AMD64_LDFLAGS.dbgopt ?= -debug
156TOOL_VCC140AMD64_LDFLAGS.profile ?= -debug
157TOOL_VCC140AMD64_LDFLAGS.release ?=
[434]158
[667]159
160
[434]161## Compile C source.
162# @param $(target) Normalized main target name.
163# @param $(source) Source filename (relative).
164# @param $(obj) Object file name. This shall be (re)created by the compilation.
165# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
166# @param $(flags) Flags.
167# @param $(defs) Definitions. No -D or something.
168# @param $(incs) Includes. No -I or something.
169# @param $(dirdep) Directory creation dependency.
170# @param $(deps) Other dependencies.
171#
172# @param $(outbase) Output basename (full). Use this for list files and such.
173# @param $(objsuff) Object suffix.
[3343]174TOOL_VCC140AMD64_COMPILE_C_DEPEND =
175TOOL_VCC140AMD64_COMPILE_C_DEPORD =
176TOOL_VCC140AMD64_COMPILE_C_OUTPUT =
177TOOL_VCC140AMD64_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC140_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC140_PDB, $(outbase)-obj,idb)
178ifdef TOOL_VCC140AMD64_KSUBMIT
179 TOOL_VCC140AMD64_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
180 define TOOL_VCC140AMD64_COMPILE_C_CMDS
181 $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
182 -- $(TOOL_VCC140AMD64_CC) -c\
[3323]183 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
[434]184 -Fd$(outbase)-obj.pdb \
185 -Fo$(obj)\
[697]186 $(subst /,\\,$(abspath $(source)))
[2951]187 endef
188else
[3343]189 define TOOL_VCC140AMD64_COMPILE_C_CMDS
190 $(QUIET)$(TOOL_VCC140AMD64_SETUP_ENV)$(TOOL_VCC140AMD64_CC) -c\
[3323]191 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
[2895]192 -Fd$(outbase)-obj.pdb \
193 -Fo$(obj)\
194 $(subst /,\\,$(abspath $(source)))
[2951]195 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
196 endef
[3343]197endif # !TOOL_VCC140AMD64_KSUBMIT
[434]198
199
200## Compile C++ source.
201# @param $(target) Normalized main target name.
202# @param $(source) Source filename (relative).
203# @param $(obj) Object file name. This shall be (re)created by the compilation.
204# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
205# @param $(flags) Flags.
206# @param $(defs) Definitions. No -D or something.
207# @param $(incs) Includes. No -I or something.
208# @param $(dirdep) Directory creation dependency.
209# @param $(deps) Other dependencies.
210#
211# @param $(outbase) Output basename (full). Use this for list files and such.
212# @param $(objsuff) Object suffix.
[3343]213TOOL_VCC140AMD64_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
214TOOL_VCC140AMD64_COMPILE_CXX_DEPORD =
215TOOL_VCC140AMD64_COMPILE_CXX_OUTPUT =
216TOOL_VCC140AMD64_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
217 ,,$(call TOOL_VCC140_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC140_PDB, $(outbase)-obj,idb))
218ifdef TOOL_VCC140AMD64_KSUBMIT
219 TOOL_VCC140AMD64_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
220 define TOOL_VCC140AMD64_COMPILE_CXX_CMDS
221 $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
222 -- $(TOOL_VCC140AMD64_CXX) -c\
[3323]223 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
[2956]224 $(if-expr defined($(target)_PCH_HDR)\
[3033]225 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
[2956]226 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
[434]227 -Fo$(obj)\
[697]228 $(subst /,\\,$(abspath $(source)))
[2951]229 endef
230else
[3343]231 define TOOL_VCC140AMD64_COMPILE_CXX_CMDS
232 $(QUIET)$(TOOL_VCC140AMD64_SETUP_ENV)$(TOOL_VCC140AMD64_CXX) -c\
[3323]233 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
[2956]234 $(if-expr defined($(target)_PCH_HDR)\
[3033]235 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
[2956]236 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
[2895]237 -Fo$(obj)\
238 $(subst /,\\,$(abspath $(source)))
[2951]239 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
240 endef
[3343]241endif # !TOOL_VCC140AMD64_KSUBMIT
[434]242
[2954]243
244#
245# Helper tool for creating the precompiled C++ header.
246#
247# It only have the C++ compile bits and it's purpose is to skip bits
248# related _1_VCC_PCH_FILE and add -Yc.
249#
[3343]250TOOL_VCC140AMD64-PCH := Helper for creating precompiled header using CXX handling.
251TOOL_VCC140AMD64-PCH_EXTENDS := VCC140AMD64
252TOOL_VCC140AMD64-PCH_CXXOBJSUFF := .obj
253TOOL_VCC140AMD64-PCH_CXXINCS = $(TOOL_VCC140AMD64_CXXINCS)
254TOOL_VCC140AMD64-PCH_CXXFLAGS = $(TOOL_VCC140AMD64_CXXFLAGS)
255TOOL_VCC140AMD64-PCH_CXXFLAGS.debug = $(TOOL_VCC140AMD64_CXXFLAGS.debug)
256TOOL_VCC140AMD64-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC140AMD64_CXXFLAGS.dbgopt)
257TOOL_VCC140AMD64-PCH_CXXFLAGS.release = $(TOOL_VCC140AMD64_CXXFLAGS.release)
258TOOL_VCC140AMD64-PCH_CXXFLAGS.profile = $(TOOL_VCC140AMD64_CXXFLAGS.profile)
259TOOL_VCC140AMD64-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
260TOOL_VCC140AMD64-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
261TOOL_VCC140AMD64-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
262TOOL_VCC140AMD64-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
263ifdef TOOL_VCC140AMD64_KSUBMIT
264 define TOOL_VCC140AMD64-PCH_COMPILE_CXX_CMDS
[2960]265 $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
[3343]266 $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
267 -- $(TOOL_VCC140AMD64_CXX) -c -Yc\
[3323]268 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
[3343]269 $(if-expr defined($(target)_PCH_HDR),-FI$($(target)_PCH_HDR),)\
[2954]270 -Fp$($(target)_1_VCC_PCH_FILE) \
271 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
272 -Fo$(obj)\
273 -TP \
274 $(subst /,\\,$(abspath $(source)))
275 endef
276else
[3343]277 define TOOL_VCC140AMD64-PCH_COMPILE_CXX_CMDS
[2960]278 $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
[3343]279 $(QUIET)$(TOOL_VCC140AMD64_SETUP_ENV)$(TOOL_VCC140AMD64_CXX) -c -Yc\
[3323]280 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
[3343]281 $(if-expr defined($(target)_PCH_HDR),-FI$($(target)_PCH_HDR),)\
[2954]282 -Fp$($(target)_1_VCC_PCH_FILE) \
283 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
284 -Fo$(obj)\
285 -TP \
286 $(subst /,\\,$(abspath $(source)))
287 $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
288
289 endef
[3343]290endif # !TOOL_VCC140AMD64_KSUBMIT
[2954]291
292
[2611]293## @todo configure the assembler template.
294
[641]295## Compile resource source.
296# @param $(target) Normalized main target name.
297# @param $(source) Source filename (relative).
298# @param $(obj) Object file name. This shall be (re)created by the compilation.
299# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
300# @param $(flags) Flags.
301# @param $(defs) Definitions. No -D or something.
302# @param $(incs) Includes. No -I or something.
303# @param $(dirdep) Directory creation dependency.
304# @param $(deps) Other dependencies.
305#
306# @param $(outbase) Output basename (full). Use this for list files and such.
307# @param $(objsuff) Object suffix.
[3343]308TOOL_VCC140AMD64_COMPILE_RC_DEPEND =
309TOOL_VCC140AMD64_COMPILE_RC_DEPORD =
310TOOL_VCC140AMD64_COMPILE_RC_OUTPUT =
311define TOOL_VCC140AMD64_COMPILE_RC_CMDS
312 $(QUIET)$(TOOL_VCC140AMD64_RC) \
[3323]313 $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
[641]314 /fo$(obj)\
[697]315 $(subst /,\\,$(abspath $(source)))
[641]316endef
317
318
[434]319## Link library
320# @param $(target) Normalized main target name.
321# @param $(out) Library name.
322# @param $(objs) Object files to put in the library.
323# @param $(flags) Flags.
324# @param $(dirdep) Directory creation dependency.
325# @param $(deps) Other dependencies.
326# @param $(othersrc) Unhandled sources.
327# @param $(outbase) Output basename (full). Use this for list files and such.
328#
[3343]329TOOL_VCC140AMD64_LINK_LIBRARY_DEPEND = $(othersrc)
330TOOL_VCC140AMD64_LINK_LIBRARY_DEPORD =
331TOOL_VCC140AMD64_LINK_LIBRARY_OUTPUT = $(outbase).rsp
332TOOL_VCC140AMD64_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
333define TOOL_VCC140AMD64_LINK_LIBRARY_CMDS
[2557]334 $(QUIET)$(APPEND) -tn $(outbase).rsp \
[3323]335 $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
336 $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
[3343]337 $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT_DD) $(TOOL_VCC140AMD64_AR) $(flags) /OUT:$(out) @$(outbase).rsp
[768]338endef
[434]339
340
341## Link program
342# @param $(target) Normalized main target name.
343# @param $(out) Program name.
344# @param $(objs) Object files to link together.
345# @param $(libs) Libraries to search.
346# @param $(libpath) Library search paths.
347# @param $(flags) Flags.
348# @param $(dirdep) Directory creation dependency.
349# @param $(deps) Other dependencies.
350# @param $(othersrc) Unhandled sources.
351# @param $(custom_pre) Custom step invoked before linking.
352# @param $(custom_post) Custom step invoked after linking.
353# @param $(outbase) Output basename (full). Use this for list files and such.
354#
[3343]355TOOL_VCC140AMD64_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
356TOOL_VCC140AMD64_LINK_PROGRAM_DEPORD =
357TOOL_VCC140AMD64_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
358TOOL_VCC140AMD64_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
359TOOL_VCC140AMD64_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
360TOOL_VCC140AMD64_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
361define TOOL_VCC140AMD64_LINK_PROGRAM_CMDS
[2557]362 $(QUIET)$(APPEND) -tn $(outbase).rsp \
[3323]363 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
[3343]364 $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT_DD) $(TOOL_VCC140AMD64_LD) $(flags) \
[434]365 /OUT:$(out) \
[437]366 /MAPINFO:EXPORTS /INCREMENTAL:NO \
[434]367 /MAP:$(outbase).map \
368 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
369 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
[3323]370 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
[2557]371 @$(outbase).rsp
[3343]372ifndef TOOL_VCC140AMD64_NO_AUTO_MANIFEST
[1295]373 $(QUIET)$(TEST) -f $(out).manifest -- \
[3343]374 $(TOOL_VCC140AMD64_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
[2735]375endif
[434]376endef
377
378
379## Link DLL.
380# @param $(target) Normalized main target name.
381# @param $(out) DLL name.
382# @param $(objs) Object files to link together.
383# @param $(libs) Libraries to search.
384# @param $(libpath) Library search paths.
385# @param $(flags) Flags.
386# @param $(dirdep) Directory creation dependency.
387# @param $(deps) Other dependencies.
388# @param $(othersrc) Unhandled sources.
389# @param $(custom_pre) Custom step invoked before linking.
390# @param $(custom_post) Custom step invoked after linking.
391#
392# @param $(outbase) Output basename (full). Use this for list files and such.
[3343]393TOOL_VCC140AMD64_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
394TOOL_VCC140AMD64_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
395TOOL_VCC140AMD64_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
396TOOL_VCC140AMD64_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
397TOOL_VCC140AMD64_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
398TOOL_VCC140AMD64_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
399TOOL_VCC140AMD64_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
400define TOOL_VCC140AMD64_LINK_DLL_CMDS
[2557]401 $(QUIET)$(APPEND) -tn $(outbase).rsp \
[3323]402 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
[3343]403 $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT_DD) $(TOOL_VCC140AMD64_LD) $(flags) \
[434]404 /OUT:$(out) \
405 /IMPLIB:$(outbase).lib \
[437]406 /MAPINFO:EXPORTS /INCREMENTAL:NO \
[434]407 /MAP:$(outbase).map \
408 /DLL \
409 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
410 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
[3323]411 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
[2557]412 @$(outbase).rsp
[3343]413ifndef TOOL_VCC140AMD64_NO_AUTO_MANIFEST
[1295]414 $(QUIET)$(TEST) -f $(out).manifest -- \
[3343]415 $(TOOL_VCC140AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
[2735]416endif
[2795]417 $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
418 $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
[2487]419$(eval _DIRS += $(PATH_STAGE_LIB))
[434]420endef
421
422
423## Link system module (windows aka driver, linux aka kernel module)
424# @param $(target) Normalized main target name.
425# @param $(out) System module name.
426# @param $(objs) Object files to link together.
427# @param $(libs) Libraries to search.
428# @param $(libpath) Library search paths.
429# @param $(flags) Flags.
430# @param $(dirdep) Directory creation dependency.
431# @param $(deps) Other dependencies.
432# @param $(othersrc) Unhandled sources.
433# @param $(custom_pre) Custom step invoked before linking.
434# @param $(custom_post) Custom step invoked after linking.
435#
436# @param $(outbase) Output basename (full). Use this for list files and such.
[3343]437TOOL_VCC140AMD64_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
438TOOL_VCC140AMD64_LINK_SYSMOD_DEPORD =
439TOOL_VCC140AMD64_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
440TOOL_VCC140AMD64_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
441TOOL_VCC140AMD64_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
442TOOL_VCC140AMD64_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
443define TOOL_VCC140AMD64_LINK_SYSMOD_CMDS
[2557]444 $(QUIET)$(APPEND) -tn $(outbase).rsp \
[3323]445 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
[3343]446 $(QUIET)$(TOOL_VCC140AMD64_KSUBMIT_DD) $(TOOL_VCC140AMD64_LD) $(flags) \
[434]447 /OUT:$(out) \
[437]448 /MAPINFO:EXPORTS /INCREMENTAL:NO \
[434]449 /MAP:$(outbase).map \
450 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
451 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
[3323]452 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
[2557]453 @$(outbase).rsp
[3343]454ifndef TOOL_VCC140AMD64_NO_AUTO_MANIFEST
[1295]455 $(QUIET)$(TEST) -f $(out).manifest -- \
[3343]456 $(TOOL_VCC140AMD64_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
[2735]457endif
[434]458endef
459
Note: See TracBrowser for help on using the repository browser.