source: trunk/kBuild/tools/VCC140.kmk@ 3416

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

VCC140*: Adding support for VC++ 14.0 (2015) too.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.6 KB
Line 
1# $Id: VCC140.kmk 3343 2020-05-20 14:34:15Z bird $
2## @file
3# kBuild Tool Config - Visual C++ 14.0 (aka Visual 2015 and MSC v19.0x), default target.
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_VCC140 := Visual C++ 14.0 (aka Visual 2015 and MSC v19.0x), 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_VCC140
44 PATH_TOOL_VCC140 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.amd64/vcc/v14.0*/)))
45 ifeq ($(PATH_TOOL_VCC140),)
46 PATH_TOOL_VCC140 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.x86/vcc/v14.0*/)))
47 endif
48 ifeq ($(PATH_TOOL_VCC140),)
49 PATH_TOOL_VCC140 := $(PATH_TOOL_VCC140X86)
50 endif
51 ifeq ($(PATH_TOOL_VCC140),)
52 PATH_TOOL_VCC140 := $(PATH_TOOL_VCC140)
53 endif
54 ifeq ($(PATH_TOOL_VCC140),)
55 PATH_TOOL_VCC140 := $(firstfile $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS)/win.x86/vcc/v14.0*)))
56 ifeq ($(PATH_TOOL_VCC140),)
57 ## @todo Not sure it was placed in the 14.0 directory originally, maybe that's just what 2017 and 2019 does?
58 PATH_TOOL_VCC140 := $(firstfile $(foreachfile progfilesdir,$(WINCMN_PROGRAM_FILES_LIST)\
59 , $(rsortfiles $(qwildcard ,$(progfilesdir)/Microsoft\ Visual\ Studio\ 14.0/VC))))
60 ifeq ($(PATH_TOOL_VCC140),)
61 $(warning kBuild: PATH_TOOL_VCC140 cannot be determined!)
62 PATH_TOOL_VCC140 := $(KBUILD_DEVTOOLS)/win.x86/vcc/v140
63 endif
64 endif
65 endif
66else
67 # Resolve any fancy stuff once and for all.
68 PATH_TOOL_VCC140 := $(PATH_TOOL_VCC140)
69endif
70
71ifndef PATH_TOOL_VCC140_BASE_BIN
72PATH_TOOL_VCC140_BASE_BIN := $(PATH_TOOL_VCC140)/bin
73endif
74ifndef PATH_TOOL_VCC140_HOST_BIN
75 ifeq ($(KBUILD_HOST_ARCH),amd64)
76PATH_TOOL_VCC140_HOST_BIN := $(PATH_TOOL_VCC140_BASE_BIN)/amd64
77 else if1of ($(KBUILD_HOST_ARCH), arm32 arm64)
78PATH_TOOL_VCC140_HOST_BIN := $(PATH_TOOL_VCC140_BASE_BIN)/arm
79 else
80PATH_TOOL_VCC140_HOST_BIN := $(PATH_TOOL_VCC140_BASE_BIN)
81 endif
82endif
83ifndef PATH_TOOL_VCC140_BIN
84 ifeq ($(KBUILD_HOST_ARCH),$(KBUILD_TARGET_ARCH))
85PATH_TOOL_VCC140_BIN := $(PATH_TOOL_VCC140_HOST_BIN)
86 else
87PATH_TOOL_VCC140_BIN := $(PATH_TOOL_VCC140_BIN)/$(KBUILD_HOST_ARCH)_$(KBUILD_TARGET_ARCH)
88 endif
89endif
90PATH_TOOL_VCC140_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC140_BIN))
91
92# 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.
93ifndef PATH_TOOL_VCC140_HOST_DLL_BIN
94PATH_TOOL_VCC140_HOST_DLL_BIN := $(PATH_TOOL_VCC140_HOST_BIN)
95endif
96ifndef PATH_TOOL_VCC140_DLL_BIN
97 ifneq ($(PATH_TOOL_VCC140_HOST_DLL_BIN),$(PATH_TOOL_VCC140_BIN))
98PATH_TOOL_VCC140_DLL_BIN := $(PATH_TOOL_VCC140_HOST_DLL_BIN)
99 endif
100endif
101
102PATH_TOOL_VCC140_LIB.amd64 ?= $(PATH_TOOL_VCC140)/lib/amd64
103PATH_TOOL_VCC140_LIB.arm32 ?= $(PATH_TOOL_VCC140)/lib/arm
104PATH_TOOL_VCC140_LIB.x86 ?= $(PATH_TOOL_VCC140)/lib
105
106PATH_TOOL_VCC140_ONECORE_LIB.amd64 ?= $(PATH_TOOL_VCC140)/lib/onecore/amd64
107PATH_TOOL_VCC140_ONECORE_LIB.arm32 ?= $(PATH_TOOL_VCC140)/lib/onecore/arm
108PATH_TOOL_VCC140_ONECORE_LIB.x86 ?= $(PATH_TOOL_VCC140)/lib/onecore
109
110PATH_TOOL_VCC140_INC ?= $(PATH_TOOL_VCC140)/include
111
112PATH_TOOL_VCC140_ATLMFC ?= $(PATH_TOOL_VCC140)/atlmfc
113PATH_TOOL_VCC140_ATLMFC_INC ?= $(PATH_TOOL_VCC140_ATLMFC)/include
114PATH_TOOL_VCC140_ATLMFC_LIB.x86 ?= $(PATH_TOOL_VCC140_ATLMFC)/lib
115PATH_TOOL_VCC140_ATLMFC_LIB.amd64 ?= $(PATH_TOOL_VCC140_ATLMFC)/lib/amd64
116PATH_TOOL_VCC140_ATLMFC_LIB.arm32 ?= $(PATH_TOOL_VCC140_ATLMFC)/lib/arm
117
118TOOL_VCC140_CC ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/cl.exe
119TOOL_VCC140_CXX ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/cl.exe
120ifeq ($(KBUILD_TARGET_ARCH),x86)
121TOOL_VCC140_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/ml.exe
122else
123TOOL_VCC140_AS ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/ml64.exe
124endif
125#TOOL_VCC140_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/lib.exe - just an exec wrapper for the below
126TOOL_VCC140_AR ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/link.exe /LIB
127TOOL_VCC140_LD ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/link.exe
128TOOL_VCC140_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/dumpbin.exe
129TOOL_VCC140_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC140_BIN_QSH)/editbin.exe
130
131TOOL_VCC140_RC ?= $(EXEC_X86_WIN32) $(call TOOL_VCC140_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC140_RC_CACHED)
132TOOL_VCC140_MT ?= $(EXEC_X86_WIN32) $(call TOOL_VCC140_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC140_MT_CACHED)
133
134undefine TOOL_VCC140_USE_KSUBMIT # for now
135ifdef TOOL_VCC140_USE_KSUBMIT
136 ifeq ($(KBUILD_HOST),win)
137 ifneq ($(substr $(qdir un,$(PATH_TOOL_VCC140_BIN)),-3),64/)
138 TOOL_VCC140_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
139 else
140 TOOL_VCC140_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
141 endif
142 ifdef PATH_TOOL_VCC140_DLL_BIN
143 TOOL_VCC140_KSUBMIT := $(TOOL_VCC140_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC140_DLL_BIN));"
144 endif
145 TOOL_VCC140_KSUBMIT_DD := $(TOOL_VCC140_KSUBMIT) --
146 endif
147endif
148ifdef PATH_TOOL_VCC140_DLL_BIN
149 TOOL_VCC140_SETUP_ENV := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC140_DLL_BIN));" --$(SP)
150 ifndef TOOL_VCC140_KSUBMIT_DD
151 TOOL_VCC140_KSUBMIT_DD := $(TOOL_VCC140_SETUP_ENV)
152 endif
153endif
154
155
156## Helper for finding rc.exe and mt.exe in the SDK.
157TOOL_VCC140_FN_FIND_SDK_TOOL_SUB = $(eval $3 := $(qfirstfile sh,\
158 $(if-expr defined(PATH_SDK_WINSDK10_BIN) , $(qwildcard ,$(PATH_SDK_WINSDK10_BIN)/$2)) \
159 $(if-expr defined(PATH_SDK_WINPSDK71_BIN), $(qwildcard ,$(PATH_SDK_WINPSDK71_BIN)/$2)) \
160 $(if-expr defined(PATH_SDK_WINPSDK_BIN) , $(qwildcard ,$(PATH_SDK_WINPSDK_BIN)/$2)) \
161 $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/sdk/*/[Bb][Ii][Nn]/$2)) \
162 $(rsortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/sdk/*/[Bb][Ii][Nn]/$2)) \
163 $1))
164TOOL_VCC140_FN_FIND_SDK_TOOL = $(if-expr !defined($3),$(TOOL_VCC140_FN_FIND_SDK_TOOL_SUB),)$($3)
165
166## Constructs the correct .pdb name (the name is lowercased).
167# @param $(1) Base name, no extention.
168# @param $(2) The extension.
169TOOL_VCC140_PDB = $(dir $(1))$(tolower $(notdir $(1))).$(2)
170
171#
172# Try find the redist directory.
173#
174ifndef PATH_TOOL_VCC140_REDIST
175PATH_TOOL_VCC140_REDIST := $(PATH_TOOL_VCC140)/redist
176endif
177PATH_TOOL_VCC140_REDIST_DEBUG ?= $(PATH_TOOL_VCC140_REDIST)/debug_nonredist
178
179## Updates may add more msvcp140_[0-9].dll images as the product matures.
180# This helper locates them (can differ between archs).
181# @param 1 Redist subdirectory.
182# @param 2 The DLL basename (no suffix).
183# @param 3 The VCC architecture name (for constructing the path).
184FN_TOOL_VCC140_FIND_DLLS = $(2).dll \
185 $(sortfiles $(qnotdir ,$(qwildcard ,$(PATH_TOOL_VCC140_REDIST)/$(3)/$(1)/$(2)_?.dll)))
186
187TOOL_VCC140_REDIST_CRT_SUBDIR := Microsoft.VC140.CRT
188TOOL_VCC140_REDIST_DEBUG_CRT_SUBDIR := Microsoft.VC140.DebugCRT
189
190TOOL_VCC140_REDIST_CRT_DLLS.x86 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),vcruntime140,x86)
191TOOL_VCC140_REDIST_CRT_DLLS.amd64 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),vcruntime140,x64)
192TOOL_VCC140_REDIST_CRT_DLLS.arm32 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),vcruntime140,arm)
193TOOL_VCC140_REDIST_CRT_DLLS = $(TOOL_VCC140_REDIST_CRT_DLLS.$(KBUILD_TARGET_ARCH))
194
195TOOL_VCC140_REDIST_CONCRT_DLLS.x86 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),concrt140,x86)
196TOOL_VCC140_REDIST_CONCRT_DLLS.amd64 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),concrt140,x64)
197TOOL_VCC140_REDIST_CONCRT_DLLS.arm32 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),concrt140,arm)
198TOOL_VCC140_REDIST_CONCRT_DLLS = $(TOOL_VCC140_REDIST_CONCRT_DLLS.$(KBUILD_TARGET_ARCH))
199
200TOOL_VCC140_REDIST_CPP_DLLS.x86 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),msvcp140,x86)
201TOOL_VCC140_REDIST_CPP_DLLS.amd64 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),msvcp140,x64)
202TOOL_VCC140_REDIST_CPP_DLLS.arm32 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),msvcp140,arm)
203TOOL_VCC140_REDIST_CPP_DLLS = $(TOOL_VCC140_REDIST_CPP_DLLS.$(KBUILD_TARGET_ARCH))
204
205TOOL_VCC140_REDIST_WINRT_DLLS.x86 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),vccorlib140,x86)
206TOOL_VCC140_REDIST_WINRT_DLLS.amd64 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),vccorlib140,x64)
207TOOL_VCC140_REDIST_WINRT_DLLS.arm32 = $(call FN_TOOL_VCC140_FIND_DLLS,$(TOOL_VCC140_REDIST_CRT_SUBDIR),vccorlib140,arm)
208TOOL_VCC140_REDIST_WINRT_DLLS = $(TOOL_VCC140_REDIST_WINRT_DLLS.$(KBUILD_TARGET_ARCH))
209
210TOOL_VCC140_REDIST_CXXAMP_SUBDIR := Microsoft.VC140.CXXAMP
211TOOL_VCC140_REDIST_MFC_SUBDIR := Microsoft.VC140.MFC
212TOOL_VCC140_REDIST_MFCLOC_SUBDIR := Microsoft.VC140.MFCLOC
213TOOL_VCC140_REDIST_OPENMP_SUBDIR := Microsoft.VC140.OpenMP
214
215
216#
217# Properties used by kBuild
218#
219TOOL_VCC140_COBJSUFF ?= .obj
220TOOL_VCC140_CFLAGS ?= -TC -nologo -Zi -ZH:SHA_256
221TOOL_VCC140_CFLAGS.debug ?=
222TOOL_VCC140_CFLAGS.dbgopt ?= -O2
223TOOL_VCC140_CFLAGS.release ?= -O2
224TOOL_VCC140_CFLAGS.profile ?= -O2
225TOOL_VCC140_CINCS ?= $(PATH_TOOL_VCC140_INC)
226TOOL_VCC140_CDEFS ?=
227
228TOOL_VCC140_CXXOBJSUFF ?= .obj
229TOOL_VCC140_CXXFLAGS ?= -TP -nologo -Zi -ZH:SHA_256
230TOOL_VCC140_CXXFLAGS.debug ?=
231TOOL_VCC140_CXXFLAGS.dbgopt ?= -O2
232TOOL_VCC140_CXXFLAGS.release ?= -O2
233TOOL_VCC140_CXXFLAGS.profile ?= -O2
234TOOL_VCC140_CXXINCS ?= $(PATH_TOOL_VCC140_INC) $(PATH_TOOL_VCC140_ATLMFC_INC)
235TOOL_VCC140_CXXDEFS ?=
236
237TOOL_VCC140_ASOBJSUFF ?= .obj
238
239TOOL_VCC140_RCOBJSUFF ?= .res
240TOOL_VCC140_RCINCS ?= $(PATH_TOOL_VCC140_INC) $(PATH_TOOL_VCC140_ATLMFC_INC)
241
242TOOL_VCC140_ARFLAGS ?= -nologo
243TOOL_VCC140_ARFLAGS.x86 ?= -machine:x86
244TOOL_VCC140_ARFLAGS.amd64 ?= -machine:amd64
245TOOL_VCC140_ARFLAGS.arm32 ?= -machine:arm
246TOOL_VCC140_ARLIBSUFF ?= .lib
247
248TOOL_VCC140_LDFLAGS ?= -nologo
249TOOL_VCC140_LDFLAGS.x86 ?= -machine:x86
250TOOL_VCC140_LDFLAGS.amd64 ?= -machine:amd64
251TOOL_VCC140_LDFLAGS.arm32 ?= -machine:arm
252TOOL_VCC140_LDFLAGS.debug ?= -debug
253TOOL_VCC140_LDFLAGS.dbgopt ?= -debug
254TOOL_VCC140_LDFLAGS.profile ?= -debug
255TOOL_VCC140_LDFLAGS.release ?=
256
257
258
259## Compile C source.
260# @param $(target) Normalized main target name.
261# @param $(source) Source filename (relative).
262# @param $(obj) Object file name. This shall be (re)created by the compilation.
263# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
264# @param $(flags) Flags.
265# @param $(defs) Definitions. No -D or something.
266# @param $(incs) Includes. No -I or something.
267# @param $(dirdep) Directory creation dependency.
268# @param $(deps) Other dependencies.
269#
270# @param $(outbase) Output basename (full). Use this for list files and such.
271# @param $(objsuff) Object suffix.
272TOOL_VCC140_COMPILE_C_DEPEND =
273TOOL_VCC140_COMPILE_C_DEPORD =
274TOOL_VCC140_COMPILE_C_OUTPUT =
275TOOL_VCC140_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC140_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC140_PDB, $(outbase)-obj,idb)
276ifdef TOOL_VCC140_KSUBMIT
277 TOOL_VCC140_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
278 define TOOL_VCC140_COMPILE_C_CMDS
279 $(QUIET)$(TOOL_VCC140_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
280 -- $(TOOL_VCC140_CC) -c\
281 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
282 -Fd$(outbase)-obj.pdb \
283 -Fo$(obj)\
284 $(subst /,\\,$(abspath $(source)))
285 endef
286else
287 define TOOL_VCC140_COMPILE_C_CMDS
288 $(QUIET)$(TOOL_VCC140_SETUP_ENV) $(TOOL_VCC140_CC) -c\
289 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
290 -Fd$(outbase)-obj.pdb \
291 -Fo$(obj)\
292 $(subst /,\\,$(abspath $(source)))
293 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
294 endef
295endif # !TOOL_VCC140_KSUBMIT
296
297
298## Compile C++ source.
299# @param $(target) Normalized main target name.
300# @param $(source) Source filename (relative).
301# @param $(obj) Object file name. This shall be (re)created by the compilation.
302# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
303# @param $(flags) Flags.
304# @param $(defs) Definitions. No -D or something.
305# @param $(incs) Includes. No -I or something.
306# @param $(dirdep) Directory creation dependency.
307# @param $(deps) Other dependencies.
308#
309# @param $(outbase) Output basename (full). Use this for list files and such.
310# @param $(objsuff) Object suffix.
311TOOL_VCC140_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
312TOOL_VCC140_COMPILE_CXX_DEPORD =
313TOOL_VCC140_COMPILE_CXX_OUTPUT =
314TOOL_VCC140_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
315 ,,$(call TOOL_VCC140_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC140_PDB, $(outbase)-obj,idb))
316ifdef TOOL_VCC140_KSUBMIT
317 TOOL_VCC140_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
318 define TOOL_VCC140_COMPILE_CXX_CMDS
319 $(QUIET)$(TOOL_VCC140_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
320 -- $(TOOL_VCC140_CXX) -c\
321 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
322 $(if-expr defined($(target)_PCH_HDR)\
323 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
324 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
325 -Fo$(obj)\
326 $(subst /,\\,$(abspath $(source)))
327 endef
328else
329 define TOOL_VCC140_COMPILE_CXX_CMDS
330 $(QUIET)$(TOOL_VCC140_SETUP_ENV) $(TOOL_VCC140_CXX) -c\
331 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
332 $(if-expr defined($(target)_PCH_HDR)\
333 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
334 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
335 -Fo$(obj)\
336 $(subst /,\\,$(abspath $(source)))
337 $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
338 endef
339endif # !TOOL_VCC140_KSUBMIT
340
341
342#
343# Helper tool for creating the precompiled C++ header.
344#
345# It only have the C++ compile bits and it's purpose is to skip bits
346# related _1_VCC_PCH_FILE and add -Yc.
347#
348TOOL_VCC140-PCH := Helper for creating precompiled header using CXX handling.
349TOOL_VCC140-PCH_EXTENDS := VCC140
350TOOL_VCC140-PCH_CXXOBJSUFF := .obj
351TOOL_VCC140-PCH_CXXINCS = $(TOOL_VCC140_CXXINCS)
352TOOL_VCC140-PCH_CXXFLAGS = $(TOOL_VCC140_CXXFLAGS) -FS
353TOOL_VCC140-PCH_CXXFLAGS.debug = $(TOOL_VCC140_CXXFLAGS.debug)
354TOOL_VCC140-PCH_CXXFLAGS.dbgopt = $(TOOL_VCC140_CXXFLAGS.dbgopt)
355TOOL_VCC140-PCH_CXXFLAGS.release = $(TOOL_VCC140_CXXFLAGS.release)
356TOOL_VCC140-PCH_CXXFLAGS.profile = $(TOOL_VCC140_CXXFLAGS.profile)
357TOOL_VCC140-PCH_COMPILE_CXX_DEPEND = $(NO_SUCH_VARIABLE)
358TOOL_VCC140-PCH_COMPILE_CXX_DEPORD = $(NO_SUCH_VARIABLE)
359TOOL_VCC140-PCH_COMPILE_CXX_OUTPUT = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
360TOOL_VCC140-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
361ifdef TOOL_VCC140_KSUBMIT
362 define TOOL_VCC140-PCH_COMPILE_CXX_CMDS
363 $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
364 $(QUIET)$(TOOL_VCC140_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
365 -- $(TOOL_VCC140_CXX) -c -Yc\
366 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
367 -Fp$($(target)_1_VCC_PCH_FILE) \
368 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
369 -Fo$(obj)\
370 -TP \
371 $(subst /,\\,$(abspath $(source)))
372 endef
373else
374 define TOOL_VCC140-PCH_COMPILE_CXX_CMDS
375 $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
376 $(QUIET)$(TOOL_VCC140_SETUP_ENV) $(TOOL_VCC140_CXX) -c -Yc\
377 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
378 -Fp$($(target)_1_VCC_PCH_FILE) \
379 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
380 -Fo$(obj)\
381 -TP \
382 $(subst /,\\,$(abspath $(source)))
383 $(QUIET)$(DEP_OBJ) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)
384
385 endef
386endif # !TOOL_VCC140_KSUBMIT
387
388
389## @todo configure the assembler template.
390
391## Compile resource source.
392# @param $(target) Normalized main target name.
393# @param $(source) Source filename (relative).
394# @param $(obj) Object file name. This shall be (re)created by the compilation.
395# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
396# @param $(flags) Flags.
397# @param $(defs) Definitions. No -D or something.
398# @param $(incs) Includes. No -I or something.
399# @param $(dirdep) Directory creation dependency.
400# @param $(deps) Other dependencies.
401#
402# @param $(outbase) Output basename (full). Use this for list files and such.
403# @param $(objsuff) Object suffix.
404TOOL_VCC140_COMPILE_RC_DEPEND =
405TOOL_VCC140_COMPILE_RC_DEPORD =
406TOOL_VCC140_COMPILE_RC_OUTPUT =
407define TOOL_VCC140_COMPILE_RC_CMDS
408 $(QUIET)$(TOOL_VCC140_RC) \
409 $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
410 /fo$(obj)\
411 $(subst /,\\,$(abspath $(source)))
412endef
413
414
415## Link library
416# @param $(target) Normalized main target name.
417# @param $(out) Library name.
418# @param $(objs) Object files to put in the library.
419# @param $(flags) Flags.
420# @param $(dirdep) Directory creation dependency.
421# @param $(deps) Other dependencies.
422# @param $(othersrc) Unhandled sources.
423# @param $(outbase) Output basename (full). Use this for list files and such.
424#
425TOOL_VCC140_LINK_LIBRARY_DEPEND = $(othersrc)
426TOOL_VCC140_LINK_LIBRARY_DEPORD =
427TOOL_VCC140_LINK_LIBRARY_OUTPUT = $(outbase).rsp
428TOOL_VCC140_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
429define TOOL_VCC140_LINK_LIBRARY_CMDS
430 $(QUIET)$(APPEND) -tn $(outbase).rsp \
431 $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
432 $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
433 $(QUIET)$(TOOL_VCC140_KSUBMIT_DD) $(TOOL_VCC140_AR) $(flags) /OUT:$(out) @$(outbase).rsp
434endef
435
436
437## Link program
438# @param $(target) Normalized main target name.
439# @param $(out) Program name.
440# @param $(objs) Object files to link together.
441# @param $(libs) Libraries to search.
442# @param $(libpath) Library search paths.
443# @param $(flags) Flags.
444# @param $(dirdep) Directory creation dependency.
445# @param $(deps) Other dependencies.
446# @param $(othersrc) Unhandled sources.
447# @param $(custom_pre) Custom step invoked before linking.
448# @param $(custom_post) Custom step invoked after linking.
449# @param $(outbase) Output basename (full). Use this for list files and such.
450#
451TOOL_VCC140_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
452TOOL_VCC140_LINK_PROGRAM_DEPORD =
453TOOL_VCC140_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
454TOOL_VCC140_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
455TOOL_VCC140_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
456TOOL_VCC140_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
457define TOOL_VCC140_LINK_PROGRAM_CMDS
458 $(QUIET)$(APPEND) -tn $(outbase).rsp \
459 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
460 $(QUIET)$(TOOL_VCC140_KSUBMIT_DD) $(TOOL_VCC140_LD) $(flags) \
461 /OUT:$(out) \
462 /MAPINFO:EXPORTS /INCREMENTAL:NO \
463 /MAP:$(outbase).map \
464 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
465 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
466 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
467 @$(outbase).rsp
468ifndef TOOL_VCC140_NO_AUTO_MANIFEST
469 $(QUIET)$(TEST) -f $(out).manifest -- \
470 $(TOOL_VCC140_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
471endif
472endef
473
474
475## Link DLL.
476# @param $(target) Normalized main target name.
477# @param $(out) DLL name.
478# @param $(objs) Object files to link together.
479# @param $(libs) Libraries to search.
480# @param $(libpath) Library search paths.
481# @param $(flags) Flags.
482# @param $(dirdep) Directory creation dependency.
483# @param $(deps) Other dependencies.
484# @param $(othersrc) Unhandled sources.
485# @param $(custom_pre) Custom step invoked before linking.
486# @param $(custom_post) Custom step invoked after linking.
487#
488# @param $(outbase) Output basename (full). Use this for list files and such.
489TOOL_VCC140_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
490TOOL_VCC140_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
491TOOL_VCC140_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
492TOOL_VCC140_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
493TOOL_VCC140_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
494TOOL_VCC140_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
495TOOL_VCC140_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
496define TOOL_VCC140_LINK_DLL_CMDS
497 $(QUIET)$(APPEND) -tn $(outbase).rsp \
498 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
499 $(QUIET)$(TOOL_VCC140_KSUBMIT_DD) $(TOOL_VCC140_LD) $(flags) \
500 /OUT:$(out) \
501 /IMPLIB:$(outbase).lib \
502 /MAPINFO:EXPORTS /INCREMENTAL:NO \
503 /MAP:$(outbase).map \
504 /DLL \
505 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
506 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
507 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
508 @$(outbase).rsp
509ifndef TOOL_VCC140_NO_AUTO_MANIFEST
510 $(QUIET)$(TEST) -f $(out).manifest -- \
511 $(TOOL_VCC140_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
512endif
513 $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
514 $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
515$(eval _DIRS += $(PATH_STAGE_LIB))
516endef
517
518
519## Link system module (windows aka driver, linux aka kernel module)
520# @param $(target) Normalized main target name.
521# @param $(out) System module name.
522# @param $(objs) Object files to link together.
523# @param $(libs) Libraries to search.
524# @param $(libpath) Library search paths.
525# @param $(flags) Flags.
526# @param $(dirdep) Directory creation dependency.
527# @param $(deps) Other dependencies.
528# @param $(othersrc) Unhandled sources.
529# @param $(custom_pre) Custom step invoked before linking.
530# @param $(custom_post) Custom step invoked after linking.
531#
532# @param $(outbase) Output basename (full). Use this for list files and such.
533TOOL_VCC140_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
534TOOL_VCC140_LINK_SYSMOD_DEPORD =
535TOOL_VCC140_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
536TOOL_VCC140_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
537TOOL_VCC140_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
538TOOL_VCC140_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
539define TOOL_VCC140_LINK_SYSMOD_CMDS
540 $(QUIET)$(APPEND) -tn $(outbase).rsp \
541 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
542 $(QUIET)$(TOOL_VCC140_KSUBMIT_DD) $(TOOL_VCC140_LD) $(flags) \
543 /OUT:$(out) \
544 /MAPINFO:EXPORTS /INCREMENTAL:NO \
545 /MAP:$(outbase).map \
546 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
547 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
548 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
549 @$(outbase).rsp
550ifndef TOOL_VCC140_NO_AUTO_MANIFEST
551 $(QUIET)$(TEST) -f $(out).manifest -- \
552 $(TOOL_VCC140_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
553endif
554endef
555
Note: See TracBrowser for help on using the repository browser.