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