[665] | 1 | # $Id: LLVMGXX42MACHO.kmk 3580 2023-01-05 02:16:42Z bird $
|
---|
[557] | 2 | ## @file
|
---|
[2547] | 3 | # kBuild Tool Config - LLVM GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code.
|
---|
[557] | 4 | #
|
---|
[1547] | 5 |
|
---|
| 6 | #
|
---|
[3121] | 7 | # Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
|
---|
[557] | 8 | #
|
---|
| 9 | # This file is part of kBuild.
|
---|
| 10 | #
|
---|
| 11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
| 12 | # it under the terms of the GNU General Public License as published by
|
---|
| 13 | # the Free Software Foundation; either version 2 of the License, or
|
---|
| 14 | # (at your option) any later version.
|
---|
| 15 | #
|
---|
| 16 | # kBuild is distributed in the hope that it will be useful,
|
---|
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 19 | # GNU General Public License for more details.
|
---|
| 20 | #
|
---|
| 21 | # You should have received a copy of the GNU General Public License
|
---|
| 22 | # along with kBuild; if not, write to the Free Software
|
---|
| 23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 24 | #
|
---|
| 25 | #
|
---|
[1547] | 26 | # As a special exception you are granted permission to include this file, via
|
---|
[2018] | 27 | # the kmk include directive, as you wish without this in itself causing the
|
---|
| 28 | # resulting makefile, program or whatever to be covered by the GPL license.
|
---|
[1547] | 29 | # This exception does not however invalidate any other reasons why the makefile,
|
---|
| 30 | # program, whatever should not be covered the GPL.
|
---|
| 31 | #
|
---|
| 32 | #
|
---|
[557] | 33 |
|
---|
[2547] | 34 | TOOL_LLVMGXX42MACHO := LLVM GCC v4.2.x targeting Darwin (Mac OS X) Mach-O, for building C++ code.
|
---|
[557] | 35 |
|
---|
[667] | 36 | # Tool Specific Properties
|
---|
[3392] | 37 | ifndef TOOL_LLVMGXX42MACHO_PREFIX
|
---|
| 38 | TOOL_LLVMGXX42MACHO_PREFIX := llvm-
|
---|
| 39 | endif
|
---|
| 40 | ifndef TOOL_LLVMGXX42MACHO_SUFFIX
|
---|
| 41 | TOOL_LLVMGXX42MACHO_SUFFIX := -4.2$(HOSTSUFF_EXE)
|
---|
| 42 | endif
|
---|
[3393] | 43 | TOOL_LLVMGXX42MACHO_PREFIX2 ?=
|
---|
| 44 | TOOL_LLVMGXX42MACHO_SUFFIX2 ?= $(HOSTSUFF_EXE)
|
---|
[2547] | 45 | TOOL_LLVMGXX42MACHO_CC ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
| 46 | TOOL_LLVMGXX42MACHO_CXX ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
[3392] | 47 | TOOL_LLVMGXX42MACHO_PCH ?= $(TOOL_LLVMGXX42MACHO_CXX)
|
---|
[2547] | 48 | TOOL_LLVMGXX42MACHO_OBJC ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
| 49 | TOOL_LLVMGXX42MACHO_OBJCXX ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
| 50 | TOOL_LLVMGXX42MACHO_AS ?= $(TOOL_LLVMGXX42MACHO_PREFIX)gcc$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
| 51 | TOOL_LLVMGXX42MACHO_LD ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
| 52 | TOOL_LLVMGXX42MACHO_LD_SYSMOD ?= $(TOOL_LLVMGXX42MACHO_PREFIX)g++$(TOOL_LLVMGXX42MACHO_SUFFIX)
|
---|
| 53 | TOOL_LLVMGXX42MACHO_LDFLAGS.dll ?= -dynamiclib
|
---|
| 54 | TOOL_LLVMGXX42MACHO_LDFLAGS.sysmod ?= -r
|
---|
| 55 | #TOOL_LLVMGXX42MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
|
---|
[557] | 56 |
|
---|
[3393] | 57 | TOOL_LLVMGXX42MACHO_AR ?= $(TOOL_LLVMGXX42MACHO_PREFIX2)ar$(TOOL_LLVMGXX42MACHO_SUFFIX2)
|
---|
| 58 | TOOL_LLVMGXX42MACHO_DSYMUTIL ?= $(TOOL_LLVMGXX42MACHO_PREFIX2)dsymutil$(TOOL_LLVMGXX42MACHO_SUFFIX2)
|
---|
| 59 | TOOL_LLVMGXX42MACHO_STRIP ?= $(TOOL_LLVMGXX42MACHO_PREFIX2)strip$(TOOL_LLVMGXX42MACHO_SUFFIX2)
|
---|
| 60 | TOOL_LLVMGXX42MACHO_STRIP_PROGRAM ?= $(TOOL_LLVMGXX42MACHO_STRIP) -SXxru
|
---|
| 61 | TOOL_LLVMGXX42MACHO_STRIP_DLL ?= $(TOOL_LLVMGXX42MACHO_STRIP) -Sxru
|
---|
| 62 | TOOL_LLVMGXX42MACHO_STRIP_SYSMOD ?= $(TOOL_LLVMGXX42MACHO_STRIP) -Sru
|
---|
[3392] | 63 |
|
---|
[667] | 64 | # General Properties used by kBuild
|
---|
[2547] | 65 | TOOL_LLVMGXX42MACHO_COBJSUFF ?= .o
|
---|
| 66 | TOOL_LLVMGXX42MACHO_CFLAGS ?=
|
---|
| 67 | TOOL_LLVMGXX42MACHO_CFLAGS.debug ?= -g
|
---|
| 68 | TOOL_LLVMGXX42MACHO_CFLAGS.profile ?= -O2 #-g -pg
|
---|
| 69 | TOOL_LLVMGXX42MACHO_CFLAGS.release ?= -O2
|
---|
| 70 | TOOL_LLVMGXX42MACHO_CINCS ?=
|
---|
| 71 | TOOL_LLVMGXX42MACHO_CDEFS ?=
|
---|
[557] | 72 |
|
---|
[2547] | 73 | TOOL_LLVMGXX42MACHO_CXXOBJSUFF ?= .o
|
---|
| 74 | TOOL_LLVMGXX42MACHO_CXXFLAGS ?=
|
---|
| 75 | TOOL_LLVMGXX42MACHO_CXXFLAGS.debug ?= -g
|
---|
| 76 | TOOL_LLVMGXX42MACHO_CXXFLAGS.profile ?= -O2 #-g -pg
|
---|
| 77 | TOOL_LLVMGXX42MACHO_CXXFLAGS.release ?= -O2
|
---|
| 78 | TOOL_LLVMGXX42MACHO_CXXINCS ?=
|
---|
| 79 | TOOL_LLVMGXX42MACHO_CXXDEFS ?=
|
---|
[667] | 80 |
|
---|
[3258] | 81 | TOOL_LLVMGXX42MACHO_PCHOBJSUFF ?= .h.gch
|
---|
| 82 | TOOL_LLVMGXX42MACHO_PCHFLAGS ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS)
|
---|
| 83 | TOOL_LLVMGXX42MACHO_PCHFLAGS.debug ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS.debug)
|
---|
| 84 | TOOL_LLVMGXX42MACHO_PCHFLAGS.profile ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS.profile)
|
---|
| 85 | TOOL_LLVMGXX42MACHO_PCHFLAGS.release ?= $(TOOL_LLVMGXX42MACHO_CXXFLAGS.release)
|
---|
| 86 | TOOL_LLVMGXX42MACHO_PCHINCS ?= $(TOOL_LLVMGXX42MACHO_CXXINCS)
|
---|
| 87 | TOOL_LLVMGXX42MACHO_PCHDEFS ?= $(TOOL_LLVMGXX42MACHO_CXXDEFS)
|
---|
| 88 |
|
---|
[2547] | 89 | TOOL_LLVMGXX42MACHO_OBJCOBJSUFF ?= .o
|
---|
| 90 | TOOL_LLVMGXX42MACHO_OBJCFLAGS ?=
|
---|
| 91 | TOOL_LLVMGXX42MACHO_OBJCFLAGS.debug ?= -g
|
---|
| 92 | TOOL_LLVMGXX42MACHO_OBJCFLAGS.profile?= -O2 #-g -pg
|
---|
| 93 | TOOL_LLVMGXX42MACHO_OBJCFLAGS.release?= -O2
|
---|
| 94 | TOOL_LLVMGXX42MACHO_OBJCINCS ?=
|
---|
| 95 | TOOL_LLVMGXX42MACHO_OBJCDEFS ?=
|
---|
[1257] | 96 |
|
---|
[2547] | 97 | TOOL_LLVMGXX42MACHO_OBJCXXOBJSUFF ?= .o
|
---|
| 98 | TOOL_LLVMGXX42MACHO_OBJCXXFLAGS ?=
|
---|
| 99 | TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.debug ?= -g
|
---|
| 100 | TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
|
---|
| 101 | TOOL_LLVMGXX42MACHO_OBJCXXFLAGS.release ?= -O2
|
---|
| 102 | TOOL_LLVMGXX42MACHO_OBJCXXINCS ?=
|
---|
| 103 | TOOL_LLVMGXX42MACHO_OBJCXXDEFS ?=
|
---|
[2356] | 104 |
|
---|
[2547] | 105 | TOOL_LLVMGXX42MACHO_ASFLAGS ?= -x assembler-with-cpp
|
---|
| 106 | TOOL_LLVMGXX42MACHO_ASFLAGS.debug ?= -g
|
---|
| 107 | TOOL_LLVMGXX42MACHO_ASFLAGS.profile ?= -g
|
---|
| 108 | TOOL_LLVMGXX42MACHO_ASOBJSUFF ?= .o
|
---|
[667] | 109 |
|
---|
[2547] | 110 | TOOL_LLVMGXX42MACHO_ARFLAGS ?= -c -rs
|
---|
| 111 | TOOL_LLVMGXX42MACHO_ARLIBSUFF ?= .a
|
---|
[667] | 112 |
|
---|
[2547] | 113 | TOOL_LLVMGXX42MACHO_LDFLAGS ?=
|
---|
| 114 | TOOL_LLVMGXX42MACHO_LDFLAGS.debug ?= -g
|
---|
| 115 | TOOL_LLVMGXX42MACHO_LDFLAGS.profile ?= -g
|
---|
[667] | 116 |
|
---|
| 117 |
|
---|
[2535] | 118 |
|
---|
[2527] | 119 | ##
|
---|
| 120 | # Calculate the files in the debug bundle.
|
---|
| 121 | # @param 1 The whole output filename.
|
---|
| 122 | # @param 2 The output filename sans suffix.
|
---|
[2547] | 123 | TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN = \
|
---|
[2527] | 124 | $(1).dSYM/ \
|
---|
| 125 | $(1).dSYM/Contents/ \
|
---|
| 126 | $(1).dSYM/Contents/Resources/ \
|
---|
| 127 | $(1).dSYM/Contents/Resources/DWARF/ \
|
---|
| 128 | $(1).dSYM/Contents/Info.plist \
|
---|
| 129 | $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
|
---|
| 130 |
|
---|
| 131 | ##
|
---|
| 132 | # Calculate the files in the debug bundle.
|
---|
| 133 | # @param 1 The whole linker output filename.
|
---|
| 134 | # @param 2 The linker output filename sans suffix.
|
---|
| 135 | # @param 3 The desired install name (no dir slash).
|
---|
[2535] | 136 | # @remarks The Info.plist has some reference to the original name, but gdb
|
---|
| 137 | # does not care and only check for a symbol file in the DWARF
|
---|
| 138 | # directory with the same name as the debugged module.
|
---|
[2547] | 139 | TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN= \
|
---|
[2527] | 140 | $(3).dSYM/ \
|
---|
| 141 | $(3).dSYM/Contents/ \
|
---|
| 142 | $(3).dSYM/Contents/Resources/ \
|
---|
| 143 | $(3).dSYM/Contents/Resources/DWARF/ \
|
---|
| 144 | $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
|
---|
[2535] | 145 | $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3))
|
---|
[2527] | 146 |
|
---|
| 147 |
|
---|
[557] | 148 | ## Compile C source.
|
---|
| 149 | # @param $(target) Normalized main target name.
|
---|
| 150 | # @param $(source) Source filename (relative).
|
---|
| 151 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
| 152 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 153 | # @param $(flags) Flags.
|
---|
| 154 | # @param $(defs) Definitions. No -D or something.
|
---|
| 155 | # @param $(incs) Includes. No -I or something.
|
---|
| 156 | # @param $(dirdep) Directory creation dependency.
|
---|
| 157 | # @param $(deps) Other dependencies.
|
---|
| 158 | #
|
---|
| 159 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 160 | # @param $(objsuff) Object suffix.
|
---|
[2547] | 161 | TOOL_LLVMGXX42MACHO_COMPILE_C_DEPEND =
|
---|
| 162 | TOOL_LLVMGXX42MACHO_COMPILE_C_DEPORD =
|
---|
[3258] | 163 | TOOL_LLVMGXX42MACHO_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
|
---|
| 164 | TOOL_LLVMGXX42MACHO_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
---|
[2547] | 165 | define TOOL_LLVMGXX42MACHO_COMPILE_C_CMDS
|
---|
[3258] | 166 | if "$(use_objcache)" != ""
|
---|
[1052] | 167 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
| 168 | --kObjCache-cpp $(outbase).i\
|
---|
[2547] | 169 | $(TOOL_LLVMGXX42MACHO_CC) -E -o -\
|
---|
[3579] | 170 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[1013] | 171 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
[1052] | 172 | $(abspath $(source))\
|
---|
| 173 | --kObjCache-cc $(obj)\
|
---|
[2547] | 174 | $(TOOL_LLVMGXX42MACHO_CC) -c\
|
---|
[1052] | 175 | $(flags) -fpreprocessed -x c\
|
---|
[1013] | 176 | -o $(obj)\
|
---|
[1052] | 177 | -
|
---|
[3258] | 178 | else
|
---|
[2547] | 179 | $(QUIET)$(TOOL_LLVMGXX42MACHO_CC) -c\
|
---|
[3579] | 180 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[557] | 181 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 182 | -o $(obj)\
|
---|
[697] | 183 | $(abspath $(source))
|
---|
[3258] | 184 | endif
|
---|
[2431] | 185 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[557] | 186 | endef
|
---|
| 187 |
|
---|
| 188 |
|
---|
| 189 | ## Compile C++ source.
|
---|
| 190 | # @param $(target) Normalized main target name.
|
---|
| 191 | # @param $(source) Source filename (relative).
|
---|
| 192 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
[3258] | 193 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
[557] | 194 | # @param $(flags) Flags.
|
---|
| 195 | # @param $(defs) Definitions. No -D or something.
|
---|
| 196 | # @param $(incs) Includes. No -I or something.
|
---|
| 197 | # @param $(dirdep) Directory creation dependency.
|
---|
[3258] | 198 | # @param $(deps) Other dependencies.
|
---|
[557] | 199 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 200 | # @param $(objsuff) Object suffix.
|
---|
[3258] | 201 | TOOL_LLVMGXX42MACHO_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
|
---|
| 202 | TOOL_LLVMGXX42MACHO_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
|
---|
| 203 | TOOL_LLVMGXX42MACHO_COMPILE_CXX_DEPORD =
|
---|
| 204 | TOOL_LLVMGXX42MACHO_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
---|
[2547] | 205 | define TOOL_LLVMGXX42MACHO_COMPILE_CXX_CMDS
|
---|
[3258] | 206 | if "$(use_objcache)" != ""
|
---|
[1052] | 207 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
| 208 | --kObjCache-cpp $(outbase).ii\
|
---|
[3258] | 209 | $(TOOL_LLVMGXX42MACHO_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
|
---|
| 210 | ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
|
---|
[3579] | 211 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[1013] | 212 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
[1052] | 213 | $(abspath $(source))\
|
---|
| 214 | --kObjCache-cc $(obj)\
|
---|
[2547] | 215 | $(TOOL_LLVMGXX42MACHO_CXX) -c\
|
---|
[3258] | 216 | $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
|
---|
[1013] | 217 | -o $(obj)\
|
---|
[1052] | 218 | -
|
---|
[3258] | 219 | else
|
---|
| 220 | $(QUIET)$(TOOL_LLVMGXX42MACHO_CXX) -c\
|
---|
[3580] | 221 | $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[3258] | 222 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 223 | -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
|
---|
| 224 | ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
|
---|
| 225 | $(abspath $(source))
|
---|
| 226 | endif
|
---|
[2431] | 227 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[1013] | 228 | endef
|
---|
[3258] | 229 |
|
---|
| 230 |
|
---|
| 231 | ## Precompile C++ header.
|
---|
| 232 | # @param $(target) Normalized main target name.
|
---|
| 233 | # @param $(source) Source filename (relative).
|
---|
| 234 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
| 235 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 236 | # @param $(flags) Flags.
|
---|
| 237 | # @param $(defs) Definitions. No -D or something.
|
---|
| 238 | # @param $(incs) Includes. No -I or something.
|
---|
| 239 | # @param $(dirdep) Directory creation dependency.
|
---|
| 240 | # @param $(deps) Other dependencies.
|
---|
| 241 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 242 | # @param $(objsuff) Object suffix.
|
---|
| 243 | TOOL_LLVMGXX42MACHO_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
|
---|
| 244 | TOOL_LLVMGXX42MACHO_COMPILE_PCH_DEPEND =
|
---|
| 245 | TOOL_LLVMGXX42MACHO_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
|
---|
| 246 | define TOOL_LLVMGXX42MACHO_COMPILE_PCH_CMDS
|
---|
| 247 | $(QUIET)$(TOOL_LLVMGXX42MACHO_PCH) -c\
|
---|
[3580] | 248 | $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[557] | 249 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 250 | -o $(obj)\
|
---|
[697] | 251 | $(abspath $(source))
|
---|
[3258] | 252 | $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
|
---|
[2431] | 253 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[557] | 254 | endef
|
---|
| 255 |
|
---|
| 256 |
|
---|
[1257] | 257 | ## Compile Objective-C source.
|
---|
| 258 | # @param $(target) Normalized main target name.
|
---|
| 259 | # @param $(source) Source filename (relative).
|
---|
| 260 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
| 261 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 262 | # @param $(flags) Flags.
|
---|
| 263 | # @param $(defs) Definitions. No -D or something.
|
---|
| 264 | # @param $(incs) Includes. No -I or something.
|
---|
| 265 | # @param $(dirdep) Directory creation dependency.
|
---|
| 266 | # @param $(deps) Other dependencies.
|
---|
| 267 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 268 | # @param $(objsuff) Object suffix.
|
---|
[2547] | 269 | TOOL_LLVMGXX42MACHO_COMPILE_OBJC_DEPEND =
|
---|
| 270 | TOOL_LLVMGXX42MACHO_COMPILE_OBJC_DEPORD =
|
---|
[1418] | 271 | ifdef KBUILD_USE_KOBJCACHE
|
---|
[2547] | 272 | TOOL_LLVMGXX42MACHO_COMPILE_OBJC_USES_KOBJCACHE = 1
|
---|
| 273 | TOOL_LLVMGXX42MACHO_COMPILE_OBJC_OUTPUT = $(outbase).mi
|
---|
| 274 | define TOOL_LLVMGXX42MACHO_COMPILE_OBJC_CMDS
|
---|
[1257] | 275 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
| 276 | --kObjCache-cpp $(outbase).ii\
|
---|
[2547] | 277 | $(TOOL_LLVMGXX42MACHO_OBJC) -E -o -\
|
---|
[3579] | 278 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[1257] | 279 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 280 | $(abspath $(source))\
|
---|
| 281 | --kObjCache-cc $(obj)\
|
---|
[2547] | 282 | $(TOOL_LLVMGXX42MACHO_OBJC) -c\
|
---|
[1257] | 283 | $(flags) -fpreprocessed -x objective-c \
|
---|
| 284 | -o $(obj)\
|
---|
| 285 | -
|
---|
[2431] | 286 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[1257] | 287 | endef
|
---|
[1418] | 288 | else # !KBUILD_USE_KOBJCACHE
|
---|
[2547] | 289 | TOOL_LLVMGXX42MACHO_COMPILE_OBJC_OUTPUT =
|
---|
| 290 | define TOOL_LLVMGXX42MACHO_COMPILE_OBJC_CMDS
|
---|
| 291 | $(QUIET)$(TOOL_LLVMGXX42MACHO_OBJC) -c\
|
---|
[3579] | 292 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[1257] | 293 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 294 | -o $(obj)\
|
---|
| 295 | $(abspath $(source))
|
---|
[2431] | 296 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[1257] | 297 | endef
|
---|
[2523] | 298 | endif # !KBUILD_USE_KOBJCACHE
|
---|
[1257] | 299 |
|
---|
| 300 |
|
---|
[2356] | 301 | ## Compile Objective-C++ source.
|
---|
| 302 | # @param $(target) Normalized main target name.
|
---|
| 303 | # @param $(source) Source filename (relative).
|
---|
| 304 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
| 305 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 306 | # @param $(flags) Flags.
|
---|
| 307 | # @param $(defs) Definitions. No -D or something.
|
---|
| 308 | # @param $(incs) Includes. No -I or something.
|
---|
| 309 | # @param $(dirdep) Directory creation dependency.
|
---|
| 310 | # @param $(deps) Other dependencies.
|
---|
| 311 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 312 | # @param $(objsuff) Object suffix.
|
---|
[2547] | 313 | TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_DEPEND =
|
---|
| 314 | TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_DEPORD =
|
---|
[2356] | 315 | ifdef KBUILD_USE_KOBJCACHE
|
---|
[2547] | 316 | TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
|
---|
| 317 | TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
|
---|
| 318 | define TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_CMDS
|
---|
[2356] | 319 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
| 320 | --kObjCache-cpp $(outbase).mii\
|
---|
[2547] | 321 | $(TOOL_LLVMGXX42MACHO_OBJCXX) -E -o -\
|
---|
[3579] | 322 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[2356] | 323 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 324 | $(abspath $(source))\
|
---|
| 325 | --kObjCache-cc $(obj)\
|
---|
[2547] | 326 | $(TOOL_LLVMGXX42MACHO_OBJCXX) -c\
|
---|
[2360] | 327 | $(flags) -fpreprocessed -x objective-c++ \
|
---|
[2356] | 328 | -o $(obj)\
|
---|
| 329 | -
|
---|
[2431] | 330 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[2356] | 331 | endef
|
---|
| 332 | else # !KBUILD_USE_KOBJCACHE
|
---|
[2547] | 333 | TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_OUTPUT =
|
---|
| 334 | define TOOL_LLVMGXX42MACHO_COMPILE_OBJCXX_CMDS
|
---|
| 335 | $(QUIET)$(TOOL_LLVMGXX42MACHO_OBJCXX) -c\
|
---|
[3579] | 336 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[2356] | 337 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 338 | -o $(obj)\
|
---|
| 339 | $(abspath $(source))
|
---|
[2431] | 340 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[2356] | 341 | endef
|
---|
[2523] | 342 | endif # !KBUILD_USE_KOBJCACHE
|
---|
[2356] | 343 |
|
---|
| 344 |
|
---|
[557] | 345 | ## Compile Assembly source.
|
---|
| 346 | # @param $(target) Normalized main target name.
|
---|
| 347 | # @param $(source) Source filename (relative).
|
---|
| 348 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
| 349 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 350 | # @param $(flags) Flags.
|
---|
| 351 | # @param $(defs) Definitions. No -D or something.
|
---|
| 352 | # @param $(incs) Includes. No -I or something.
|
---|
| 353 | # @param $(dirdep) Directory creation dependency.
|
---|
| 354 | # @param $(deps) Other dependencies.
|
---|
| 355 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 356 | # @param $(objsuff) Object suffix.
|
---|
| 357 | #
|
---|
[2547] | 358 | TOOL_LLVMGXX42MACHO_COMPILE_AS_OUTPUT =
|
---|
| 359 | TOOL_LLVMGXX42MACHO_COMPILE_AS_DEPEND =
|
---|
| 360 | TOOL_LLVMGXX42MACHO_COMPILE_AS_DEPORD =
|
---|
| 361 | define TOOL_LLVMGXX42MACHO_COMPILE_AS_CMDS
|
---|
| 362 | $(QUIET)$(TOOL_LLVMGXX42MACHO_AS) -c\
|
---|
[3579] | 363 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[557] | 364 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 365 | -o $(obj)\
|
---|
[697] | 366 | $(abspath $(source))
|
---|
[2431] | 367 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[557] | 368 | endef
|
---|
| 369 |
|
---|
| 370 |
|
---|
| 371 | ## Link library
|
---|
| 372 | # @param $(target) Normalized main target name.
|
---|
| 373 | # @param $(out) Library name.
|
---|
| 374 | # @param $(objs) Object files to put in the library.
|
---|
| 375 | # @param $(flags) Flags.
|
---|
| 376 | # @param $(dirdep) Directory creation dependency.
|
---|
| 377 | # @param $(deps) Other dependencies.
|
---|
| 378 | # @param $(othersrc) Unhandled sources.
|
---|
| 379 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[2547] | 380 | TOOL_LLVMGXX42MACHO_LINK_LIBRARY_OUTPUT =
|
---|
| 381 | TOOL_LLVMGXX42MACHO_LINK_LIBRARY_DEPEND = $(othersrc)
|
---|
| 382 | TOOL_LLVMGXX42MACHO_LINK_LIBRARY_DEPORD =
|
---|
| 383 | define TOOL_LLVMGXX42MACHO_LINK_LIBRARY_CMDS
|
---|
[3258] | 384 | $(if $(strip $(filter-out %.h.gch,$(objs))),$(call xargs,$(QUIET)$(TOOL_LLVMGXX42MACHO_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs))))
|
---|
[844] | 385 | $(foreach lib,$(othersrc)\
|
---|
| 386 | ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
|
---|
| 387 | $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
|
---|
| 388 | $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
|
---|
| 389 | $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
|
---|
[2547] | 390 | && $(TOOL_LLVMGXX42MACHO_AR) -x $(abspath $(lib)) \
|
---|
[856] | 391 | && $(RM_EXT) -f ./__.SYMDEF* \
|
---|
[2547] | 392 | && $(TOOL_LLVMGXX42MACHO_AR) $(flags) $(out) *) \
|
---|
[844] | 393 | $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
|
---|
| 394 | $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
|
---|
[557] | 395 | endef
|
---|
| 396 |
|
---|
| 397 |
|
---|
| 398 | ## Link program
|
---|
| 399 | # @param $(target) Normalized main target name.
|
---|
| 400 | # @param $(out) Program name.
|
---|
| 401 | # @param $(objs) Object files to link together.
|
---|
| 402 | # @param $(libs) Libraries to search.
|
---|
| 403 | # @param $(libpath) Library search paths.
|
---|
| 404 | # @param $(flags) Flags.
|
---|
| 405 | # @param $(dirdep) Directory creation dependency.
|
---|
| 406 | # @param $(deps) Other dependencies.
|
---|
| 407 | # @param $(othersrc) Unhandled sources.
|
---|
| 408 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
| 409 | # @param $(custom_post) Custom step invoked after linking.
|
---|
| 410 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[2547] | 411 | TOOL_LLVMGXX42MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
|
---|
| 412 | TOOL_LLVMGXX42MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out))
|
---|
| 413 | TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN)
|
---|
| 414 | TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
|
---|
| 415 | TOOL_LLVMGXX42MACHO_LINK_PROGRAM_DEPORD =
|
---|
| 416 | define TOOL_LLVMGXX42MACHO_LINK_PROGRAM_CMDS
|
---|
[3258] | 417 | $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
|
---|
[2547] | 418 | $(QUIET)$(TOOL_LLVMGXX42MACHO_LD) $(flags) -o $(out)\
|
---|
[844] | 419 | -filelist $(outbase).rsp\
|
---|
[557] | 420 | $(foreach p,$(libpath), -L$(p))\
|
---|
[1259] | 421 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
---|
[2523] | 422 | ifeq ($(ld_debug),split)
|
---|
[2547] | 423 | $(QUIET)$(TOOL_LLVMGXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
|
---|
| 424 | $(QUIET)$(TOOL_LLVMGXX42MACHO_STRIP_PROGRAM) $(out)
|
---|
[2523] | 425 | endif
|
---|
[557] | 426 | endef
|
---|
| 427 |
|
---|
| 428 |
|
---|
| 429 | ## Link DLL
|
---|
| 430 | # @param $(target) Normalized main target name.
|
---|
| 431 | # @param $(out) Program name.
|
---|
| 432 | # @param $(objs) Object files to link together.
|
---|
| 433 | # @param $(libs) Libraries to search.
|
---|
| 434 | # @param $(libpath) Library search paths.
|
---|
| 435 | # @param $(flags) Flags.
|
---|
| 436 | # @param $(dirdep) Directory creation dependency.
|
---|
| 437 | # @param $(deps) Other dependencies.
|
---|
| 438 | # @param $(othersrc) Unhandled sources.
|
---|
| 439 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
| 440 | # @param $(custom_post) Custom step invoked after linking.
|
---|
| 441 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[2547] | 442 | TOOL_LLVMGXX42MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
|
---|
| 443 | TOOL_LLVMGXX42MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out))
|
---|
| 444 | TOOL_LLVMGXX42MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN)
|
---|
| 445 | TOOL_LLVMGXX42MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
|
---|
| 446 | TOOL_LLVMGXX42MACHO_LINK_DLL_DEPORD =
|
---|
| 447 | define TOOL_LLVMGXX42MACHO_LINK_DLL_CMDS
|
---|
[3258] | 448 | $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
|
---|
[2547] | 449 | $(QUIET)$(TOOL_LLVMGXX42MACHO_LD) $(TOOL_LLVMGXX42MACHO_LDFLAGS.dll) $(flags) -o $(out)\
|
---|
| 450 | $(call TOOL_LLVMGXX42MACHO_LD_SONAME,$(target),$(out))\
|
---|
[844] | 451 | -filelist $(outbase).rsp\
|
---|
[557] | 452 | $(foreach p,$(libpath), -L$(p))\
|
---|
[1259] | 453 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
---|
[2523] | 454 | ifeq ($(ld_debug),split)
|
---|
[2547] | 455 | $(QUIET)$(TOOL_LLVMGXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
|
---|
| 456 | $(QUIET)$(TOOL_LLVMGXX42MACHO_STRIP_DLL) $(out)
|
---|
[2523] | 457 | endif
|
---|
[557] | 458 | endef
|
---|
| 459 |
|
---|
| 460 |
|
---|
| 461 | ## Link system module (windows aka driver, linux aka kernel module)
|
---|
| 462 | # @param $(target) Normalized main target name.
|
---|
| 463 | # @param $(out) System module name.
|
---|
| 464 | # @param $(objs) Object files to link together.
|
---|
| 465 | # @param $(libs) Libraries to search.
|
---|
| 466 | # @param $(libpath) Library search paths.
|
---|
| 467 | # @param $(flags) Flags.
|
---|
| 468 | # @param $(dirdep) Directory creation dependency.
|
---|
| 469 | # @param $(deps) Other dependencies.
|
---|
| 470 | # @param $(othersrc) Unhandled sources.
|
---|
| 471 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
| 472 | # @param $(custom_post) Custom step invoked after linking.
|
---|
| 473 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[2547] | 474 | TOOL_LLVMGXX42MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
|
---|
| 475 | TOOL_LLVMGXX42MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_LLVMGXX42MACHO_DEBUG_BUNDLE_FN,$(out))
|
---|
| 476 | TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_LLVMGXX42MACHO_DEBUG_INSTALL_FN)
|
---|
| 477 | TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
|
---|
| 478 | TOOL_LLVMGXX42MACHO_LINK_SYSMOD_DEPORD =
|
---|
| 479 | define TOOL_LLVMGXX42MACHO_LINK_SYSMOD_CMDS
|
---|
[3258] | 480 | $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
|
---|
[2547] | 481 | $(QUIET)$(TOOL_LLVMGXX42MACHO_LD_SYSMOD) $(TOOL_LLVMGXX42MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
|
---|
[844] | 482 | -filelist $(outbase).rsp\
|
---|
[557] | 483 | $(foreach p,$(libpath), -L$(p))\
|
---|
[1259] | 484 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
---|
[2523] | 485 | ifeq ($(ld_debug),split)
|
---|
[2547] | 486 | $(QUIET)$(TOOL_LLVMGXX42MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
|
---|
| 487 | $(QUIET)$(TOOL_LLVMGXX42MACHO_STRIP_SYSMOD) $(out)
|
---|
[2523] | 488 | endif
|
---|
[557] | 489 | endef
|
---|
| 490 |
|
---|