source: trunk/kBuild/tools/VCC141.kmk@ 3329

Last change on this file since 3329 was 3329, checked in by bird, 5 years ago

tools/VCC141*: Redist DLLs and stuff.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.4 KB
Line 
1# $Id: VCC141.kmk 3329 2020-04-19 22:26:17Z bird $
2## @file
3# kBuild Tool Config - Visual C++ 14.1 (aka Visual 2017 and MSC v19.10), targeting AMD64.
4#
5
6#
7# Copyright (c) 2004-2020 knut st. osmundsen <bird-kBuild-spam-xx@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_VCC141 := Visual C++ 14.1 (aka Visual 2017 and MSC v19.1), targeting $(KBUILD_TARGET).
35
36ifndef INCLUDED_WIN_COMMON_KMK
37 include $(KBUILD_PATH)/win-common.kmk
38endif
39
40#
41# Tool Specific Properties
42#
43ifndef PATH_TOOL_VCC141
44 PATH_TOOL_VCC141 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.amd64/vcc/v141*)))
45 ifeq ($(PATH_TOOL_VCC141),)
46 PATH_TOOL_VCC141 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.x86/vcc/v141*)))
47 endif
48 ifeq ($(PATH_TOOL_VCC141),)
49 PATH_TOOL_VCC141 := $(PATH_TOOL_VCC141X86)
50 endif
51 ifeq ($(PATH_TOOL_VCC141),)
52 PATH_TOOL_VCC141 := $(PATH_TOOL_VCC141)
53 endif
54 ifeq ($(PATH_TOOL_VCC141),)
55 PATH_TOOL_VCC141 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.x86/vcc/v141*)))
56 ifeq ($(PATH_TOOL_VCC141),)
57 PATH_TOOL_VCC141 := $(firstfile $(foreach ver,2017 2019,$(foreachfile progfilesdir,$(WINCMN_PROGRAM_FILES_LIST)\
58 , $(rsortfiles $(qwildcard ,$(progfilesdir)/Microsoft\ Visual\ Studio/$(ver)/BuildTools/VC/Tools/MSVC/14.1?.*)))))
59 ifeq ($(PATH_TOOL_VCC141),)
60 $(warning kBuild: PATH_TOOL_VCC141 cannot be determined!)
61 PATH_TOOL_VCC141 := $(KBUILD_DEVTOOLS)/win.x86/vcc/v141
62 endif
63 endif
64 endif
65else
66 # Resolve any fancy stuff once and for all.
67 PATH_TOOL_VCC141 := $(PATH_TOOL_VCC141)
68endif
69
70ifndef PATH_TOOL_VCC141_BASE_BIN
71PATH_TOOL_VCC141_BASE_BIN := $(PATH_TOOL_VCC141)/bin
72endif
73ifndef PATH_TOOL_VCC141_HOST_BIN
74PATH_TOOL_VCC141_HOST_BIN := $(PATH_TOOL_VCC141_BASE_BIN)/Host$(WINCMN_MAP_ARCH.$(KBUILD_HOST_ARCH))
75endif
76ifndef PATH_TOOL_VCC141_BIN
77PATH_TOOL_VCC141_BIN := $(PATH_TOOL_VCC141_HOST_BIN)/$(WINCMN_MAP_ARCH.$(KBUILD_TARGET_ARCH))
78endif
79PATH_TOOL_VCC141_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC141_BIN))
80
81# 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.
82ifndef PATH_TOOL_VCC141_HOST_DLL_BIN
83PATH_TOOL_VCC141_HOST_DLL_BIN := $(PATH_TOOL_VCC141_HOST_BIN)/$(WINCMN_MAP_ARCH.$(KBUILD_HOST_ARCH))
84endif
85ifndef PATH_TOOL_VCC141_DLL_BIN
86 ifneq ($(PATH_TOOL_VCC141_HOST_DLL_BIN),$(PATH_TOOL_VCC141_BIN))
87PATH_TOOL_VCC141_DLL_BIN := $(PATH_TOOL_VCC141_HOST_DLL_BIN)
88 endif
89endif
90
91PATH_TOOL_VCC141_LIB.amd64 ?= $(PATH_TOOL_VCC141)/lib/x64
92PATH_TOOL_VCC141_LIB.arm32 ?= $(PATH_TOOL_VCC141)/lib/arm
93PATH_TOOL_VCC141_LIB.arm64 ?= $(PATH_TOOL_VCC141)/lib/arm64
94PATH_TOOL_VCC141_LIB.x86 ?= $(PATH_TOOL_VCC141)/lib/x86
95
96PATH_TOOL_VCC141_ONECORE_LIB.amd64 ?= $(PATH_TOOL_VCC141)/lib/onecore/x64
97PATH_TOOL_VCC141_ONECORE_LIB.arm32 ?= $(PATH_TOOL_VCC141)/lib/onecore/arm
98PATH_TOOL_VCC141_ONECORE_LIB.arm64 ?= $(PATH_TOOL_VCC141)/lib/onecore/arm64
99PATH_TOOL_VCC141_ONECORE_LIB.x86 ?= $(PATH_TOOL_VCC141)/lib/onecore/x86
100
101PATH_TOOL_VCC141_INC ?= $(PATH_TOOL_VCC141)/include
102
103PATH_TOOL_VCC141_ATLMFC ?= $(PATH_TOOL_VCC141)/atlmfc
104PATH_TOOL_VCC141_ATLMFC_INC ?= $(PATH_TOOL_VCC141_ATLMFC)/include
105PATH_TOOL_VCC141_ATLMFC_LIB.x86 ?= $(PATH_TOOL_VCC141_ATLMFC)/lib/x86
106PATH_TOOL_VCC141_ATLMFC_LIB.amd64 ?= $(PATH_TOOL_VCC141_ATLMFC)/lib/x64
107
108TOOL_VCC141_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/cl.exe
109TOOL_VCC141_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/cl.exe
110TOOL_VCC141_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/ml64.exe
111#TOOL_VCC141_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/lib.exe - just an exec wrapper for the below
112TOOL_VCC141_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/link.exe /LIB
113TOOL_VCC141_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/link.exe
114TOOL_VCC141_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/dumpbin.exe
115TOOL_VCC141_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC141_BIN_QSH)/editbin.exe
116
117TOOL_VCC141_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC141_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC141_RC_CACHED)
118TOOL_VCC141_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC141_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC141_MT_CACHED)
119
120undefine TOOL_VCC141_USE_KSUBMIT # for now
121ifdef TOOL_VCC141_USE_KSUBMIT
122 ifeq ($(KBUILD_HOST),win)
123 ifneq ($(substr $(qdir un,$(PATH_TOOL_VCC141_BIN)),-3),64/)
124 TOOL_VCC141_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
125 else
126 TOOL_VCC141_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
127 endif
128 ifdef PATH_TOOL_VCC141_DLL_BIN
129 TOOL_VCC141_KSUBMIT := $(TOOL_VCC141_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC141_DLL_BIN));"
130 endif
131 TOOL_VCC141_KSUBMIT_DD := $(TOOL_VCC141_KSUBMIT) --
132 endif
133endif
134ifdef PATH_TOOL_VCC141_DLL_BIN
135 TOOL_VCC141_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC141_DLL_BIN));" --$(SP)
136 ifndef TOOL_VCC141_KSUBMIT_DD
137 TOOL_VCC141_KSUBMIT_DD := $(TOOL_VCC141_SETUP_ENV)
138 endif
139endif
140
141
142## Helper for finding rc.exe and mt.exe in the SDK.
143TOOL_VCC141_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(qfirstfile sh,\
144 $(if-expr defined(PATH_SDK_WINSDK10_BIN) , $(qwildcard ,$(PATH_SDK_WINSDK10_BIN)/$2)) \
145 $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(qwildcard ,$(PATH_SDK_WINPSDK71_BIN)/$2)) \
146 $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(qwildcard ,$(PATH_SDK_WINPSDK_BIN)/$2)) \
147 $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
148 $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
149 $1))
150TOOL_VCC141_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC141_FN_FIND_SDK_TOOL_SUB),)$($3)
151
152## Constructs the correct .pdb name (the name is lowercased).
153# @param $(1) Base name, no extention.
154# @param $(2) The extension.
155TOOL_VCC141_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
156
157#
158# Try find the redist directory. A little complicated as the build number
159# doesn't necessarily match that of the compiler.
160#
161ifeq ($(tolower $(substr $(qdir u,$(PATH_TOOL_VCC141)), -12)),/tools/msvc/)
162PATH_TOOL_VCC141_REDIST ?= $(firstfile $(qwildcard ,$(substr $(qdir ,$(PATH_TOOL_VCC141)), 1, -12)/Redist/MSVC/14.1*))
163else
164PATH_TOOL_VCC141_REDIST ?= $(PATH_TOOL_VCC141)/Redist
165endif
166PATH_TOOL_VCC141_REDIST_DEBUG ?= $(PATH_TOOL_VCC141_REDIST)/debug_nonredist
167
168# Updates may add more msvcp140_[0-9].dll images as the product matures.
169# ASSUMES all platforms end up with the same number of DLLs.
170TOOL_VCC141_REDIST_CRT_SUBDIR := Microsoft.VC141.CRT
171TOOL_VCC141_REDIST_DEBUG_CRT_SUBDIR := Microsoft.VC141.DebugCRT
172TOOL_VCC141_REDIST_CRT_DLLS = vcruntime140.dll \
173 $(sortfiles $(qnotdir ,$(qwildcard ,$(qaddprefix ,$(requote unq,$(PATH_TOOL_VCC141_REDIST)/),\
174 $(addsuffix /$(TOOL_VCC141_REDIST_CRT_SUBDIR)/vcruntime140_*.dll, x86 x64 arm arm64)))))
175TOOL_VCC141_REDIST_CONCRT_DLLS = concrt140.dll \
176 $(sortfiles $(qnotdir ,$(qwildcard ,$(qaddprefix ,$(requote unq,$(PATH_TOOL_VCC141_REDIST)/),\
177 $(addsuffix /$(TOOL_VCC141_REDIST_CRT_SUBDIR)/concrt140_*.dll, x86 x64 arm arm64)))))
178TOOL_VCC141_REDIST_CPP_DLLS = msvcp140.dll \
179 $(sortfiles $(qnotdir ,$(qwildcard ,$(qaddprefix ,$(requote unq,$(PATH_TOOL_VCC141_REDIST)/),\
180 $(addsuffix /$(TOOL_VCC141_REDIST_CRT_SUBDIR)/msvcp140_*.dll, x86 x64 arm arm64)))))
181TOOL_VCC141_REDIST_WINRT_DLLS = vccorlib140.dll \
182 $(sortfiles $(qnotdir ,$(qwildcard ,$(qaddprefix ,$(requote unq,$(PATH_TOOL_VCC141_REDIST)/),\
183 $(addsuffix /$(TOOL_VCC141_REDIST_CRT_SUBDIR)/concrt140_*.dll, x86 x64 arm arm64)))))
184
185TOOL_VCC141_REDIST_CXXAMP_SUBDIR := Microsoft.VC141.CXXAMP
186TOOL_VCC141_REDIST_MFC_SUBDIR := Microsoft.VC141.MFC
187TOOL_VCC141_REDIST_MFCLOC_SUBDIR := Microsoft.VC141.MFCLOC
188TOOL_VCC141_REDIST_OPENMP_SUBDIR := Microsoft.VC141.OpenMP
189
190
191#
192# Properties used by kBuild
193#
194TOOL_VCC141_COBJSUFF ?= .obj
195TOOL_VCC141_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
196TOOL_VCC141_CFLAGS.debug ?=
197TOOL_VCC141_CFLAGS.dbgopt ?= -O2
198TOOL_VCC141_CFLAGS.release ?= -O2
199TOOL_VCC141_CFLAGS.profile ?= -O2
200TOOL_VCC141_CINCS ?= $(PATH_TOOL_VCC141_INC)
201TOOL_VCC141_CDEFS ?=
202
203TOOL_VCC141_CXXOBJSUFF ?= .obj
204TOOL_VCC141_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
205TOOL_VCC141_CXXFLAGS.debug ?=
206TOOL_VCC141_CXXFLAGS.dbgopt ?= -O2
207TOOL_VCC141_CXXFLAGS.release ?= -O2
208TOOL_VCC141_CXXFLAGS.profile ?= -O2
209TOOL_VCC141_CXXINCS ?= $(PATH_TOOL_VCC141_INC) $(PATH_TOOL_VCC141_ATLMFC_INC)
210TOOL_VCC141_CXXDEFS ?=
211
212TOOL_VCC141_ASOBJSUFF ?= .obj
213
214TOOL_VCC141_RCOBJSUFF ?= .res
215TOOL_VCC141_RCINCS ?= $(PATH_TOOL_VCC141_INC) $(PATH_TOOL_VCC141_ATLMFC_INC)
216
217TOOL_VCC141_ARFLAGS ?= -nologo
218TOOL_VCC141_ARFLAGS.x86 ?= -machine:x86
219TOOL_VCC141_ARFLAGS.amd64 ?= -machine:amd64
220TOOL_VCC141_ARFLAGS.arm32 ?= -machine:arm
221TOOL_VCC141_ARLIBSUFF ?= .lib
222
223TOOL_VCC141_LDFLAGS ?= -nologo
224TOOL_VCC141_LDFLAGS.x86 ?= -machine:x86
225TOOL_VCC141_LDFLAGS.amd64 ?= -machine:amd64
226TOOL_VCC141_LDFLAGS.arm32 ?= -machine:arm
227TOOL_VCC141_LDFLAGS.debug ?= -debug
228TOOL_VCC141_LDFLAGS.dbgopt ?= -debug
229TOOL_VCC141_LDFLAGS.profile ?= -debug
230TOOL_VCC141_LDFLAGS.release ?=
231
232
233
234## Compile C source.
235# @param $(target) Normalized main target name.
236# @param $(source) Source filename (relative).
237# @param $(obj) Object file name. This shall be (re)created by the compilation.
238# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
239# @param $(flags) Flags.
240# @param $(defs) Definitions. No -D or something.
241# @param $(incs) Includes. No -I or something.
242# @param $(dirdep) Directory creation dependency.
243# @param $(deps) Other dependencies.
244#
245# @param $(outbase) Output basename (full). Use this for list files and such.
246# @param $(objsuff) Object suffix.
247TOOL_VCC141_COMPILE_C_DEPEND =
248TOOL_VCC141_COMPILE_C_DEPORD =
249TOOL_VCC141_COMPILE_C_OUTPUT =
250TOOL_VCC141_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC141_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC141_PDB, $(outbase)-obj,idb)
251ifdef TOOL_VCC141_KSUBMIT
252 TOOL_VCC141_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
253 define TOOL_VCC141_COMPILE_C_CMDS
254 $(QUIET)$(TOOL_VCC141_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
255 -- $(TOOL_VCC141_CC) -c\
256 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
257 -Fd$(outbase)-obj.pdb \
258 -Fo$(obj)\
259 $(subst /,\\,$(abspath $(source)))
260 endef
261else
262 define TOOL_VCC141_COMPILE_C_CMDS
263 $(QUIET)$(TOOL_VCC141_SETUP_ENV) $(TOOL_VCC141_CC) -c\
264 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
265 -Fd$(outbase)-obj.pdb \
266 -Fo$(obj)\
267 $(subst /,\\,$(abspath $(source)))
268 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
269 endef
270endif # !TOOL_VCC141_KSUBMIT
271
272
273## Compile C++ source.
274# @param $(target) Normalized main target name.
275# @param $(source) Source filename (relative).
276# @param $(obj) Object file name. This shall be (re)created by the compilation.
277# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
278# @param $(flags) Flags.
279# @param $(defs) Definitions. No -D or something.
280# @param $(incs) Includes. No -I or something.
281# @param $(dirdep) Directory creation dependency.
282# @param $(deps) Other dependencies.
283#
284# @param $(outbase) Output basename (full). Use this for list files and such.
285# @param $(objsuff) Object suffix.
286TOOL_VCC141_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
287TOOL_VCC141_COMPILE_CXX_DEPORD =
288TOOL_VCC141_COMPILE_CXX_OUTPUT =
289TOOL_VCC141_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
290 ,,$(call TOOL_VCC141_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC141_PDB, $(outbase)-obj,idb))
291ifdef TOOL_VCC141_KSUBMIT
292 TOOL_VCC141_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
293 define TOOL_VCC141_COMPILE_CXX_CMDS
294 $(QUIET)$(TOOL_VCC141_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
295 -- $(TOOL_VCC141_CXX) -c\
296 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
297 $(if-expr defined($(target)_PCH_HDR)\
298 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
299 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
300 -Fo$(obj)\
301 $(subst /,\\,$(abspath $(source)))
302 endef
303else
304 define TOOL_VCC141_COMPILE_CXX_CMDS
305 $(QUIET)$(TOOL_VCC141_SETUP_ENV) $(TOOL_VCC141_CXX) -c\
306 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
307 $(if-expr defined($(target)_PCH_HDR)\
308 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
309 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
310 -Fo$(obj)\
311 $(subst /,\\,$(abspath $(source)))
312 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
313 endef
314endif # !TOOL_VCC141_KSUBMIT
315
316
317#
318# Helper tool for creating the precompiled C++ header.
319#
320# It only have the C++ compile bits and it's purpose is to skip bits
321# related _1_VCC_PCH_FILE and add -Yc.
322#
323TOOL_VCC141-PCH := Helper for creating precompiled header using CXX handling.
324TOOL_VCC141-PCH_EXTENDS := VCC141
325TOOL_VCC141-PCH_CXXOBJSUFF := .obj
326TOOL_VCC141-PCH_CXXINCS = $(TOOL_VCC141_CXXINCS)
327TOOL_VCC141-PCH_CXXFLAGS = $(TOOL_VCC141_CXXFLAGS) -FS
328TOOL_VCC141-PCH_CXXFLAGS.debug = $(TOOL_VCC141_CXXFLAGS.debug)
329TOOL_VCC141-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC141_CXXFLAGS.dbgopt)
330TOOL_VCC141-PCH_CXXFLAGS.release = $(TOOL_VCC141_CXXFLAGS.release)
331TOOL_VCC141-PCH_CXXFLAGS.profile = $(TOOL_VCC141_CXXFLAGS.profile)
332TOOL_VCC141-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
333TOOL_VCC141-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
334TOOL_VCC141-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
335TOOL_VCC141-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
336ifdef TOOL_VCC141_KSUBMIT
337 define TOOL_VCC141-PCH_COMPILE_CXX_CMDS
338 $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
339 $(QUIET)$(TOOL_VCC141_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
340 -- $(TOOL_VCC141_CXX) -c -Yc\
341 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
342 -Fp$($(target)_1_VCC_PCH_FILE) \
343 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
344 -Fo$(obj)\
345 -TP \
346 $(subst /,\\,$(abspath $(source)))
347 endef
348else
349 define TOOL_VCC141-PCH_COMPILE_CXX_CMDS
350 $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
351 $(QUIET)$(TOOL_VCC141_SETUP_ENV) $(TOOL_VCC141_CXX) -c -Yc\
352 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
353 -Fp$($(target)_1_VCC_PCH_FILE) \
354 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
355 -Fo$(obj)\
356 -TP \
357 $(subst /,\\,$(abspath $(source)))
358 $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
359
360 endef
361endif # !TOOL_VCC141_KSUBMIT
362
363
364## @todo configure the assembler template.
365
366## Compile resource source.
367# @param $(target) Normalized main target name.
368# @param $(source) Source filename (relative).
369# @param $(obj) Object file name. This shall be (re)created by the compilation.
370# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
371# @param $(flags) Flags.
372# @param $(defs) Definitions. No -D or something.
373# @param $(incs) Includes. No -I or something.
374# @param $(dirdep) Directory creation dependency.
375# @param $(deps) Other dependencies.
376#
377# @param $(outbase) Output basename (full). Use this for list files and such.
378# @param $(objsuff) Object suffix.
379TOOL_VCC141_COMPILE_RC_DEPEND =
380TOOL_VCC141_COMPILE_RC_DEPORD =
381TOOL_VCC141_COMPILE_RC_OUTPUT =
382define TOOL_VCC141_COMPILE_RC_CMDS
383 $(QUIET)$(TOOL_VCC141_RC) \
384 $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
385 /fo$(obj)\
386 $(subst /,\\,$(abspath $(source)))
387endef
388
389
390## Link library
391# @param $(target) Normalized main target name.
392# @param $(out) Library name.
393# @param $(objs) Object files to put in the library.
394# @param $(flags) Flags.
395# @param $(dirdep) Directory creation dependency.
396# @param $(deps) Other dependencies.
397# @param $(othersrc) Unhandled sources.
398# @param $(outbase) Output basename (full). Use this for list files and such.
399#
400TOOL_VCC141_LINK_LIBRARY_DEPEND = $(othersrc)
401TOOL_VCC141_LINK_LIBRARY_DEPORD =
402TOOL_VCC141_LINK_LIBRARY_OUTPUT = $(outbase).rsp
403TOOL_VCC141_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
404define TOOL_VCC141_LINK_LIBRARY_CMDS
405 $(QUIET)$(APPEND) -tn $(outbase).rsp \
406 $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
407 $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
408 $(QUIET)$(TOOL_VCC141_KSUBMIT_DD) $(TOOL_VCC141_AR) $(flags) /OUT:$(out) @$(outbase).rsp
409endef
410
411
412## Link program
413# @param $(target) Normalized main target name.
414# @param $(out) Program name.
415# @param $(objs) Object files to link together.
416# @param $(libs) Libraries to search.
417# @param $(libpath) Library search paths.
418# @param $(flags) Flags.
419# @param $(dirdep) Directory creation dependency.
420# @param $(deps) Other dependencies.
421# @param $(othersrc) Unhandled sources.
422# @param $(custom_pre) Custom step invoked before linking.
423# @param $(custom_post) Custom step invoked after linking.
424# @param $(outbase) Output basename (full). Use this for list files and such.
425#
426TOOL_VCC141_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
427TOOL_VCC141_LINK_PROGRAM_DEPORD =
428TOOL_VCC141_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
429TOOL_VCC141_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
430TOOL_VCC141_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
431TOOL_VCC141_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
432define TOOL_VCC141_LINK_PROGRAM_CMDS
433 $(QUIET)$(APPEND) -tn $(outbase).rsp \
434 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
435 $(QUIET)$(TOOL_VCC141_KSUBMIT_DD) $(TOOL_VCC141_LD) $(flags) \
436 /OUT:$(out) \
437 /MAPINFO:EXPORTS /INCREMENTAL:NO \
438 /MAP:$(outbase).map \
439 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
440 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
441 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
442 @$(outbase).rsp
443ifndef TOOL_VCC141_NO_AUTO_MANIFEST
444 $(QUIET)$(TEST) -f $(out).manifest -- \
445 $(TOOL_VCC141_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
446endif
447endef
448
449
450## Link DLL.
451# @param $(target) Normalized main target name.
452# @param $(out) DLL name.
453# @param $(objs) Object files to link together.
454# @param $(libs) Libraries to search.
455# @param $(libpath) Library search paths.
456# @param $(flags) Flags.
457# @param $(dirdep) Directory creation dependency.
458# @param $(deps) Other dependencies.
459# @param $(othersrc) Unhandled sources.
460# @param $(custom_pre) Custom step invoked before linking.
461# @param $(custom_post) Custom step invoked after linking.
462#
463# @param $(outbase) Output basename (full). Use this for list files and such.
464TOOL_VCC141_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
465TOOL_VCC141_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
466TOOL_VCC141_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
467TOOL_VCC141_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
468TOOL_VCC141_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
469TOOL_VCC141_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
470TOOL_VCC141_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
471define TOOL_VCC141_LINK_DLL_CMDS
472 $(QUIET)$(APPEND) -tn $(outbase).rsp \
473 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
474 $(QUIET)$(TOOL_VCC141_KSUBMIT_DD) $(TOOL_VCC141_LD) $(flags) \
475 /OUT:$(out) \
476 /IMPLIB:$(outbase).lib \
477 /MAPINFO:EXPORTS /INCREMENTAL:NO \
478 /MAP:$(outbase).map \
479 /DLL \
480 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
481 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
482 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
483 @$(outbase).rsp
484ifndef TOOL_VCC141_NO_AUTO_MANIFEST
485 $(QUIET)$(TEST) -f $(out).manifest -- \
486 $(TOOL_VCC141_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
487endif
488 $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
489 $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
490$(eval _DIRS += $(PATH_STAGE_LIB))
491endef
492
493
494## Link system module (windows aka driver, linux aka kernel module)
495# @param $(target) Normalized main target name.
496# @param $(out) System module name.
497# @param $(objs) Object files to link together.
498# @param $(libs) Libraries to search.
499# @param $(libpath) Library search paths.
500# @param $(flags) Flags.
501# @param $(dirdep) Directory creation dependency.
502# @param $(deps) Other dependencies.
503# @param $(othersrc) Unhandled sources.
504# @param $(custom_pre) Custom step invoked before linking.
505# @param $(custom_post) Custom step invoked after linking.
506#
507# @param $(outbase) Output basename (full). Use this for list files and such.
508TOOL_VCC141_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
509TOOL_VCC141_LINK_SYSMOD_DEPORD =
510TOOL_VCC141_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
511TOOL_VCC141_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
512TOOL_VCC141_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
513TOOL_VCC141_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
514define TOOL_VCC141_LINK_SYSMOD_CMDS
515 $(QUIET)$(APPEND) -tn $(outbase).rsp \
516 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
517 $(QUIET)$(TOOL_VCC141_KSUBMIT_DD) $(TOOL_VCC141_LD) $(flags) \
518 /OUT:$(out) \
519 /MAPINFO:EXPORTS /INCREMENTAL:NO \
520 /MAP:$(outbase).map \
521 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
522 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
523 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
524 @$(outbase).rsp
525ifndef TOOL_VCC141_NO_AUTO_MANIFEST
526 $(QUIET)$(TEST) -f $(out).manifest -- \
527 $(TOOL_VCC141_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
528endif
529endef
530
Note: See TracBrowser for help on using the repository browser.