[665] | 1 | # $Id: GXX32.kmk 3567 2022-06-26 20:00:02Z bird $
|
---|
[456] | 2 | ## @file
|
---|
[971] | 3 | # kBuild Tool Config - Generic 32-bit GCC v3.2.x or later using the system GCC, for building C++ code.
|
---|
[456] | 4 | #
|
---|
[1547] | 5 |
|
---|
| 6 | #
|
---|
[3121] | 7 | # Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
|
---|
[456] | 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
|
---|
[1612] | 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 | #
|
---|
[456] | 33 |
|
---|
[971] | 34 | TOOL_GXX32 := Generic 32-bit GCC v3.2.x or later using the system GCC, for building C++ code. \
|
---|
[667] | 35 | More or less Linux/ELF specfic.
|
---|
[456] | 36 |
|
---|
[667] | 37 | # Tool Specific Properties
|
---|
[3391] | 38 | ifndef TOOL_GXX32_PREFIX
|
---|
[3393] | 39 | TOOL_GXX32_PREFIX :=
|
---|
[3391] | 40 | endif
|
---|
| 41 | ifndef TOOL_GXX32_SUFFIX
|
---|
[3393] | 42 | TOOL_GXX32_SUFFIX := $(HOSTSUFF_EXE)
|
---|
[3391] | 43 | endif
|
---|
[3393] | 44 | if1of ($(KBUILD_HOST), solaris)
|
---|
| 45 | TOOL_GXX32_PREFIX2 ?= g
|
---|
[3391] | 46 | else
|
---|
[3393] | 47 | TOOL_GXX32_PREFIX2 ?=
|
---|
[3391] | 48 | endif
|
---|
[3393] | 49 | TOOL_GXX32_SUFFIX2 ?= $(HOSTSUFF_EXE)
|
---|
| 50 | TOOL_GXX32_PREFIX3 ?=
|
---|
| 51 | TOOL_GXX32_SUFFIX3 ?= $(HOSTSUFF_EXE)
|
---|
| 52 | TOOL_GXX32_CC ?= $(TOOL_GXX32_PREFIX)gcc$(TOOL_GXX32_SUFFIX) -m32
|
---|
| 53 | TOOL_GXX32_CXX ?= $(TOOL_GXX32_PREFIX)g++$(TOOL_GXX32_SUFFIX) -m32
|
---|
| 54 | TOOL_GXX32_PCH ?= $(TOOL_GXX32_CXX)
|
---|
| 55 | TOOL_GXX32_AS ?= $(TOOL_GXX32_PREFIX)gcc$(TOOL_GXX32_SUFFIX) -m32
|
---|
| 56 | TOOL_GXX32_AR ?= $(TOOL_GXX32_PREFIX2)ar$(TOOL_GXX32_SUFFIX2)
|
---|
| 57 | TOOL_GXX32_LD ?= $(TOOL_GXX32_PREFIX)g++$(TOOL_GXX32_SUFFIX) -m32
|
---|
| 58 | if1of ($(KBUILD_HOST), solaris)
|
---|
| 59 | TOOL_GXX32_LD_SYSMOD ?= $(TOOL_GXX32_PREFIX3)ld$(TOOL_GXX32_SUFFIX3)
|
---|
| 60 | else
|
---|
| 61 | TOOL_GXX32_LD_SYSMOD ?= $(TOOL_GXX32_PREFIX2)ld$(TOOL_GXX32_SUFFIX2)
|
---|
| 62 | endif
|
---|
[1504] | 63 | ifndef TOOL_GXX32_LDFLAGS.$(KBUILD_TARGET)
|
---|
[3391] | 64 | TOOL_GXX32_LDFLAGS.dll ?= -shared
|
---|
[456] | 65 | else
|
---|
[3391] | 66 | TOOL_GXX32_LDFLAGS.dll ?= $(TOOL_GXX32_LDFLAGS.$(KBUILD_TARGET))
|
---|
[456] | 67 | endif
|
---|
[3062] | 68 | TOOL_GXX32_LDFLAGS.sysmod ?= -r -m elf_i386$(if-expr "$(KBUILD_TARGET)" == "freebsd" || "$(KBUILD_TARGET)" == "gnukfbsd",_fbsd,)
|
---|
[1504] | 69 | TOOL_GXX32_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
|
---|
| 70 | ifeq ($(KBUILD_TARGET),os2)
|
---|
[3391] | 71 | TOOL_GXX32_LD_MAP ?= -Zmap=$(1)
|
---|
[456] | 72 | else
|
---|
[3391] | 73 | TOOL_GXX32_LD_MAP ?=
|
---|
[456] | 74 | endif
|
---|
[1504] | 75 | ifeq ($(KBUILD_TARGET),os2)
|
---|
[3391] | 76 | TOOL_GXX32_LD_SYSMOD_MAP ?= -Zmap=$(1)
|
---|
[456] | 77 | else
|
---|
[3391] | 78 | TOOL_GXX32_LD_SYSMOD_MAP ?=
|
---|
[456] | 79 | endif
|
---|
[3393] | 80 | TOOL_GXX32_OBJCOPY ?= $(TOOL_GXX32_PREFIX2)objcopy$(TOOL_GXX32_SUFFIX)
|
---|
[2534] | 81 |
|
---|
[667] | 82 | # General Properties used by kBuild
|
---|
[971] | 83 | TOOL_GXX32_COBJSUFF ?= .o
|
---|
| 84 | TOOL_GXX32_CFLAGS ?=
|
---|
| 85 | TOOL_GXX32_CFLAGS.debug ?= -g
|
---|
[1058] | 86 | TOOL_GXX32_CFLAGS.profile ?= -O2 #-g -pg
|
---|
[971] | 87 | TOOL_GXX32_CFLAGS.release ?= -O2
|
---|
| 88 | TOOL_GXX32_CINCS ?=
|
---|
| 89 | TOOL_GXX32_CDEFS ?=
|
---|
[456] | 90 |
|
---|
[971] | 91 | TOOL_GXX32_CXXOBJSUFF ?= .o
|
---|
| 92 | TOOL_GXX32_CXXFLAGS ?=
|
---|
| 93 | TOOL_GXX32_CXXFLAGS.debug ?= -g
|
---|
[1058] | 94 | TOOL_GXX32_CXXFLAGS.profile ?= -O2 #-g -pg
|
---|
[971] | 95 | TOOL_GXX32_CXXFLAGS.release ?= -O2
|
---|
| 96 | TOOL_GXX32_CXXINCS ?=
|
---|
| 97 | TOOL_GXX32_CXXDEFS ?=
|
---|
[667] | 98 |
|
---|
[3258] | 99 | TOOL_GXX32_PCHOBJSUFF ?= .h.gch
|
---|
| 100 | TOOL_GXX32_PCHFLAGS ?= $(TOOL_GXX32_CXXFLAGS)
|
---|
| 101 | TOOL_GXX32_PCHFLAGS.debug ?= $(TOOL_GXX32_CXXFLAGS.debug)
|
---|
| 102 | TOOL_GXX32_PCHFLAGS.profile ?= $(TOOL_GXX32_CXXFLAGS.profile)
|
---|
| 103 | TOOL_GXX32_PCHFLAGS.release ?= $(TOOL_GXX32_CXXFLAGS.release)
|
---|
| 104 | TOOL_GXX32_PCHINCS ?= $(TOOL_GXX32_CXXINCS)
|
---|
| 105 | TOOL_GXX32_PCHDEFS ?= $(TOOL_GXX32_CXXDEFS)
|
---|
| 106 |
|
---|
[971] | 107 | TOOL_GXX32_ASFLAGS ?= -x assembler-with-cpp
|
---|
| 108 | TOOL_GXX32_ASFLAGS.debug ?= -g
|
---|
| 109 | TOOL_GXX32_ASFLAGS.profile ?= -g
|
---|
| 110 | TOOL_GXX32_ASOBJSUFF ?= .o
|
---|
[667] | 111 |
|
---|
[971] | 112 | TOOL_GXX32_ARFLAGS ?= cr
|
---|
| 113 | TOOL_GXX32_ARLIBSUFF ?= .a
|
---|
[667] | 114 |
|
---|
[971] | 115 | TOOL_GXX32_LDFLAGS ?=
|
---|
| 116 | TOOL_GXX32_LDFLAGS.debug ?= -g
|
---|
| 117 | TOOL_GXX32_LDFLAGS.profile ?= -g
|
---|
[667] | 118 |
|
---|
| 119 |
|
---|
[456] | 120 | ## Compile C source.
|
---|
| 121 | # @param $(target) Normalized main target name.
|
---|
| 122 | # @param $(source) Source filename (relative).
|
---|
| 123 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
| 124 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 125 | # @param $(flags) Flags.
|
---|
| 126 | # @param $(defs) Definitions. No -D or something.
|
---|
| 127 | # @param $(incs) Includes. No -I or something.
|
---|
| 128 | # @param $(dirdep) Directory creation dependency.
|
---|
| 129 | # @param $(deps) Other dependencies.
|
---|
| 130 | #
|
---|
| 131 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 132 | # @param $(objsuff) Object suffix.
|
---|
[971] | 133 | TOOL_GXX32_COMPILE_C_DEPEND =
|
---|
| 134 | TOOL_GXX32_COMPILE_C_DEPORD =
|
---|
[3258] | 135 | TOOL_GXX32_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
|
---|
| 136 | TOOL_GXX32_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
---|
[971] | 137 | define TOOL_GXX32_COMPILE_C_CMDS
|
---|
[3258] | 138 | if "$(use_objcache)" != ""
|
---|
[1058] | 139 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
| 140 | --kObjCache-cpp $(outbase).i\
|
---|
[1015] | 141 | $(TOOL_GXX32_CC) -E -o -\
|
---|
[3566] | 142 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[1015] | 143 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
[1058] | 144 | $(abspath $(source))\
|
---|
| 145 | --kObjCache-cc $(obj)\
|
---|
[1015] | 146 | $(TOOL_GXX32_CC) -c\
|
---|
[1058] | 147 | $(flags) -fpreprocessed -x c\
|
---|
[1015] | 148 | -o $(obj)\
|
---|
[1058] | 149 | -
|
---|
[3258] | 150 | else
|
---|
[971] | 151 | $(QUIET)$(TOOL_GXX32_CC) -c\
|
---|
[3566] | 152 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[456] | 153 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 154 | -o $(obj)\
|
---|
[697] | 155 | $(abspath $(source))
|
---|
[3258] | 156 | endif
|
---|
[2431] | 157 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[456] | 158 | endef
|
---|
| 159 |
|
---|
| 160 |
|
---|
| 161 | ## Compile C++ source.
|
---|
| 162 | # @param $(target) Normalized main target name.
|
---|
| 163 | # @param $(source) Source filename (relative).
|
---|
| 164 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
[3258] | 165 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
[456] | 166 | # @param $(flags) Flags.
|
---|
| 167 | # @param $(defs) Definitions. No -D or something.
|
---|
| 168 | # @param $(incs) Includes. No -I or something.
|
---|
| 169 | # @param $(dirdep) Directory creation dependency.
|
---|
[3258] | 170 | # @param $(deps) Other dependencies.
|
---|
[456] | 171 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 172 | # @param $(objsuff) Object suffix.
|
---|
[3258] | 173 | TOOL_GXX32_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
|
---|
| 174 | TOOL_GXX32_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
|
---|
| 175 | TOOL_GXX32_COMPILE_CXX_DEPORD =
|
---|
| 176 | TOOL_GXX32_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
---|
[971] | 177 | define TOOL_GXX32_COMPILE_CXX_CMDS
|
---|
[3258] | 178 | if "$(use_objcache)" != ""
|
---|
[1058] | 179 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
| 180 | --kObjCache-cpp $(outbase).ii\
|
---|
[3258] | 181 | $(TOOL_GXX32_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
|
---|
| 182 | ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
|
---|
[3566] | 183 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[1015] | 184 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
[1058] | 185 | $(abspath $(source))\
|
---|
| 186 | --kObjCache-cc $(obj)\
|
---|
[1015] | 187 | $(TOOL_GXX32_CXX) -c\
|
---|
[3258] | 188 | $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
|
---|
[1015] | 189 | -o $(obj)\
|
---|
[1058] | 190 | -
|
---|
[3258] | 191 | else
|
---|
| 192 | $(QUIET)$(TOOL_GXX32_CXX) -c\
|
---|
[3566] | 193 | $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[3258] | 194 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 195 | -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
|
---|
| 196 | ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
|
---|
| 197 | $(abspath $(source))
|
---|
| 198 | endif
|
---|
[2534] | 199 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[1015] | 200 | endef
|
---|
[3258] | 201 |
|
---|
| 202 |
|
---|
| 203 | ## Precompile C++ header.
|
---|
| 204 | # @param $(target) Normalized main target name.
|
---|
| 205 | # @param $(source) Source filename (relative).
|
---|
| 206 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
| 207 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 208 | # @param $(flags) Flags.
|
---|
| 209 | # @param $(defs) Definitions. No -D or something.
|
---|
| 210 | # @param $(incs) Includes. No -I or something.
|
---|
| 211 | # @param $(dirdep) Directory creation dependency.
|
---|
| 212 | # @param $(deps) Other dependencies.
|
---|
| 213 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 214 | # @param $(objsuff) Object suffix.
|
---|
| 215 | TOOL_GXX32_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
|
---|
| 216 | TOOL_GXX32_COMPILE_PCH_DEPEND =
|
---|
| 217 | TOOL_GXX32_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
|
---|
| 218 | define TOOL_GXX32_COMPILE_PCH_CMDS
|
---|
| 219 | $(QUIET)$(TOOL_GXX32_PCH) -c\
|
---|
[3566] | 220 | $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[456] | 221 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 222 | -o $(obj)\
|
---|
[697] | 223 | $(abspath $(source))
|
---|
[3258] | 224 | $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
|
---|
[2534] | 225 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[456] | 226 | endef
|
---|
| 227 |
|
---|
| 228 |
|
---|
[465] | 229 | ## Compile Assembly source.
|
---|
| 230 | # @param $(target) Normalized main target name.
|
---|
| 231 | # @param $(source) Source filename (relative).
|
---|
| 232 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
| 233 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 234 | # @param $(flags) Flags.
|
---|
| 235 | # @param $(defs) Definitions. No -D or something.
|
---|
| 236 | # @param $(incs) Includes. No -I or something.
|
---|
| 237 | # @param $(dirdep) Directory creation dependency.
|
---|
| 238 | # @param $(deps) Other dependencies.
|
---|
| 239 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 240 | # @param $(objsuff) Object suffix.
|
---|
| 241 | #
|
---|
[971] | 242 | TOOL_GXX32_COMPILE_AS_OUTPUT =
|
---|
| 243 | TOOL_GXX32_COMPILE_AS_DEPEND =
|
---|
| 244 | TOOL_GXX32_COMPILE_AS_DEPORD =
|
---|
| 245 | define TOOL_GXX32_COMPILE_AS_CMDS
|
---|
| 246 | $(QUIET)$(TOOL_GXX32_AS) -c\
|
---|
[3566] | 247 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[465] | 248 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 249 | -o $(obj)\
|
---|
[697] | 250 | $(abspath $(source))
|
---|
[2534] | 251 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[465] | 252 | endef
|
---|
| 253 |
|
---|
| 254 |
|
---|
[456] | 255 | ## Link library
|
---|
| 256 | # @param $(target) Normalized main target name.
|
---|
| 257 | # @param $(out) Library name.
|
---|
| 258 | # @param $(objs) Object files to put in the library.
|
---|
| 259 | # @param $(flags) Flags.
|
---|
| 260 | # @param $(dirdep) Directory creation dependency.
|
---|
| 261 | # @param $(deps) Other dependencies.
|
---|
| 262 | # @param $(othersrc) Unhandled sources.
|
---|
| 263 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[971] | 264 | TOOL_GXX32_LINK_LIBRARY_OUTPUT = $(out).ar-script
|
---|
| 265 | TOOL_GXX32_LINK_LIBRARY_DEPEND = $(othersrc)
|
---|
| 266 | TOOL_GXX32_LINK_LIBRARY_DEPORD =
|
---|
| 267 | define TOOL_GXX32_LINK_LIBRARY_CMDS
|
---|
[772] | 268 | $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
|
---|
| 269 | $(QUIET)$(APPEND) -n $(out).ar-script \
|
---|
[3258] | 270 | $(foreach o,$(filter-out %.h.gch,$(objs)), 'ADDMOD $(o)') \
|
---|
[2775] | 271 | $(foreach o,$(filter-out %.def %.imp %.dll,$(othersrc)), 'ADDLIB $(o)')
|
---|
| 272 | $(if $(filter %.def %.imp %.dll,$(othersrc))\
|
---|
[3258] | 273 | ,$(TOOL_GXX32_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp %.dll,$(othersrc))\
|
---|
[2541] | 274 | $(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script 'ADDLIB $(outbase).imp.a')
|
---|
[772] | 275 | $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
|
---|
| 276 | $(QUIET)$(APPEND) $(out).ar-script 'END'
|
---|
[1315] | 277 | $(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_GXX32_AR) -M
|
---|
[772] | 278 | endef
|
---|
[456] | 279 |
|
---|
| 280 |
|
---|
| 281 | ## Link program
|
---|
| 282 | # @param $(target) Normalized main target name.
|
---|
| 283 | # @param $(out) Program name.
|
---|
| 284 | # @param $(objs) Object files to link together.
|
---|
| 285 | # @param $(libs) Libraries to search.
|
---|
| 286 | # @param $(libpath) Library search paths.
|
---|
| 287 | # @param $(flags) Flags.
|
---|
| 288 | # @param $(dirdep) Directory creation dependency.
|
---|
| 289 | # @param $(deps) Other dependencies.
|
---|
| 290 | # @param $(othersrc) Unhandled sources.
|
---|
| 291 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
| 292 | # @param $(custom_post) Custom step invoked after linking.
|
---|
| 293 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[1034] | 294 | TOOL_GXX32_LINK_PROGRAM_OUTPUT =
|
---|
| 295 | TOOL_GXX32_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
|
---|
[2534] | 296 | TOOL_GXX32_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
|
---|
| 297 | TOOL_GXX32_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
---|
[2541] | 298 | TOOL_GXX32_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
| 299 | $(filter %.def, $(othersrc))
|
---|
[971] | 300 | TOOL_GXX32_LINK_PROGRAM_DEPORD =
|
---|
| 301 | define TOOL_GXX32_LINK_PROGRAM_CMDS
|
---|
[3258] | 302 | $(QUIET)$(TOOL_GXX32_LD) $(flags) -o $(out) $(filter-out %.h.gch,$(objs))\
|
---|
[456] | 303 | $(foreach p,$(libpath), -L$(p))\
|
---|
[1259] | 304 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
---|
[971] | 305 | $(call TOOL_GXX32_LD_MAP,$(outbase).map)
|
---|
[2534] | 306 | ifeq ($(ld_debug),split)
|
---|
[2774] | 307 | $(QUIET)$(TOOL_GXX32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
---|
| 308 | $(QUIET)$(CHMOD) a-x $(outbase).debug
|
---|
| 309 | $(QUIET)$(TOOL_GXX32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
---|
[2534] | 310 | endif
|
---|
[456] | 311 | endef
|
---|
| 312 |
|
---|
| 313 |
|
---|
| 314 | ## Link DLL
|
---|
| 315 | # @param $(target) Normalized main target name.
|
---|
| 316 | # @param $(out) Program name.
|
---|
| 317 | # @param $(objs) Object files to link together.
|
---|
| 318 | # @param $(libs) Libraries to search.
|
---|
| 319 | # @param $(libpath) Library search paths.
|
---|
| 320 | # @param $(flags) Flags.
|
---|
| 321 | # @param $(dirdep) Directory creation dependency.
|
---|
| 322 | # @param $(deps) Other dependencies.
|
---|
| 323 | # @param $(othersrc) Unhandled sources.
|
---|
| 324 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
| 325 | # @param $(custom_post) Custom step invoked after linking.
|
---|
| 326 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[1034] | 327 | TOOL_GXX32_LINK_DLL_OUTPUT =
|
---|
| 328 | TOOL_GXX32_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
|
---|
[2541] | 329 | TOOL_GXX32_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
|
---|
| 330 | TOOL_GXX32_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
---|
| 331 | TOOL_GXX32_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
| 332 | $(filter %.def, $(othersrc))
|
---|
[971] | 333 | TOOL_GXX32_LINK_DLL_DEPORD =
|
---|
| 334 | define TOOL_GXX32_LINK_DLL_CMDS
|
---|
| 335 | $(QUIET)$(TOOL_GXX32_LD) $(TOOL_GXX32_LDFLAGS.dll) $(flags) -o $(out)\
|
---|
[1504] | 336 | $(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GXX32_LD_SONAME,$(target),$(out)))\
|
---|
[3258] | 337 | $(filter-out %.h.gch,$(objs))\
|
---|
[456] | 338 | $(foreach p,$(libpath), -L$(p))\
|
---|
[1259] | 339 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
---|
[971] | 340 | $(call TOOL_GXX32_LD_MAP,$(outbase).map)
|
---|
[2541] | 341 | ifeq ($(ld_debug),split)
|
---|
[2774] | 342 | $(QUIET)$(TOOL_GXX32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
---|
| 343 | $(QUIET)$(CHMOD) a-x $(outbase).debug
|
---|
| 344 | $(QUIET)$(TOOL_GXX32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
---|
[2541] | 345 | endif
|
---|
[456] | 346 | endef
|
---|
| 347 |
|
---|
| 348 |
|
---|
| 349 | ## Link system module (windows aka driver, linux aka kernel module)
|
---|
| 350 | # @param $(target) Normalized main target name.
|
---|
| 351 | # @param $(out) System module name.
|
---|
| 352 | # @param $(objs) Object files to link together.
|
---|
| 353 | # @param $(libs) Libraries to search.
|
---|
| 354 | # @param $(libpath) Library search paths.
|
---|
| 355 | # @param $(flags) Flags.
|
---|
| 356 | # @param $(dirdep) Directory creation dependency.
|
---|
| 357 | # @param $(deps) Other dependencies.
|
---|
| 358 | # @param $(othersrc) Unhandled sources.
|
---|
| 359 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
| 360 | # @param $(custom_post) Custom step invoked after linking.
|
---|
| 361 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[1034] | 362 | TOOL_GXX32_LINK_SYSMOD_OUTPUT =
|
---|
| 363 | TOOL_GXX32_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
|
---|
[2541] | 364 | TOOL_GXX32_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
|
---|
| 365 | TOOL_GXX32_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
---|
| 366 | TOOL_GXX32_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
| 367 | $(filter %.def, $(othersrc))
|
---|
[971] | 368 | TOOL_GXX32_LINK_SYSMOD_DEPORD =
|
---|
| 369 | define TOOL_GXX32_LINK_SYSMOD_CMDS
|
---|
[3258] | 370 | $(QUIET)$(TOOL_GXX32_LD_SYSMOD) $(TOOL_GXX32_LDFLAGS.sysmod) $(flags) -o $(out) $(filter-out %.h.gch,$(objs))\
|
---|
[2541] | 371 | $(filter %.def, $(othersrc))\
|
---|
[456] | 372 | $(foreach p,$(libpath), -L$(p))\
|
---|
[1259] | 373 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
---|
[971] | 374 | $(call TOOL_GXX32_LD_SYSMOD_MAP,$(outbase).map)
|
---|
[2541] | 375 | ifeq ($(ld_debug),split)
|
---|
[2774] | 376 | $(QUIET)$(TOOL_GXX32_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
---|
| 377 | $(QUIET)$(CHMOD) a-x $(outbase).debug
|
---|
| 378 | $(QUIET)$(TOOL_GXX32_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
---|
[2541] | 379 | endif
|
---|
[456] | 380 | endef
|
---|
| 381 |
|
---|