| 1 | # $Id: VCC143X86.kmk 3615 2024-10-20 02:53:45Z bird $
 | 
|---|
| 2 | ## @file
 | 
|---|
| 3 | # kBuild Tool Config - Visual C++ 14.3 (aka Visual 2022 and MSC v19.30+), targeting x86.
 | 
|---|
| 4 | #
 | 
|---|
| 5 | 
 | 
|---|
| 6 | #
 | 
|---|
| 7 | # Copyright (c) 2004-2024 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 | ifndef TOOL_VCC143
 | 
|---|
| 35 |  include $(KBUILD_PATH)/tools/VCC143.kmk
 | 
|---|
| 36 | endif
 | 
|---|
| 37 | 
 | 
|---|
| 38 | TOOL_VCC143X86 := Visual C++ 14.3 (aka Visual 2022 and MSC v19.30+), targeting x86
 | 
|---|
| 39 | 
 | 
|---|
| 40 | #
 | 
|---|
| 41 | # Tool Specific Properties
 | 
|---|
| 42 | #
 | 
|---|
| 43 | ifndef PATH_TOOL_VCC143X86
 | 
|---|
| 44 |  PATH_TOOL_VCC143X86 := $(PATH_TOOL_VCC143)
 | 
|---|
| 45 | else
 | 
|---|
| 46 |  # Resolve any fancy stuff once and for all.
 | 
|---|
| 47 |  PATH_TOOL_VCC143X86 := $(PATH_TOOL_VCC143X86)
 | 
|---|
| 48 | endif
 | 
|---|
| 49 | 
 | 
|---|
| 50 | ifndef PATH_TOOL_VCC143X86_BIN
 | 
|---|
| 51 | PATH_TOOL_VCC143X86_BIN     := $(PATH_TOOL_VCC143_HOST_BIN)/x86
 | 
|---|
| 52 | else
 | 
|---|
| 53 | PATH_TOOL_VCC143X86_BIN     := $(PATH_TOOL_VCC143X86_BIN)
 | 
|---|
| 54 | endif
 | 
|---|
| 55 | PATH_TOOL_VCC143X86_BIN_QSH := $(requote sh,$(PATH_TOOL_VCC143X86_BIN))
 | 
|---|
| 56 | 
 | 
|---|
| 57 | # 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.
 | 
|---|
| 58 | ifndef PATH_TOOL_VCC143X86_DLL_BIN
 | 
|---|
| 59 |  ifneq ($(PATH_TOOL_VCC143_HOST_DLL_BIN),$(PATH_TOOL_VCC143X86_BIN))
 | 
|---|
| 60 | PATH_TOOL_VCC143X86_DLL_BIN := $(PATH_TOOL_VCC143_HOST_DLL_BIN)
 | 
|---|
| 61 |  endif
 | 
|---|
| 62 | endif
 | 
|---|
| 63 | 
 | 
|---|
| 64 | ifndef PATH_TOOL_VCC143X86_LIB
 | 
|---|
| 65 | PATH_TOOL_VCC143X86_LIB     := $(PATH_TOOL_VCC143_LIB.x86)
 | 
|---|
| 66 | endif
 | 
|---|
| 67 | ifndef PATH_TOOL_VCC143_ONECORE_LIB
 | 
|---|
| 68 | PATH_TOOL_VCC143_ONECORE_LIB  := $(PATH_TOOL_VCC143_ONECORE_LIB.x86)
 | 
|---|
| 69 | endif
 | 
|---|
| 70 | 
 | 
|---|
| 71 | ifndef PATH_TOOL_VCC143X86_INC
 | 
|---|
| 72 | PATH_TOOL_VCC143X86_INC     := $(PATH_TOOL_VCC143_INC)
 | 
|---|
| 73 | endif
 | 
|---|
| 74 | 
 | 
|---|
| 75 | ifndef PATH_TOOL_VCC143X86_ATLMFC_INC
 | 
|---|
| 76 | PATH_TOOL_VCC143X86_ATLMFC_INC := $(PATH_TOOL_VCC143_ATLMFC_INC.x86)
 | 
|---|
| 77 | endif
 | 
|---|
| 78 | ifndef PATH_TOOL_VCC143X86_ATLMFC_LIB
 | 
|---|
| 79 | PATH_TOOL_VCC143X86_ATLMFC_LIB := $(PATH_TOOL_VCC143_ATLMFC_LIB.x86)
 | 
|---|
| 80 | endif
 | 
|---|
| 81 | 
 | 
|---|
| 82 | TOOL_VCC143X86_CC      ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC143X86_BIN_QSH)/cl.exe
 | 
|---|
| 83 | TOOL_VCC143X86_CXX     ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC143X86_BIN_QSH)/cl.exe
 | 
|---|
| 84 | TOOL_VCC143X86_AS      ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC143X86_BIN_QSH)/ml.exe
 | 
|---|
| 85 | #TOOL_VCC143X86_AR      ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC143X86_BIN_QSH)/lib.exe - just an exec wrapper for the below
 | 
|---|
| 86 | TOOL_VCC143X86_AR      ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC143X86_BIN_QSH)/link.exe /LIB
 | 
|---|
| 87 | TOOL_VCC143X86_LD      ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC143X86_BIN_QSH)/link.exe
 | 
|---|
| 88 | TOOL_VCC143X86_DUMPBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC143X86_BIN_QSH)/dumpbin.exe
 | 
|---|
| 89 | TOOL_VCC143X86_EDITBIN ?= $(EXEC_X86_WIN32) $(PATH_TOOL_VCC143X86_BIN_QSH)/editbin.exe
 | 
|---|
| 90 | 
 | 
|---|
| 91 | TOOL_VCC143X86_RC      ?= $(EXEC_X86_WIN32) $(call TOOL_VCC143_FN_FIND_SDK_TOOL,rc.exe,[Rr][Cc].[Ee][Xx][Ee],TOOL_VCC143_RC_CACHED)
 | 
|---|
| 92 | TOOL_VCC143X86_MT      ?= $(TOOL_VCC143X86_MT_RETRY) $(EXEC_X86_WIN32) $(call TOOL_VCC143_FN_FIND_SDK_TOOL,mt.exe,[Mm][Tt].[Ee][Xx][Ee],TOOL_VCC143_MT_CACHED)
 | 
|---|
| 93 | TOOL_VCC143X86_MT_RETRY ?= $(TOOL_VCC143_MT_RETRY)
 | 
|---|
| 94 | 
 | 
|---|
| 95 | ifdef TOOL_VCC143X86_USE_KSUBMIT
 | 
|---|
| 96 |  ifeq ($(KBUILD_HOST),win)
 | 
|---|
| 97 |   ifeq ($(findstring /HostX86/,$(PATH_TOOL_VCC143X86_BIN)),/HostX86/)
 | 
|---|
| 98 |    TOOL_VCC143X86_KSUBMIT ?= kmk_builtin_kSubmit --32-bit
 | 
|---|
| 99 |   else
 | 
|---|
| 100 |    TOOL_VCC143X86_KSUBMIT ?= kmk_builtin_kSubmit --64-bit
 | 
|---|
| 101 |   endif
 | 
|---|
| 102 |   ifdef PATH_TOOL_VCC143X86_DLL_BIN
 | 
|---|
| 103 |    TOOL_VCC143X86_KSUBMIT := $(TOOL_VCC143X86_KSUBMIT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC143X86_DLL_BIN));"
 | 
|---|
| 104 |   endif
 | 
|---|
| 105 |   TOOL_VCC143X86_KSUBMIT_DD := $(TOOL_VCC143X86_KSUBMIT) --
 | 
|---|
| 106 |  endif
 | 
|---|
| 107 | endif
 | 
|---|
| 108 | ifdef PATH_TOOL_VCC143X86_DLL_BIN
 | 
|---|
| 109 |  TOOL_VCC143X86_SETUP_ENV   := $(REDIRECT) --prepend "PATH=$(requote shell-in-dq,$(PATH_TOOL_VCC143X86_DLL_BIN));" --$(SP)
 | 
|---|
| 110 |  ifndef TOOL_VCC143X86_KSUBMIT_DD
 | 
|---|
| 111 |   TOOL_VCC143X86_KSUBMIT_DD := $(TOOL_VCC143X86_SETUP_ENV)
 | 
|---|
| 112 |  endif
 | 
|---|
| 113 | endif
 | 
|---|
| 114 | 
 | 
|---|
| 115 | # Redist (more stuff in VCC143.kmk).
 | 
|---|
| 116 | PATH_TOOL_VCC143X86_REDIST           ?= $(PATH_TOOL_VCC143_REDIST)/x86
 | 
|---|
| 117 | PATH_TOOL_VCC143X86_REDIST_CRT        = $(PATH_TOOL_VCC143X86_REDIST)/$(TOOL_VCC143_REDIST_CRT_SUBDIR)
 | 
|---|
| 118 | PATH_TOOL_VCC143X86_REDIST_DEBUG     ?= $(PATH_TOOL_VCC143_REDIST_DEBUG)/x86
 | 
|---|
| 119 | PATH_TOOL_VCC143X86_REDIST_DEBUG_CRT  = $(PATH_TOOL_VCC143X86_REDIST_DEBUG)/$(TOOL_VCC143_REDIST_DEBUG_CRT_SUBDIR)
 | 
|---|
| 120 | TOOL_VCC143X86_REDIST_CRT_DLLS        = $(TOOL_VCC143_REDIST_CRT_DLLS.x86)
 | 
|---|
| 121 | TOOL_VCC143X86_REDIST_CONCRT_DLLS     = $(TOOL_VCC143_REDIST_CONCRT_DLLS.x86)
 | 
|---|
| 122 | TOOL_VCC143X86_REDIST_CPP_DLLS        = $(TOOL_VCC143_REDIST_CPP_DLLS.x86)
 | 
|---|
| 123 | TOOL_VCC143X86_REDIST_WINRT_DLLS      = $(TOOL_VCC143_REDIST_WINRT_DLLS.x86)
 | 
|---|
| 124 | 
 | 
|---|
| 125 | 
 | 
|---|
| 126 | #
 | 
|---|
| 127 | # Properties used by kBuild
 | 
|---|
| 128 | #
 | 
|---|
| 129 | TOOL_VCC143X86_COBJSUFF         ?= .obj
 | 
|---|
| 130 | TOOL_VCC143X86_CFLAGS           ?= -TC -nologo -Zi -ZH:SHA_256
 | 
|---|
| 131 | TOOL_VCC143X86_CFLAGS.debug     ?=
 | 
|---|
| 132 | TOOL_VCC143X86_CFLAGS.dbgopt    ?= -O2
 | 
|---|
| 133 | TOOL_VCC143X86_CFLAGS.release   ?= -O2
 | 
|---|
| 134 | TOOL_VCC143X86_CFLAGS.profile   ?= -O2
 | 
|---|
| 135 | TOOL_VCC143X86_CINCS            ?= $(PATH_TOOL_VCC143X86_INC)
 | 
|---|
| 136 | TOOL_VCC143X86_CDEFS            ?=
 | 
|---|
| 137 | 
 | 
|---|
| 138 | TOOL_VCC143X86_CXXOBJSUFF       ?= .obj
 | 
|---|
| 139 | TOOL_VCC143X86_CXXFLAGS         ?= -TP -nologo -Zi -ZH:SHA_256
 | 
|---|
| 140 | TOOL_VCC143X86_CXXFLAGS.debug   ?=
 | 
|---|
| 141 | TOOL_VCC143X86_CXXFLAGS.dbgopt  ?= -O2
 | 
|---|
| 142 | TOOL_VCC143X86_CXXFLAGS.release ?= -O2
 | 
|---|
| 143 | TOOL_VCC143X86_CXXFLAGS.profile ?= -O2
 | 
|---|
| 144 | TOOL_VCC143X86_CXXINCS          ?= $(PATH_TOOL_VCC143X86_INC) $(PATH_TOOL_VCC143X86_ATLMFC_INC)
 | 
|---|
| 145 | TOOL_VCC143X86_CXXDEFS          ?=
 | 
|---|
| 146 | 
 | 
|---|
| 147 | TOOL_VCC143X86_ASOBJSUFF        ?= .obj
 | 
|---|
| 148 | 
 | 
|---|
| 149 | TOOL_VCC143X86_RCOBJSUFF        ?= .res
 | 
|---|
| 150 | TOOL_VCC143X86_RCINCS           ?= $(PATH_TOOL_VCC143X86_INC) $(PATH_TOOL_VCC143X86_ATLMFC_INC)
 | 
|---|
| 151 | 
 | 
|---|
| 152 | TOOL_VCC143X86_ARFLAGS          ?= -nologo -machine:x86
 | 
|---|
| 153 | TOOL_VCC143X86_ARLIBSUFF        ?= .lib
 | 
|---|
| 154 | 
 | 
|---|
| 155 | TOOL_VCC143X86_LDFLAGS          ?= -nologo -machine:x86
 | 
|---|
| 156 | TOOL_VCC143X86_LDFLAGS.debug    ?= -debug
 | 
|---|
| 157 | TOOL_VCC143X86_LDFLAGS.dbgopt   ?= -debug
 | 
|---|
| 158 | TOOL_VCC143X86_LDFLAGS.profile  ?= -debug
 | 
|---|
| 159 | TOOL_VCC143X86_LDFLAGS.release  ?=
 | 
|---|
| 160 | 
 | 
|---|
| 161 | 
 | 
|---|
| 162 | 
 | 
|---|
| 163 | ## Compile C source.
 | 
|---|
| 164 | # @param    $(target)   Normalized main target name.
 | 
|---|
| 165 | # @param    $(source)   Source filename (relative).
 | 
|---|
| 166 | # @param    $(obj)      Object file name. This shall be (re)created by the compilation.
 | 
|---|
| 167 | # @param    $(dep)      Dependcy file. This shall be (re)created by the compilation.
 | 
|---|
| 168 | # @param    $(flags)    Flags.
 | 
|---|
| 169 | # @param    $(defs)     Definitions. No -D or something.
 | 
|---|
| 170 | # @param    $(incs)     Includes. No -I or something.
 | 
|---|
| 171 | # @param    $(dirdep)   Directory creation dependency.
 | 
|---|
| 172 | # @param    $(deps)     Other dependencies.
 | 
|---|
| 173 | #
 | 
|---|
| 174 | # @param    $(outbase)  Output basename (full). Use this for list files and such.
 | 
|---|
| 175 | # @param    $(objsuff)  Object suffix.
 | 
|---|
| 176 | # @note The -d1scalableinclude- option disables include directory caching as the cache goes
 | 
|---|
| 177 | #       stale in kWorker.  Besides, kWorker does it's own caching, so it is not necessary.
 | 
|---|
| 178 | TOOL_VCC143X86_COMPILE_C_DEPEND =
 | 
|---|
| 179 | TOOL_VCC143X86_COMPILE_C_DEPORD =
 | 
|---|
| 180 | TOOL_VCC143X86_COMPILE_C_OUTPUT =
 | 
|---|
| 181 | TOOL_VCC143X86_COMPILE_C_OUTPUT_MAYBE = $(call TOOL_VCC143_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC143_PDB, $(outbase)-obj,idb)
 | 
|---|
| 182 | ifdef TOOL_VCC143X86_KSUBMIT
 | 
|---|
| 183 |  TOOL_VCC143X86_COMPILE_C_DONT_PURGE_OUTPUT := 1 # speed
 | 
|---|
| 184 |  define TOOL_VCC143X86_COMPILE_C_CMDS
 | 
|---|
| 185 |         $(QUIET)$(TOOL_VCC143X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
 | 
|---|
| 186 |                 -- $(TOOL_VCC143X86_CC) -c -d1scalableinclude-\
 | 
|---|
| 187 |                 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
 | 
|---|
| 188 |                 -Fd$(outbase)-obj.pdb \
 | 
|---|
| 189 |                 -Fo$(obj)\
 | 
|---|
| 190 |                 $(subst /,\\,$(abspath $(source)))
 | 
|---|
| 191 |  endef
 | 
|---|
| 192 | else
 | 
|---|
| 193 |  define TOOL_VCC143X86_COMPILE_C_CMDS
 | 
|---|
| 194 |         $(QUIET)$(TOOL_VCC143X86_SETUP_ENV)$(TOOL_VCC143X86_CC) -c\
 | 
|---|
| 195 |                 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
 | 
|---|
| 196 |                 -Fd$(outbase)-obj.pdb \
 | 
|---|
| 197 |                 -Fo$(obj)\
 | 
|---|
| 198 |                 $(subst /,\\,$(abspath $(source)))
 | 
|---|
| 199 |         $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
 | 
|---|
| 200 |  endef
 | 
|---|
| 201 | endif # !TOOL_VCC143X86_KSUBMIT
 | 
|---|
| 202 | 
 | 
|---|
| 203 | 
 | 
|---|
| 204 | ## Compile C++ source.
 | 
|---|
| 205 | # @param    $(target)   Normalized main target name.
 | 
|---|
| 206 | # @param    $(source)   Source filename (relative).
 | 
|---|
| 207 | # @param    $(obj)      Object file name. This shall be (re)created by the compilation.
 | 
|---|
| 208 | # @param    $(dep)      Dependcy file. This shall be (re)created by the compilation.
 | 
|---|
| 209 | # @param    $(flags)    Flags.
 | 
|---|
| 210 | # @param    $(defs)     Definitions. No -D or something.
 | 
|---|
| 211 | # @param    $(incs)     Includes. No -I or something.
 | 
|---|
| 212 | # @param    $(dirdep)   Directory creation dependency.
 | 
|---|
| 213 | # @param    $(deps)     Other dependencies.
 | 
|---|
| 214 | #
 | 
|---|
| 215 | # @param    $(outbase)  Output basename (full). Use this for list files and such.
 | 
|---|
| 216 | # @param    $(objsuff)  Object suffix.
 | 
|---|
| 217 | # @note The -d1scalableinclude- option disables include directory caching as the cache goes
 | 
|---|
| 218 | #       stale in kWorker.  Besides, kWorker does it's own caching, so it is not necessary.
 | 
|---|
| 219 | #       ('-d1' means it's passed to c1.dll/c1xx.dll and 'scalableinclude-' is the actual option.)
 | 
|---|
| 220 | TOOL_VCC143X86_COMPILE_CXX_DEPEND = $($(target)_1_VCC_PCH_FILE)
 | 
|---|
| 221 | TOOL_VCC143X86_COMPILE_CXX_DEPORD =
 | 
|---|
| 222 | TOOL_VCC143X86_COMPILE_CXX_OUTPUT =
 | 
|---|
| 223 | TOOL_VCC143X86_COMPILE_CXX_OUTPUT_MAYBE = $(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB)\
 | 
|---|
| 224 |         ,,$(call TOOL_VCC143_PDB, $(outbase)-obj,pdb) $(call TOOL_VCC143_PDB, $(outbase)-obj,idb))
 | 
|---|
| 225 | ifdef TOOL_VCC143X86_KSUBMIT
 | 
|---|
| 226 |  TOOL_VCC143X86_COMPILE_CXX_DONT_PURGE_OUTPUT := 1 # speed
 | 
|---|
| 227 |  define TOOL_VCC143X86_COMPILE_CXX_CMDS
 | 
|---|
| 228 |         $(QUIET)$(TOOL_VCC143X86_KSUBMIT) -P $(DEP_OBJ_INT) -f -s -q -o $(dep) -t $(obj) $(obj)\
 | 
|---|
| 229 |                 -- $(TOOL_VCC143X86_CXX) -c -d1scalableinclude-\
 | 
|---|
| 230 |                 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
 | 
|---|
| 231 |                 $(if-expr defined($(target)_PCH_HDR)\
 | 
|---|
| 232 |                 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
 | 
|---|
| 233 |                 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
 | 
|---|
| 234 |                 -Fo$(obj)\
 | 
|---|
| 235 |                 $(subst /,\\,$(abspath $(source)))
 | 
|---|
| 236 |  endef
 | 
|---|
| 237 | else
 | 
|---|
| 238 |  define TOOL_VCC143X86_COMPILE_CXX_CMDS
 | 
|---|
| 239 |         $(QUIET)$(TOOL_VCC143X86_SETUP_ENV)$(TOOL_VCC143X86_CXX) -c\
 | 
|---|
| 240 |                 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
 | 
|---|
| 241 |                 $(if-expr defined($(target)_PCH_HDR)\
 | 
|---|
| 242 |                 ,-FI$($(target)_PCH_HDR) -Yu$($(target)_PCH_HDR) -Fp$($(target)_1_VCC_PCH_FILE) -FS,)\
 | 
|---|
| 243 |                 -Fd$(if-expr defined($(target)_1_VCC_COMMON_OBJ_PDB),$($(target)_1_VCC_COMMON_OBJ_PDB),$(outbase)-obj.pdb) \
 | 
|---|
| 244 |                 -Fo$(obj)\
 | 
|---|
| 245 |                 $(subst /,\\,$(abspath $(source)))
 | 
|---|
| 246 |         $(QUIET)$(DEP_OBJ) -f -s -q -o $(dep) -t $(obj) $(obj)
 | 
|---|
| 247 |  endef
 | 
|---|
| 248 | endif # !TOOL_VCC143X86_KSUBMIT
 | 
|---|
| 249 | 
 | 
|---|
| 250 | 
 | 
|---|
| 251 | #
 | 
|---|
| 252 | # Helper tool for creating the precompiled C++ header.
 | 
|---|
| 253 | #
 | 
|---|
| 254 | # It only have the C++ compile bits and it's purpose is to skip bits
 | 
|---|
| 255 | # related _1_VCC_PCH_FILE and add -Yc.
 | 
|---|
| 256 | #
 | 
|---|
| 257 | TOOL_VCC143X86-PCH                         := Helper for creating precompiled header using CXX handling.
 | 
|---|
| 258 | TOOL_VCC143X86-PCH_EXTENDS                 := VCC143X86
 | 
|---|
| 259 | TOOL_VCC143X86-PCH_CXXOBJSUFF              := .obj
 | 
|---|
| 260 | TOOL_VCC143X86-PCH_CXXINCS                  = $(TOOL_VCC143X86_CXXINCS)
 | 
|---|
| 261 | TOOL_VCC143X86-PCH_CXXFLAGS                 = $(TOOL_VCC143X86_CXXFLAGS) -FS
 | 
|---|
| 262 | TOOL_VCC143X86-PCH_CXXFLAGS.debug           = $(TOOL_VCC143X86_CXXFLAGS.debug)
 | 
|---|
| 263 | TOOL_VCC143X86-PCH_CXXFLAGS.dbgopt          = $(TOOL_VCC143X86_CXXFLAGS.dbgopt)
 | 
|---|
| 264 | TOOL_VCC143X86-PCH_CXXFLAGS.release         = $(TOOL_VCC143X86_CXXFLAGS.release)
 | 
|---|
| 265 | TOOL_VCC143X86-PCH_CXXFLAGS.profile         = $(TOOL_VCC143X86_CXXFLAGS.profile)
 | 
|---|
| 266 | TOOL_VCC143X86-PCH_COMPILE_CXX_DEPEND       = $(NO_SUCH_VARIABLE)
 | 
|---|
| 267 | TOOL_VCC143X86-PCH_COMPILE_CXX_DEPORD       = $(NO_SUCH_VARIABLE)
 | 
|---|
| 268 | TOOL_VCC143X86-PCH_COMPILE_CXX_OUTPUT       = $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
 | 
|---|
| 269 | TOOL_VCC143X86-PCH_COMPILE_CXX_OUTPUT_MAYBE = $(NO_SUCH_VARIABLE)
 | 
|---|
| 270 | ifdef TOOL_VCC143X86_KSUBMIT
 | 
|---|
| 271 |  define TOOL_VCC143X86-PCH_COMPILE_CXX_CMDS
 | 
|---|
| 272 |         $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
 | 
|---|
| 273 |         $(QUIET)$(TOOL_VCC143X86_KSUBMIT) --no-pch-caching -P $(DEP_OBJ_INT) -f -s -q -e .pch -o $(dep) -t $(obj) $(obj)\
 | 
|---|
| 274 |                 -- $(TOOL_VCC143X86_CXX) -c -Yc -d1scalableinclude-\
 | 
|---|
| 275 |                 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
 | 
|---|
| 276 |                -Fp$($(target)_1_VCC_PCH_FILE) \
 | 
|---|
| 277 |                 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
 | 
|---|
| 278 |                 -Fo$(obj)\
 | 
|---|
| 279 |                -TP \
 | 
|---|
| 280 |                 $(subst /,\\,$(abspath $(source)))
 | 
|---|
| 281 |  endef
 | 
|---|
| 282 | else
 | 
|---|
| 283 |  define TOOL_VCC143X86-PCH_COMPILE_CXX_CMDS
 | 
|---|
| 284 |         $(QUIET)$(RM) -f -- $($(target)_1_VCC_PCH_FILE) $($(target)_1_VCC_COMMON_OBJ_PDB)
 | 
|---|
| 285 |         $(QUIET)$(TOOL_VCC143X86_SETUP_ENV)$(TOOL_VCC143X86_CXX) -c -Yc\
 | 
|---|
| 286 |                 $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
 | 
|---|
| 287 |                -Fp$($(target)_1_VCC_PCH_FILE) \
 | 
|---|
| 288 |                 -Fd$($(target)_1_VCC_COMMON_OBJ_PDB) \
 | 
|---|
| 289 |                 -Fo$(obj)\
 | 
|---|
| 290 |                -TP \
 | 
|---|
| 291 |                 $(subst /,\\,$(abspath $(source)))
 | 
|---|
| 292 |         $(QUIET)$(DEP_OBJ) -f -s -q  -e .pch -o $(dep) -t $(obj) $(obj)
 | 
|---|
| 293 | 
 | 
|---|
| 294 |  endef
 | 
|---|
| 295 | endif # !TOOL_VCC143X86_KSUBMIT
 | 
|---|
| 296 | 
 | 
|---|
| 297 | 
 | 
|---|
| 298 | ## @todo configure the assembler template.
 | 
|---|
| 299 | 
 | 
|---|
| 300 | ## Compile resource source.
 | 
|---|
| 301 | # @param    $(target)   Normalized main target name.
 | 
|---|
| 302 | # @param    $(source)   Source filename (relative).
 | 
|---|
| 303 | # @param    $(obj)      Object file name. This shall be (re)created by the compilation.
 | 
|---|
| 304 | # @param    $(dep)      Dependcy file. This shall be (re)created by the compilation.
 | 
|---|
| 305 | # @param    $(flags)    Flags.
 | 
|---|
| 306 | # @param    $(defs)     Definitions. No -D or something.
 | 
|---|
| 307 | # @param    $(incs)     Includes. No -I or something.
 | 
|---|
| 308 | # @param    $(dirdep)   Directory creation dependency.
 | 
|---|
| 309 | # @param    $(deps)     Other dependencies.
 | 
|---|
| 310 | #
 | 
|---|
| 311 | # @param    $(outbase)  Output basename (full). Use this for list files and such.
 | 
|---|
| 312 | # @param    $(objsuff)  Object suffix.
 | 
|---|
| 313 | TOOL_VCC143X86_COMPILE_RC_DEPEND =
 | 
|---|
| 314 | TOOL_VCC143X86_COMPILE_RC_DEPORD =
 | 
|---|
| 315 | TOOL_VCC143X86_COMPILE_RC_OUTPUT =
 | 
|---|
| 316 | define TOOL_VCC143X86_COMPILE_RC_CMDS
 | 
|---|
| 317 |         $(QUIET)$(TOOL_VCC143X86_RC) \
 | 
|---|
| 318 |                 $(flags) $(qaddprefix sh,/i, $(subst /,\\,$(incs))) $(qaddprefix sh,/d, $(defs))\
 | 
|---|
| 319 |                 /fo$(obj)\
 | 
|---|
| 320 |                 $(subst /,\\,$(abspath $(source)))
 | 
|---|
| 321 | endef
 | 
|---|
| 322 | 
 | 
|---|
| 323 | 
 | 
|---|
| 324 | ## Link library
 | 
|---|
| 325 | # @param    $(target)   Normalized main target name.
 | 
|---|
| 326 | # @param    $(out)      Library name.
 | 
|---|
| 327 | # @param    $(objs)     Object files to put in the library.
 | 
|---|
| 328 | # @param    $(flags)    Flags.
 | 
|---|
| 329 | # @param    $(dirdep)   Directory creation dependency.
 | 
|---|
| 330 | # @param    $(deps)     Other dependencies.
 | 
|---|
| 331 | # @param    $(othersrc) Unhandled sources.
 | 
|---|
| 332 | # @param    $(outbase)  Output basename (full). Use this for list files and such.
 | 
|---|
| 333 | #
 | 
|---|
| 334 | TOOL_VCC143X86_LINK_LIBRARY_DEPEND = $(othersrc)
 | 
|---|
| 335 | TOOL_VCC143X86_LINK_LIBRARY_DEPORD =
 | 
|---|
| 336 | TOOL_VCC143X86_LINK_LIBRARY_OUTPUT = $(outbase).rsp
 | 
|---|
| 337 | TOOL_VCC143X86_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).lst $(outbase).exp $(outbase).pdb
 | 
|---|
| 338 | define TOOL_VCC143X86_LINK_LIBRARY_CMDS
 | 
|---|
| 339 |         $(QUIET)$(APPEND) -tn $(outbase).rsp \
 | 
|---|
| 340 |                 $(qforeachfile u,arg, $(objs) $(filter-out %.def,$(othersrc)),$(quote-sh "$(subst /,\,$(arg))")) \
 | 
|---|
| 341 |                 $(qforeachfile u,arg, $(filter %.def,$(othersrc)),$(quote-sh "/DEF:$(subst /,\,$(arg))"))
 | 
|---|
| 342 |         $(QUIET)$(TOOL_VCC143X86_KSUBMIT_DD) $(TOOL_VCC143X86_AR) $(flags) /OUT:$(out) @$(outbase).rsp
 | 
|---|
| 343 | endef
 | 
|---|
| 344 | 
 | 
|---|
| 345 | 
 | 
|---|
| 346 | ## Link program
 | 
|---|
| 347 | # @param    $(target)       Normalized main target name.
 | 
|---|
| 348 | # @param    $(out)          Program name.
 | 
|---|
| 349 | # @param    $(objs)         Object files to link together.
 | 
|---|
| 350 | # @param    $(libs)         Libraries to search.
 | 
|---|
| 351 | # @param    $(libpath)      Library search paths.
 | 
|---|
| 352 | # @param    $(flags)        Flags.
 | 
|---|
| 353 | # @param    $(dirdep)       Directory creation dependency.
 | 
|---|
| 354 | # @param    $(deps)         Other dependencies.
 | 
|---|
| 355 | # @param    $(othersrc)     Unhandled sources.
 | 
|---|
| 356 | # @param    $(custom_pre)   Custom step invoked before linking.
 | 
|---|
| 357 | # @param    $(custom_post)  Custom step invoked after linking.
 | 
|---|
| 358 | # @param    $(outbase)      Output basename (full). Use this for list files and such.
 | 
|---|
| 359 | #
 | 
|---|
| 360 | TOOL_VCC143X86_LINK_PROGRAM_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
 | 
|---|
| 361 | TOOL_VCC143X86_LINK_PROGRAM_DEPORD =
 | 
|---|
| 362 | TOOL_VCC143X86_LINK_PROGRAM_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
 | 
|---|
| 363 | TOOL_VCC143X86_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
 | 
|---|
| 364 | TOOL_VCC143X86_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).pdb
 | 
|---|
| 365 | TOOL_VCC143X86_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
 | 
|---|
| 366 | define TOOL_VCC143X86_LINK_PROGRAM_CMDS
 | 
|---|
| 367 |         $(QUIET)$(APPEND) -tn $(outbase).rsp \
 | 
|---|
| 368 |                 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
 | 
|---|
| 369 |         $(QUIET)$(TOOL_VCC143X86_KSUBMIT_DD) $(TOOL_VCC143X86_LD) $(flags) \
 | 
|---|
| 370 |                 /OUT:$(out) \
 | 
|---|
| 371 |                 /MAPINFO:EXPORTS /INCREMENTAL:NO \
 | 
|---|
| 372 |                 /MAP:$(outbase).map \
 | 
|---|
| 373 |                 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
 | 
|---|
| 374 |                 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
 | 
|---|
| 375 |                 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
 | 
|---|
| 376 |                 @$(outbase).rsp
 | 
|---|
| 377 | ifndef TOOL_VCC143X86_NO_AUTO_MANIFEST
 | 
|---|
| 378 |         $(QUIET)$(TEST) -f $(out).manifest -- \
 | 
|---|
| 379 |                 $(TOOL_VCC143X86_MT) -manifest $(subst /,\\,$(out)).manifest -outputresource:$(subst /,\\,$(out))
 | 
|---|
| 380 | endif
 | 
|---|
| 381 | endef
 | 
|---|
| 382 | 
 | 
|---|
| 383 | 
 | 
|---|
| 384 | ## Link DLL.
 | 
|---|
| 385 | # @param    $(target)   Normalized main target name.
 | 
|---|
| 386 | # @param    $(out)      DLL name.
 | 
|---|
| 387 | # @param    $(objs)     Object files to link together.
 | 
|---|
| 388 | # @param    $(libs)     Libraries to search.
 | 
|---|
| 389 | # @param    $(libpath)  Library search paths.
 | 
|---|
| 390 | # @param    $(flags)    Flags.
 | 
|---|
| 391 | # @param    $(dirdep)   Directory creation dependency.
 | 
|---|
| 392 | # @param    $(deps)     Other dependencies.
 | 
|---|
| 393 | # @param    $(othersrc)     Unhandled sources.
 | 
|---|
| 394 | # @param    $(custom_pre)   Custom step invoked before linking.
 | 
|---|
| 395 | # @param    $(custom_post)  Custom step invoked after linking.
 | 
|---|
| 396 | #
 | 
|---|
| 397 | # @param    $(outbase)  Output basename (full). Use this for list files and such.
 | 
|---|
| 398 | TOOL_VCC143X86_LINK_DLL_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
 | 
|---|
| 399 | TOOL_VCC143X86_LINK_DLL_DEPORD = $(call DIRDEP,$(PATH_STAGE_LIB))
 | 
|---|
| 400 | TOOL_VCC143X86_LINK_DLL_OUTPUT = $(outbase).lib $(outbase).exp
 | 
|---|
| 401 | TOOL_VCC143X86_LINK_DLL_OUTPUT_MAYBE = $(outbase).ilk $(out).manifest $(PATH_STAGE_LIB)/$(notdir $(outbase)).exp
 | 
|---|
| 402 | TOOL_VCC143X86_LINK_DLL_OUTPUT_MAYBE_PRECIOUS = $(PATH_STAGE_LIB)/$(notdir $(outbase)).lib $(outbase).map $(outbase).rsp
 | 
|---|
| 403 | TOOL_VCC143X86_LINK_DLL_OUTPUT_DEBUG = $(outbase).pdb
 | 
|---|
| 404 | TOOL_VCC143X86_LINK_DLL_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
 | 
|---|
| 405 | define TOOL_VCC143X86_LINK_DLL_CMDS
 | 
|---|
| 406 |         $(QUIET)$(APPEND) -tn $(outbase).rsp \
 | 
|---|
| 407 |                 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
 | 
|---|
| 408 |         $(QUIET)$(TOOL_VCC143X86_KSUBMIT_DD) $(TOOL_VCC143X86_LD) $(flags) \
 | 
|---|
| 409 |                 /OUT:$(out) \
 | 
|---|
| 410 |                 /IMPLIB:$(outbase).lib \
 | 
|---|
| 411 |                 /MAPINFO:EXPORTS /INCREMENTAL:NO \
 | 
|---|
| 412 |                 /MAP:$(outbase).map \
 | 
|---|
| 413 |                 /DLL \
 | 
|---|
| 414 |                 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
 | 
|---|
| 415 |                 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
 | 
|---|
| 416 |                 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
 | 
|---|
| 417 |                 @$(outbase).rsp
 | 
|---|
| 418 | ifndef TOOL_VCC143X86_NO_AUTO_MANIFEST
 | 
|---|
| 419 |         $(QUIET)$(TEST) -f $(out).manifest -- \
 | 
|---|
| 420 |                 $(TOOL_VCC143X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
 | 
|---|
| 421 | endif
 | 
|---|
| 422 |         $(QUIET)$(TEST) -f $(outbase).lib -- $(KLIBTWEAKER_EXT) --clear-timestamps $(outbase).lib
 | 
|---|
| 423 |         $(QUIET)$(CP) --changed -v --ignore-non-existing $(outbase).exp $(outbase).lib $(PATH_STAGE_LIB)/
 | 
|---|
| 424 | $(eval _DIRS += $(PATH_STAGE_LIB))
 | 
|---|
| 425 | endef
 | 
|---|
| 426 | 
 | 
|---|
| 427 | 
 | 
|---|
| 428 | ## Link system module (windows aka driver, linux aka kernel module)
 | 
|---|
| 429 | # @param    $(target)       Normalized main target name.
 | 
|---|
| 430 | # @param    $(out)          System module name.
 | 
|---|
| 431 | # @param    $(objs)         Object files to link together.
 | 
|---|
| 432 | # @param    $(libs)         Libraries to search.
 | 
|---|
| 433 | # @param    $(libpath)      Library search paths.
 | 
|---|
| 434 | # @param    $(flags)        Flags.
 | 
|---|
| 435 | # @param    $(dirdep)       Directory creation dependency.
 | 
|---|
| 436 | # @param    $(deps)         Other dependencies.
 | 
|---|
| 437 | # @param    $(othersrc)     Unhandled sources.
 | 
|---|
| 438 | # @param    $(custom_pre)   Custom step invoked before linking.
 | 
|---|
| 439 | # @param    $(custom_post)  Custom step invoked after linking.
 | 
|---|
| 440 | #
 | 
|---|
| 441 | # @param    $(outbase)  Output basename (full). Use this for list files and such.
 | 
|---|
| 442 | TOOL_VCC143X86_LINK_SYSMOD_DEPEND = $(foreachfile lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) $(othersrc)
 | 
|---|
| 443 | TOOL_VCC143X86_LINK_SYSMOD_DEPORD =
 | 
|---|
| 444 | TOOL_VCC143X86_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).lib $(outbase).exp $(outbase).ilk $(out).manifest
 | 
|---|
| 445 | TOOL_VCC143X86_LINK_SYSMOD_OUTPUT_MAYBE_PRECIOUS = $(outbase).map $(outbase).rsp
 | 
|---|
| 446 | TOOL_VCC143X86_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).pdb
 | 
|---|
| 447 | TOOL_VCC143X86_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).pdb=>$(basename $(3)).pdb
 | 
|---|
| 448 | define TOOL_VCC143X86_LINK_SYSMOD_CMDS
 | 
|---|
| 449 |         $(QUIET)$(APPEND) -tn $(outbase).rsp \
 | 
|---|
| 450 |                 $(qforeachfile u,arg, $(objs) $(libs),$(quote-sh "$(subst /,\,$(arg))"))
 | 
|---|
| 451 |         $(QUIET)$(TOOL_VCC143X86_KSUBMIT_DD) $(TOOL_VCC143X86_LD) $(flags) \
 | 
|---|
| 452 |                 /OUT:$(out) \
 | 
|---|
| 453 |                 /MAPINFO:EXPORTS /INCREMENTAL:NO \
 | 
|---|
| 454 |                 /MAP:$(outbase).map \
 | 
|---|
| 455 |                 $(foreach def,$(filter %.def,$(othersrc)), /DEF:$(def)) \
 | 
|---|
| 456 |                 $(subst /,\\,$(filter %.exp %.res,$(othersrc))) \
 | 
|---|
| 457 |                 $(qaddprefix sh,/LIBPATH:,$(libpath)) \
 | 
|---|
| 458 |                 @$(outbase).rsp
 | 
|---|
| 459 | ifndef TOOL_VCC143X86_NO_AUTO_MANIFEST
 | 
|---|
| 460 |         $(QUIET)$(TEST) -f $(out).manifest -- \
 | 
|---|
| 461 |                 $(TOOL_VCC143X86_MT) -manifest $(subst /,\\,$(out)).manifest '-outputresource:$(subst /,\\,$(out));#2'
 | 
|---|
| 462 | endif
 | 
|---|
| 463 | endef
 | 
|---|
| 464 | 
 | 
|---|