[665] | 1 | # $Id: GXX4MACHO.kmk 3567 2022-06-26 20:00:02Z bird $
|
---|
[557] | 2 | ## @file
|
---|
[2547] | 3 | # kBuild Tool Config - GCC v4 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_GXX4MACHO := GCC v4 targeting Darwin (Mac OS X) Mach-O, for building C++ code.
|
---|
[557] | 35 |
|
---|
[667] | 36 | # Tool Specific Properties
|
---|
[3391] | 37 | ifndef TOOL_GXX4MACHO_PREFIX
|
---|
| 38 | TOOL_GXX4MACHO_PREFIX :=
|
---|
| 39 | endif
|
---|
| 40 | ifndef TOOL_GXX4MACHO_SUFFIX
|
---|
| 41 | TOOL_GXX4MACHO_SUFFIX := $(HOSTSUFF_EXE)
|
---|
| 42 | endif
|
---|
[3393] | 43 | TOOL_GXX4MACHO_PREFIX2 ?=
|
---|
| 44 | TOOL_GXX4MACHO_SUFFIX2 ?= $(HOSTSUFF_EXE)
|
---|
[2379] | 45 | TOOL_GXX4MACHO_CC ?= $(TOOL_GXX4MACHO_PREFIX)gcc$(TOOL_GXX4MACHO_SUFFIX)
|
---|
| 46 | TOOL_GXX4MACHO_CXX ?= $(TOOL_GXX4MACHO_PREFIX)g++$(TOOL_GXX4MACHO_SUFFIX)
|
---|
[3391] | 47 | TOOL_GXX4MACHO_PCH ?= $(TOOL_GXX4MACHO_CXX)
|
---|
[2379] | 48 | TOOL_GXX4MACHO_OBJC ?= $(TOOL_GXX4MACHO_PREFIX)gcc$(TOOL_GXX4MACHO_SUFFIX)
|
---|
| 49 | TOOL_GXX4MACHO_OBJCXX ?= $(TOOL_GXX4MACHO_PREFIX)gcc$(TOOL_GXX4MACHO_SUFFIX)
|
---|
| 50 | TOOL_GXX4MACHO_AS ?= $(TOOL_GXX4MACHO_PREFIX)gcc$(TOOL_GXX4MACHO_SUFFIX)
|
---|
| 51 | TOOL_GXX4MACHO_LD ?= $(TOOL_GXX4MACHO_PREFIX)g++$(TOOL_GXX4MACHO_SUFFIX)
|
---|
| 52 | TOOL_GXX4MACHO_LD_SYSMOD ?= $(TOOL_GXX4MACHO_PREFIX)g++$(TOOL_GXX4MACHO_SUFFIX)
|
---|
[971] | 53 | TOOL_GXX4MACHO_LDFLAGS.dll ?= -dynamiclib
|
---|
| 54 | TOOL_GXX4MACHO_LDFLAGS.sysmod ?= -r
|
---|
[1504] | 55 | #TOOL_GXX4MACHO_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_GXX4MACHO_AR ?= $(TOOL_GXX4MACHO_PREFIX2)ar$(TOOL_GXX4MACHO_SUFFIX2)
|
---|
| 58 | TOOL_GXX4MACHO_DSYMUTIL ?= $(TOOL_GXX4MACHO_PREFIX2)dsymutil$(TOOL_GXX4MACHO_SUFFIX2)
|
---|
| 59 | TOOL_GXX4MACHO_STRIP ?= $(TOOL_GXX4MACHO_PREFIX2)strip$(TOOL_GXX4MACHO_SUFFIX2)
|
---|
| 60 | TOOL_GXX4MACHO_STRIP_PROGRAM ?= $(TOOL_GXX4MACHO_STRIP) -SXxru
|
---|
| 61 | TOOL_GXX4MACHO_STRIP_DLL ?= $(TOOL_GXX4MACHO_STRIP) -Sxru
|
---|
| 62 | TOOL_GXX4MACHO_STRIP_SYSMOD ?= $(TOOL_GXX4MACHO_STRIP) -Sru
|
---|
| 63 |
|
---|
[667] | 64 | # General Properties used by kBuild
|
---|
[971] | 65 | TOOL_GXX4MACHO_COBJSUFF ?= .o
|
---|
| 66 | TOOL_GXX4MACHO_CFLAGS ?=
|
---|
| 67 | TOOL_GXX4MACHO_CFLAGS.debug ?= -g
|
---|
[1052] | 68 | TOOL_GXX4MACHO_CFLAGS.profile ?= -O2 #-g -pg
|
---|
[971] | 69 | TOOL_GXX4MACHO_CFLAGS.release ?= -O2
|
---|
| 70 | TOOL_GXX4MACHO_CINCS ?=
|
---|
| 71 | TOOL_GXX4MACHO_CDEFS ?=
|
---|
[557] | 72 |
|
---|
[971] | 73 | TOOL_GXX4MACHO_CXXOBJSUFF ?= .o
|
---|
| 74 | TOOL_GXX4MACHO_CXXFLAGS ?=
|
---|
| 75 | TOOL_GXX4MACHO_CXXFLAGS.debug ?= -g
|
---|
[1052] | 76 | TOOL_GXX4MACHO_CXXFLAGS.profile ?= -O2 #-g -pg
|
---|
[971] | 77 | TOOL_GXX4MACHO_CXXFLAGS.release ?= -O2
|
---|
| 78 | TOOL_GXX4MACHO_CXXINCS ?=
|
---|
| 79 | TOOL_GXX4MACHO_CXXDEFS ?=
|
---|
[667] | 80 |
|
---|
[3258] | 81 | TOOL_GXX4MACHO_PCHOBJSUFF ?= .h.gch
|
---|
| 82 | TOOL_GXX4MACHO_PCHFLAGS ?= $(TOOL_GXX4MACHO_CXXFLAGS)
|
---|
| 83 | TOOL_GXX4MACHO_PCHFLAGS.debug ?= $(TOOL_GXX4MACHO_CXXFLAGS.debug)
|
---|
| 84 | TOOL_GXX4MACHO_PCHFLAGS.profile ?= $(TOOL_GXX4MACHO_CXXFLAGS.profile)
|
---|
| 85 | TOOL_GXX4MACHO_PCHFLAGS.release ?= $(TOOL_GXX4MACHO_CXXFLAGS.release)
|
---|
| 86 | TOOL_GXX4MACHO_PCHINCS ?= $(TOOL_GXX4MACHO_CXXINCS)
|
---|
| 87 | TOOL_GXX4MACHO_PCHDEFS ?= $(TOOL_GXX4MACHO_CXXDEFS)
|
---|
| 88 |
|
---|
[1257] | 89 | TOOL_GXX4MACHO_OBJCOBJSUFF ?= .o
|
---|
| 90 | TOOL_GXX4MACHO_OBJCFLAGS ?=
|
---|
| 91 | TOOL_GXX4MACHO_OBJCFLAGS.debug ?= -g
|
---|
| 92 | TOOL_GXX4MACHO_OBJCFLAGS.profile?= -O2 #-g -pg
|
---|
| 93 | TOOL_GXX4MACHO_OBJCFLAGS.release?= -O2
|
---|
| 94 | TOOL_GXX4MACHO_OBJCINCS ?=
|
---|
| 95 | TOOL_GXX4MACHO_OBJCDEFS ?=
|
---|
| 96 |
|
---|
[2356] | 97 | TOOL_GXX4MACHO_OBJCXXOBJSUFF ?= .o
|
---|
| 98 | TOOL_GXX4MACHO_OBJCXXFLAGS ?=
|
---|
| 99 | TOOL_GXX4MACHO_OBJCXXFLAGS.debug ?= -g
|
---|
| 100 | TOOL_GXX4MACHO_OBJCXXFLAGS.profile ?= -O2 #-g -pg
|
---|
| 101 | TOOL_GXX4MACHO_OBJCXXFLAGS.release ?= -O2
|
---|
| 102 | TOOL_GXX4MACHO_OBJCXXINCS ?=
|
---|
| 103 | TOOL_GXX4MACHO_OBJCXXDEFS ?=
|
---|
| 104 |
|
---|
[971] | 105 | TOOL_GXX4MACHO_ASFLAGS ?= -x assembler-with-cpp
|
---|
| 106 | TOOL_GXX4MACHO_ASFLAGS.debug ?= -g
|
---|
| 107 | TOOL_GXX4MACHO_ASFLAGS.profile ?= -g
|
---|
| 108 | TOOL_GXX4MACHO_ASOBJSUFF ?= .o
|
---|
[667] | 109 |
|
---|
[971] | 110 | TOOL_GXX4MACHO_ARFLAGS ?= -c -rs
|
---|
| 111 | TOOL_GXX4MACHO_ARLIBSUFF ?= .a
|
---|
[667] | 112 |
|
---|
[971] | 113 | TOOL_GXX4MACHO_LDFLAGS ?=
|
---|
| 114 | TOOL_GXX4MACHO_LDFLAGS.debug ?= -g
|
---|
| 115 | TOOL_GXX4MACHO_LDFLAGS.profile ?= -g
|
---|
[667] | 116 |
|
---|
| 117 |
|
---|
[2527] | 118 | ##
|
---|
| 119 | # Calculate the files in the debug bundle.
|
---|
| 120 | # @param 1 The whole output filename.
|
---|
| 121 | # @param 2 The output filename sans suffix.
|
---|
| 122 | TOOL_GXX4MACHO_DEBUG_BUNDLE_FN = \
|
---|
| 123 | $(1).dSYM/ \
|
---|
| 124 | $(1).dSYM/Contents/ \
|
---|
| 125 | $(1).dSYM/Contents/Resources/ \
|
---|
| 126 | $(1).dSYM/Contents/Resources/DWARF/ \
|
---|
| 127 | $(1).dSYM/Contents/Info.plist \
|
---|
| 128 | $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
|
---|
| 129 |
|
---|
| 130 | ##
|
---|
| 131 | # Calculate the files in the debug bundle.
|
---|
| 132 | # @param 1 The whole linker output filename.
|
---|
| 133 | # @param 2 The linker output filename sans suffix.
|
---|
| 134 | # @param 3 The desired install name (no dir slash).
|
---|
[2535] | 135 | # @remarks The Info.plist has some reference to the original name, but gdb
|
---|
| 136 | # does not care and only check for a symbol file in the DWARF
|
---|
| 137 | # directory with the same name as the debugged module.
|
---|
[2527] | 138 | TOOL_GXX4MACHO_DEBUG_INSTALL_FN= \
|
---|
| 139 | $(3).dSYM/ \
|
---|
| 140 | $(3).dSYM/Contents/ \
|
---|
| 141 | $(3).dSYM/Contents/Resources/ \
|
---|
| 142 | $(3).dSYM/Contents/Resources/DWARF/ \
|
---|
| 143 | $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
|
---|
[2535] | 144 | $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(3))
|
---|
[2527] | 145 |
|
---|
| 146 |
|
---|
[557] | 147 | ## Compile C source.
|
---|
| 148 | # @param $(target) Normalized main target name.
|
---|
| 149 | # @param $(source) Source filename (relative).
|
---|
| 150 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
| 151 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 152 | # @param $(flags) Flags.
|
---|
| 153 | # @param $(defs) Definitions. No -D or something.
|
---|
| 154 | # @param $(incs) Includes. No -I or something.
|
---|
| 155 | # @param $(dirdep) Directory creation dependency.
|
---|
| 156 | # @param $(deps) Other dependencies.
|
---|
| 157 | #
|
---|
| 158 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 159 | # @param $(objsuff) Object suffix.
|
---|
[971] | 160 | TOOL_GXX4MACHO_COMPILE_C_DEPEND =
|
---|
| 161 | TOOL_GXX4MACHO_COMPILE_C_DEPORD =
|
---|
[3258] | 162 | TOOL_GXX4MACHO_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
|
---|
| 163 | TOOL_GXX4MACHO_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
---|
[971] | 164 | define TOOL_GXX4MACHO_COMPILE_C_CMDS
|
---|
[3258] | 165 | if "$(use_objcache)" != ""
|
---|
[1052] | 166 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
| 167 | --kObjCache-cpp $(outbase).i\
|
---|
[1013] | 168 | $(TOOL_GXX4MACHO_CC) -E -o -\
|
---|
[3566] | 169 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[1013] | 170 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
[1052] | 171 | $(abspath $(source))\
|
---|
| 172 | --kObjCache-cc $(obj)\
|
---|
[1013] | 173 | $(TOOL_GXX4MACHO_CC) -c\
|
---|
[1052] | 174 | $(flags) -fpreprocessed -x c\
|
---|
[1013] | 175 | -o $(obj)\
|
---|
[1052] | 176 | -
|
---|
[3258] | 177 | else
|
---|
[971] | 178 | $(QUIET)$(TOOL_GXX4MACHO_CC) -c\
|
---|
[3566] | 179 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[557] | 180 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 181 | -o $(obj)\
|
---|
[697] | 182 | $(abspath $(source))
|
---|
[3258] | 183 | endif
|
---|
[2431] | 184 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[557] | 185 | endef
|
---|
| 186 |
|
---|
| 187 |
|
---|
| 188 | ## Compile C++ source.
|
---|
| 189 | # @param $(target) Normalized main target name.
|
---|
| 190 | # @param $(source) Source filename (relative).
|
---|
| 191 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
[3258] | 192 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
[557] | 193 | # @param $(flags) Flags.
|
---|
| 194 | # @param $(defs) Definitions. No -D or something.
|
---|
| 195 | # @param $(incs) Includes. No -I or something.
|
---|
| 196 | # @param $(dirdep) Directory creation dependency.
|
---|
[3258] | 197 | # @param $(deps) Other dependencies.
|
---|
[557] | 198 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 199 | # @param $(objsuff) Object suffix.
|
---|
[3258] | 200 | TOOL_GXX4MACHO_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
|
---|
| 201 | TOOL_GXX4MACHO_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
|
---|
| 202 | TOOL_GXX4MACHO_COMPILE_CXX_DEPORD =
|
---|
| 203 | TOOL_GXX4MACHO_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
---|
[971] | 204 | define TOOL_GXX4MACHO_COMPILE_CXX_CMDS
|
---|
[3258] | 205 | if "$(use_objcache)" != ""
|
---|
[1052] | 206 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
| 207 | --kObjCache-cpp $(outbase).ii\
|
---|
[3258] | 208 | $(TOOL_GXX4MACHO_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
|
---|
| 209 | ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
|
---|
[3566] | 210 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[1013] | 211 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
[1052] | 212 | $(abspath $(source))\
|
---|
| 213 | --kObjCache-cc $(obj)\
|
---|
[1013] | 214 | $(TOOL_GXX4MACHO_CXX) -c\
|
---|
[3258] | 215 | $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
|
---|
[1013] | 216 | -o $(obj)\
|
---|
[1052] | 217 | -
|
---|
[3258] | 218 | else
|
---|
[971] | 219 | $(QUIET)$(TOOL_GXX4MACHO_CXX) -c\
|
---|
[3566] | 220 | $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[557] | 221 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
[3258] | 222 | -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
|
---|
| 223 | ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
|
---|
[697] | 224 | $(abspath $(source))
|
---|
[3258] | 225 | endif
|
---|
[2431] | 226 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[557] | 227 | endef
|
---|
| 228 |
|
---|
| 229 |
|
---|
[3258] | 230 | ## Precompile C++ header.
|
---|
[1257] | 231 | # @param $(target) Normalized main target name.
|
---|
| 232 | # @param $(source) Source filename (relative).
|
---|
| 233 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
| 234 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 235 | # @param $(flags) Flags.
|
---|
| 236 | # @param $(defs) Definitions. No -D or something.
|
---|
| 237 | # @param $(incs) Includes. No -I or something.
|
---|
| 238 | # @param $(dirdep) Directory creation dependency.
|
---|
| 239 | # @param $(deps) Other dependencies.
|
---|
| 240 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 241 | # @param $(objsuff) Object suffix.
|
---|
[3258] | 242 | TOOL_GXX4MACHO_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
|
---|
| 243 | TOOL_GXX4MACHO_COMPILE_PCH_DEPEND =
|
---|
| 244 | TOOL_GXX4MACHO_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
|
---|
| 245 | define TOOL_GXX4MACHO_COMPILE_PCH_CMDS
|
---|
| 246 | $(QUIET)$(TOOL_GXX4MACHO_PCH) -c\
|
---|
[3566] | 247 | $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[1257] | 248 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 249 | -o $(obj)\
|
---|
| 250 | $(abspath $(source))
|
---|
[3258] | 251 | $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
|
---|
[2431] | 252 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[1257] | 253 | endef
|
---|
| 254 |
|
---|
| 255 |
|
---|
[2356] | 256 | ## Compile Objective-C++ source.
|
---|
| 257 | # @param $(target) Normalized main target name.
|
---|
| 258 | # @param $(source) Source filename (relative).
|
---|
| 259 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
| 260 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 261 | # @param $(flags) Flags.
|
---|
| 262 | # @param $(defs) Definitions. No -D or something.
|
---|
| 263 | # @param $(incs) Includes. No -I or something.
|
---|
| 264 | # @param $(dirdep) Directory creation dependency.
|
---|
| 265 | # @param $(deps) Other dependencies.
|
---|
| 266 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 267 | # @param $(objsuff) Object suffix.
|
---|
| 268 | TOOL_GXX4MACHO_COMPILE_OBJCXX_DEPEND =
|
---|
| 269 | TOOL_GXX4MACHO_COMPILE_OBJCXX_DEPORD =
|
---|
| 270 | ifdef KBUILD_USE_KOBJCACHE
|
---|
| 271 | TOOL_GXX4MACHO_COMPILE_OBJCXX_USES_KOBJCACHE = 1
|
---|
| 272 | TOOL_GXX4MACHO_COMPILE_OBJCXX_OUTPUT = $(outbase).mii
|
---|
| 273 | define TOOL_GXX4MACHO_COMPILE_OBJCXX_CMDS
|
---|
| 274 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
| 275 | --kObjCache-cpp $(outbase).mii\
|
---|
| 276 | $(TOOL_GXX4MACHO_OBJCXX) -E -o -\
|
---|
[3566] | 277 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[2356] | 278 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 279 | $(abspath $(source))\
|
---|
| 280 | --kObjCache-cc $(obj)\
|
---|
| 281 | $(TOOL_GXX4MACHO_OBJCXX) -c\
|
---|
[2360] | 282 | $(flags) -fpreprocessed -x objective-c++ \
|
---|
[2356] | 283 | -o $(obj)\
|
---|
| 284 | -
|
---|
[2431] | 285 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[2356] | 286 | endef
|
---|
| 287 | else # !KBUILD_USE_KOBJCACHE
|
---|
| 288 | TOOL_GXX4MACHO_COMPILE_OBJCXX_OUTPUT =
|
---|
| 289 | define TOOL_GXX4MACHO_COMPILE_OBJCXX_CMDS
|
---|
| 290 | $(QUIET)$(TOOL_GXX4MACHO_OBJCXX) -c\
|
---|
[3566] | 291 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[2356] | 292 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 293 | -o $(obj)\
|
---|
| 294 | $(abspath $(source))
|
---|
[2431] | 295 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[2356] | 296 | endef
|
---|
[2523] | 297 | endif # !KBUILD_USE_KOBJCACHE
|
---|
[2356] | 298 |
|
---|
| 299 |
|
---|
[557] | 300 | ## Compile Assembly 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 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 311 | # @param $(objsuff) Object suffix.
|
---|
| 312 | #
|
---|
[971] | 313 | TOOL_GXX4MACHO_COMPILE_AS_OUTPUT =
|
---|
| 314 | TOOL_GXX4MACHO_COMPILE_AS_DEPEND =
|
---|
| 315 | TOOL_GXX4MACHO_COMPILE_AS_DEPORD =
|
---|
| 316 | define TOOL_GXX4MACHO_COMPILE_AS_CMDS
|
---|
| 317 | $(QUIET)$(TOOL_GXX4MACHO_AS) -c\
|
---|
[3566] | 318 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[557] | 319 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 320 | -o $(obj)\
|
---|
[697] | 321 | $(abspath $(source))
|
---|
[2431] | 322 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[557] | 323 | endef
|
---|
| 324 |
|
---|
| 325 |
|
---|
| 326 | ## Link library
|
---|
| 327 | # @param $(target) Normalized main target name.
|
---|
| 328 | # @param $(out) Library name.
|
---|
| 329 | # @param $(objs) Object files to put in the library.
|
---|
| 330 | # @param $(flags) Flags.
|
---|
| 331 | # @param $(dirdep) Directory creation dependency.
|
---|
| 332 | # @param $(deps) Other dependencies.
|
---|
| 333 | # @param $(othersrc) Unhandled sources.
|
---|
| 334 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[971] | 335 | TOOL_GXX4MACHO_LINK_LIBRARY_OUTPUT =
|
---|
| 336 | TOOL_GXX4MACHO_LINK_LIBRARY_DEPEND = $(othersrc)
|
---|
| 337 | TOOL_GXX4MACHO_LINK_LIBRARY_DEPORD =
|
---|
| 338 | define TOOL_GXX4MACHO_LINK_LIBRARY_CMDS
|
---|
[3258] | 339 | $(if $(strip $(filter-out %.h.gch,$(objs))),$(call xargs,$(QUIET)$(TOOL_GXX4MACHO_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs))))
|
---|
[844] | 340 | $(foreach lib,$(othersrc)\
|
---|
| 341 | ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
|
---|
| 342 | $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
|
---|
| 343 | $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
|
---|
| 344 | $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
|
---|
[971] | 345 | && $(TOOL_GXX4MACHO_AR) -x $(abspath $(lib)) \
|
---|
[856] | 346 | && $(RM_EXT) -f ./__.SYMDEF* \
|
---|
[971] | 347 | && $(TOOL_GXX4MACHO_AR) $(flags) $(out) *) \
|
---|
[844] | 348 | $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
|
---|
| 349 | $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
|
---|
[557] | 350 | endef
|
---|
| 351 |
|
---|
| 352 |
|
---|
| 353 | ## Link program
|
---|
| 354 | # @param $(target) Normalized main target name.
|
---|
| 355 | # @param $(out) Program name.
|
---|
| 356 | # @param $(objs) Object files to link together.
|
---|
| 357 | # @param $(libs) Libraries to search.
|
---|
| 358 | # @param $(libpath) Library search paths.
|
---|
| 359 | # @param $(flags) Flags.
|
---|
| 360 | # @param $(dirdep) Directory creation dependency.
|
---|
| 361 | # @param $(deps) Other dependencies.
|
---|
| 362 | # @param $(othersrc) Unhandled sources.
|
---|
| 363 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
| 364 | # @param $(custom_post) Custom step invoked after linking.
|
---|
| 365 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[1023] | 366 | TOOL_GXX4MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
|
---|
[2527] | 367 | TOOL_GXX4MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_GXX4MACHO_DEBUG_BUNDLE_FN,$(out))
|
---|
| 368 | TOOL_GXX4MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_GXX4MACHO_DEBUG_INSTALL_FN)
|
---|
[971] | 369 | TOOL_GXX4MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
|
---|
| 370 | TOOL_GXX4MACHO_LINK_PROGRAM_DEPORD =
|
---|
| 371 | define TOOL_GXX4MACHO_LINK_PROGRAM_CMDS
|
---|
[3258] | 372 | $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
|
---|
[971] | 373 | $(QUIET)$(TOOL_GXX4MACHO_LD) $(flags) -o $(out)\
|
---|
[844] | 374 | -filelist $(outbase).rsp\
|
---|
[557] | 375 | $(foreach p,$(libpath), -L$(p))\
|
---|
[1259] | 376 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
---|
[2523] | 377 | ifeq ($(ld_debug),split)
|
---|
[2535] | 378 | $(QUIET)$(TOOL_GXX4MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
|
---|
| 379 | $(QUIET)$(TOOL_GXX4MACHO_STRIP_PROGRAM) $(out)
|
---|
[2523] | 380 | endif
|
---|
[557] | 381 | endef
|
---|
| 382 |
|
---|
| 383 |
|
---|
| 384 | ## Link DLL
|
---|
| 385 | # @param $(target) Normalized main target name.
|
---|
| 386 | # @param $(out) Program 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 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[971] | 397 | TOOL_GXX4MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
|
---|
[2527] | 398 | TOOL_GXX4MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_GXX4MACHO_DEBUG_BUNDLE_FN,$(out))
|
---|
| 399 | TOOL_GXX4MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_GXX4MACHO_DEBUG_INSTALL_FN)
|
---|
[971] | 400 | TOOL_GXX4MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
|
---|
| 401 | TOOL_GXX4MACHO_LINK_DLL_DEPORD =
|
---|
| 402 | define TOOL_GXX4MACHO_LINK_DLL_CMDS
|
---|
[3258] | 403 | $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
|
---|
[971] | 404 | $(QUIET)$(TOOL_GXX4MACHO_LD) $(TOOL_GXX4MACHO_LDFLAGS.dll) $(flags) -o $(out)\
|
---|
| 405 | $(call TOOL_GXX4MACHO_LD_SONAME,$(target),$(out))\
|
---|
[844] | 406 | -filelist $(outbase).rsp\
|
---|
[557] | 407 | $(foreach p,$(libpath), -L$(p))\
|
---|
[1259] | 408 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
---|
[2523] | 409 | ifeq ($(ld_debug),split)
|
---|
[2535] | 410 | $(QUIET)$(TOOL_GXX4MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
|
---|
| 411 | $(QUIET)$(TOOL_GXX4MACHO_STRIP_DLL) $(out)
|
---|
[2523] | 412 | endif
|
---|
[557] | 413 | endef
|
---|
| 414 |
|
---|
| 415 |
|
---|
| 416 | ## Link system module (windows aka driver, linux aka kernel module)
|
---|
| 417 | # @param $(target) Normalized main target name.
|
---|
| 418 | # @param $(out) System module name.
|
---|
| 419 | # @param $(objs) Object files to link together.
|
---|
| 420 | # @param $(libs) Libraries to search.
|
---|
| 421 | # @param $(libpath) Library search paths.
|
---|
| 422 | # @param $(flags) Flags.
|
---|
| 423 | # @param $(dirdep) Directory creation dependency.
|
---|
| 424 | # @param $(deps) Other dependencies.
|
---|
| 425 | # @param $(othersrc) Unhandled sources.
|
---|
| 426 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
| 427 | # @param $(custom_post) Custom step invoked after linking.
|
---|
| 428 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[971] | 429 | TOOL_GXX4MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
|
---|
[2527] | 430 | TOOL_GXX4MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_GXX4MACHO_DEBUG_BUNDLE_FN,$(out))
|
---|
| 431 | TOOL_GXX4MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_GXX4MACHO_DEBUG_INSTALL_FN)
|
---|
[971] | 432 | TOOL_GXX4MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
|
---|
| 433 | TOOL_GXX4MACHO_LINK_SYSMOD_DEPORD =
|
---|
| 434 | define TOOL_GXX4MACHO_LINK_SYSMOD_CMDS
|
---|
[3258] | 435 | $(QUIET)$(APPEND) -n $(outbase).rsp $(filter-out %.h.gch,$(objs))
|
---|
[971] | 436 | $(QUIET)$(TOOL_GXX4MACHO_LD_SYSMOD) $(TOOL_GXX4MACHO_LDFLAGS.sysmod) $(flags) -o $(out)\
|
---|
[844] | 437 | -filelist $(outbase).rsp\
|
---|
[557] | 438 | $(foreach p,$(libpath), -L$(p))\
|
---|
[1259] | 439 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
---|
[2523] | 440 | ifeq ($(ld_debug),split)
|
---|
[2535] | 441 | $(QUIET)$(TOOL_GXX4MACHO_DSYMUTIL) -o $(out).dSYM/ $(out)
|
---|
| 442 | $(QUIET)$(TOOL_GXX4MACHO_STRIP_SYSMOD) $(out)
|
---|
[2523] | 443 | endif
|
---|
[557] | 444 | endef
|
---|
| 445 |
|
---|