| 1 | # $Id: GXX3.kmk 2541 2011-08-03 09:51:30Z bird $
|
|---|
| 2 | ## @file
|
|---|
| 3 | # kBuild Tool Config - Generic GCC v3.2.x using the system GCC and Binutils, for building C++ code.
|
|---|
| 4 | #
|
|---|
| 5 |
|
|---|
| 6 | #
|
|---|
| 7 | # Copyright (c) 2004-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
|
|---|
| 8 | #
|
|---|
| 9 | # This file is part of kBuild.
|
|---|
| 10 | #
|
|---|
| 11 | # kBuild is free software; you can redistribute it and/or modify
|
|---|
| 12 | # it under the terms of the GNU General Public License as published by
|
|---|
| 13 | # the Free Software Foundation; either version 2 of the License, or
|
|---|
| 14 | # (at your option) any later version.
|
|---|
| 15 | #
|
|---|
| 16 | # kBuild is distributed in the hope that it will be useful,
|
|---|
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 19 | # GNU General Public License for more details.
|
|---|
| 20 | #
|
|---|
| 21 | # You should have received a copy of the GNU General Public License
|
|---|
| 22 | # along with kBuild; if not, write to the Free Software
|
|---|
| 23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 24 | #
|
|---|
| 25 | #
|
|---|
| 26 | # As a special exception you are granted permission to include this file, via
|
|---|
| 27 | # the kmk include directive, as you wish without this in itself causing the
|
|---|
| 28 | # resulting makefile, program or whatever to be covered by the GPL license.
|
|---|
| 29 | # This exception does not however invalidate any other reasons why the makefile,
|
|---|
| 30 | # program, whatever should not be covered the GPL.
|
|---|
| 31 | #
|
|---|
| 32 | #
|
|---|
| 33 |
|
|---|
| 34 | TOOL_GXX3 := Generic GCC v3.2.x or later using the system GCC and Binutils, for building C++ code.
|
|---|
| 35 |
|
|---|
| 36 | # Tool Specific Properties
|
|---|
| 37 | TOOL_GXX3_CC ?= gcc$(HOSTSUFF_EXE)
|
|---|
| 38 | TOOL_GXX3_CXX ?= g++$(HOSTSUFF_EXE)
|
|---|
| 39 | TOOL_GXX3_AS ?= gcc$(HOSTSUFF_EXE)
|
|---|
| 40 | ifeq ($(KBUILD_TARGET),solaris)
|
|---|
| 41 | TOOL_GXX3_AR ?= gar$(HOSTSUFF_EXE)
|
|---|
| 42 | else
|
|---|
| 43 | TOOL_GXX3_AR ?= ar$(HOSTSUFF_EXE)
|
|---|
| 44 | endif
|
|---|
| 45 | ifeq ($(KBUILD_TARGET),os2)
|
|---|
| 46 | TOOL_GXX3_AR_IMP ?= emximp$(HOSTSTUFF_EXE)
|
|---|
| 47 | else
|
|---|
| 48 | TOOL_GXX3_AR_IMP ?= $(ECHO) not supported!
|
|---|
| 49 | endif
|
|---|
| 50 | TOOL_GXX3_LD ?= g++$(HOSTSUFF_EXE)
|
|---|
| 51 | TOOL_GXX3_LD_SYSMOD ?= ld$(HOSTSUFF_EXE)
|
|---|
| 52 | ifndef TOOL_GXX3_LDFLAGS.$(KBUILD_TARGET)
|
|---|
| 53 | TOOL_GXX3_LDFLAGS.dll ?= -shared
|
|---|
| 54 | else
|
|---|
| 55 | TOOL_GXX3_LDFLAGS.dll ?= $(TOOL_GXX3_LDFLAGS.$(KBUILD_TARGET))
|
|---|
| 56 | endif
|
|---|
| 57 | TOOL_GXX3_LDFLAGS.sysmod ?= -r
|
|---|
| 58 | TOOL_GXX3_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
|
|---|
| 59 | ifeq ($(KBUILD_TARGET),os2)
|
|---|
| 60 | TOOL_GXX3_LD_MAP ?= -Zmap=$(1)
|
|---|
| 61 | TOOL_GXX3_LD_SYSMOD_MAP ?= -Zmap=$(1)
|
|---|
| 62 | else
|
|---|
| 63 | TOOL_GXX3_LD_MAP ?=
|
|---|
| 64 | TOOL_GXX3_LD_SYSMOD_MAP ?=
|
|---|
| 65 | endif
|
|---|
| 66 | if1of ($(KBUILD_HOST), solaris)
|
|---|
| 67 | TOOL_GXX3_OBJCOPY ?= gobjcopy$(HOSTSUFF_EXE)
|
|---|
| 68 | else
|
|---|
| 69 | TOOL_GXX3_OBJCOPY ?= objcopy$(HOSTSUFF_EXE)
|
|---|
| 70 | endif
|
|---|
| 71 |
|
|---|
| 72 | ifdef SLKRUNS
|
|---|
| 73 | TOOL_GXX3_CC += -fmessage-length=0
|
|---|
| 74 | TOOL_GXX3_CXX += -fmessage-length=0
|
|---|
| 75 | endif
|
|---|
| 76 |
|
|---|
| 77 | # General Properties used by kBuild
|
|---|
| 78 | TOOL_GXX3_COBJSUFF ?= .o
|
|---|
| 79 | TOOL_GXX3_CFLAGS ?=
|
|---|
| 80 | TOOL_GXX3_CFLAGS.debug ?= -g
|
|---|
| 81 | TOOL_GXX3_CFLAGS.profile ?= -O2 #-g -pg
|
|---|
| 82 | TOOL_GXX3_CFLAGS.release ?= -O2
|
|---|
| 83 | TOOL_GXX3_CINCS ?=
|
|---|
| 84 | TOOL_GXX3_CDEFS ?=
|
|---|
| 85 |
|
|---|
| 86 | TOOL_GXX3_CXXOBJSUFF ?= .o
|
|---|
| 87 | TOOL_GXX3_CXXOBJSUFF ?= .o
|
|---|
| 88 | TOOL_GXX3_CXXFLAGS ?=
|
|---|
| 89 | TOOL_GXX3_CXXFLAGS.debug ?= -g
|
|---|
| 90 | TOOL_GXX3_CXXFLAGS.profile ?= -O2 #-g -pg
|
|---|
| 91 | TOOL_GXX3_CXXFLAGS.release ?= -O2
|
|---|
| 92 | TOOL_GXX3_CXXINCS ?=
|
|---|
| 93 | TOOL_GXX3_CXXDEFS ?=
|
|---|
| 94 |
|
|---|
| 95 | TOOL_GXX3_ASFLAGS ?= -x assembler-with-cpp
|
|---|
| 96 | TOOL_GXX3_ASFLAGS.debug ?= -g
|
|---|
| 97 | TOOL_GXX3_ASFLAGS.profile ?= -g
|
|---|
| 98 | TOOL_GXX3_ASOBJSUFF ?= .o
|
|---|
| 99 |
|
|---|
| 100 | TOOL_GXX3_ARFLAGS ?= cr
|
|---|
| 101 | TOOL_GXX3_ARLIBSUFF ?= .a
|
|---|
| 102 |
|
|---|
| 103 | TOOL_GXX3_LDFLAGS ?=
|
|---|
| 104 | TOOL_GXX3_LDFLAGS.debug ?= -g
|
|---|
| 105 | TOOL_GXX3_LDFLAGS.profile ?= -g
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 | ## Compile C source.
|
|---|
| 109 | # @param $(target) Normalized main target name.
|
|---|
| 110 | # @param $(source) Source filename (relative).
|
|---|
| 111 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
|---|
| 112 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
|---|
| 113 | # @param $(flags) Flags.
|
|---|
| 114 | # @param $(defs) Definitions. No -D or something.
|
|---|
| 115 | # @param $(incs) Includes. No -I or something.
|
|---|
| 116 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 117 | # @param $(deps) Other dependencies.
|
|---|
| 118 | #
|
|---|
| 119 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 120 | # @param $(objsuff) Object suffix.
|
|---|
| 121 | TOOL_GXX3_COMPILE_C_DEPEND =
|
|---|
| 122 | TOOL_GXX3_COMPILE_C_DEPORD =
|
|---|
| 123 | ifdef KBUILD_USE_KOBJCACHE
|
|---|
| 124 | TOOL_GXX3_COMPILE_C_USES_KOBJCACHE = 1
|
|---|
| 125 | TOOL_GXX3_COMPILE_C_OUTPUT = $(outbase).i
|
|---|
| 126 | define TOOL_GXX3_COMPILE_C_CMDS
|
|---|
| 127 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
|---|
| 128 | --kObjCache-cpp $(outbase).i\
|
|---|
| 129 | $(TOOL_GXX3_CC) -E -o -\
|
|---|
| 130 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
|---|
| 131 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
|---|
| 132 | $(abspath $(source))\
|
|---|
| 133 | --kObjCache-cc $(obj)\
|
|---|
| 134 | $(TOOL_GXX3_CC) -c\
|
|---|
| 135 | $(flags) -fpreprocessed -x c\
|
|---|
| 136 | -o $(obj)\
|
|---|
| 137 | -
|
|---|
| 138 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
|---|
| 139 | endef
|
|---|
| 140 | else # !KBUILD_USE_KOBJCACHE
|
|---|
| 141 | TOOL_GXX3_COMPILE_C_OUTPUT =
|
|---|
| 142 | define TOOL_GXX3_COMPILE_C_CMDS
|
|---|
| 143 | $(QUIET)$(TOOL_GXX3_CC) -c\
|
|---|
| 144 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
|---|
| 145 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
|---|
| 146 | -o $(obj)\
|
|---|
| 147 | $(abspath $(source))
|
|---|
| 148 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
|---|
| 149 | endef
|
|---|
| 150 | endif # !KBUILD_USE_KOBJCACHE
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 | ## Compile C++ source.
|
|---|
| 154 | # @param $(target) Normalized main target name.
|
|---|
| 155 | # @param $(source) Source filename (relative).
|
|---|
| 156 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
|---|
| 157 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
|---|
| 158 | # @param $(flags) Flags.
|
|---|
| 159 | # @param $(defs) Definitions. No -D or something.
|
|---|
| 160 | # @param $(incs) Includes. No -I or something.
|
|---|
| 161 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 162 | # @param $(deps) Other dependencies.
|
|---|
| 163 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 164 | # @param $(objsuff) Object suffix.
|
|---|
| 165 | TOOL_GXX3_COMPILE_CXX_DEPEND =
|
|---|
| 166 | TOOL_GXX3_COMPILE_CXX_DEPORD =
|
|---|
| 167 | ifdef KBUILD_USE_KOBJCACHE
|
|---|
| 168 | TOOL_GXX3_COMPILE_CXX_USES_KOBJCACHE = 1
|
|---|
| 169 | TOOL_GXX3_COMPILE_CXX_OUTPUT = $(outbase).ii
|
|---|
| 170 | define TOOL_GXX3_COMPILE_CXX_CMDS
|
|---|
| 171 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
|---|
| 172 | --kObjCache-cpp $(outbase).ii\
|
|---|
| 173 | $(TOOL_GXX3_CXX) -E -o -\
|
|---|
| 174 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
|---|
| 175 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
|---|
| 176 | $(abspath $(source))\
|
|---|
| 177 | --kObjCache-cc $(obj)\
|
|---|
| 178 | $(TOOL_GXX3_CXX) -c\
|
|---|
| 179 | $(flags) -fpreprocessed -x c++\
|
|---|
| 180 | -o $(obj)\
|
|---|
| 181 | -
|
|---|
| 182 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
|---|
| 183 | endef
|
|---|
| 184 | else # !KBUILD_USE_KOBJCACHE
|
|---|
| 185 | TOOL_GXX3_COMPILE_CXX_OUTPUT =
|
|---|
| 186 | define TOOL_GXX3_COMPILE_CXX_CMDS
|
|---|
| 187 | $(QUIET)$(TOOL_GXX3_CXX) -c\
|
|---|
| 188 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
|---|
| 189 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
|---|
| 190 | -o $(obj)\
|
|---|
| 191 | $(abspath $(source))
|
|---|
| 192 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
|---|
| 193 | endef
|
|---|
| 194 | endif # !KBUILD_USE_KOBJCACHE
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 | ## Compile Assembly source.
|
|---|
| 198 | # @param $(target) Normalized main target name.
|
|---|
| 199 | # @param $(source) Source filename (relative).
|
|---|
| 200 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
|---|
| 201 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
|---|
| 202 | # @param $(flags) Flags.
|
|---|
| 203 | # @param $(defs) Definitions. No -D or something.
|
|---|
| 204 | # @param $(incs) Includes. No -I or something.
|
|---|
| 205 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 206 | # @param $(deps) Other dependencies.
|
|---|
| 207 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 208 | # @param $(objsuff) Object suffix.
|
|---|
| 209 | #
|
|---|
| 210 | TOOL_GXX3_COMPILE_AS_OUTPUT =
|
|---|
| 211 | TOOL_GXX3_COMPILE_AS_DEPEND =
|
|---|
| 212 | TOOL_GXX3_COMPILE_AS_DEPORD =
|
|---|
| 213 | define TOOL_GXX3_COMPILE_AS_CMDS
|
|---|
| 214 | $(QUIET)$(TOOL_GXX3_AS) -c\
|
|---|
| 215 | $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
|
|---|
| 216 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
|---|
| 217 | -o $(obj)\
|
|---|
| 218 | $(abspath $(source))
|
|---|
| 219 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
|---|
| 220 | endef
|
|---|
| 221 |
|
|---|
| 222 |
|
|---|
| 223 | ## Link library
|
|---|
| 224 | # @param $(target) Normalized main target name.
|
|---|
| 225 | # @param $(out) Library name.
|
|---|
| 226 | # @param $(objs) Object files to put in the library.
|
|---|
| 227 | # @param $(flags) Flags.
|
|---|
| 228 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 229 | # @param $(deps) Other dependencies.
|
|---|
| 230 | # @param $(othersrc) Unhandled sources.
|
|---|
| 231 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 232 | TOOL_GXX3_LINK_LIBRARY_OUTPUT = $(out).ar-script
|
|---|
| 233 | TOOL_GXX3_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).imp.a
|
|---|
| 234 | TOOL_GXX3_LINK_LIBRARY_DEPEND = $(othersrc)
|
|---|
| 235 | TOOL_GXX3_LINK_LIBRARY_DEPORD =
|
|---|
| 236 | define TOOL_GXX3_LINK_LIBRARY_CMDS
|
|---|
| 237 | $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
|
|---|
| 238 | $(QUIET)$(APPEND) -n $(out).ar-script \
|
|---|
| 239 | $(foreach o,$(objs), 'ADDMOD $(o)') \
|
|---|
| 240 | $(foreach o,$(filter-out %.def %.imp,$(othersrc)), 'ADDLIB $(o)')
|
|---|
| 241 | $(if $(filter %.def %.imp,$(othersrc))\
|
|---|
| 242 | ,$(TOOL_GXX3_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp,$(othersrc))\
|
|---|
| 243 | $(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script 'ADDLIB $(outbase).imp.a')
|
|---|
| 244 | $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
|
|---|
| 245 | $(QUIET)$(APPEND) $(out).ar-script 'END'
|
|---|
| 246 | $(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_GXX3_AR) -M
|
|---|
| 247 | endef
|
|---|
| 248 |
|
|---|
| 249 |
|
|---|
| 250 | ## Link program
|
|---|
| 251 | # @param $(target) Normalized main target name.
|
|---|
| 252 | # @param $(out) Program name.
|
|---|
| 253 | # @param $(objs) Object files to link together.
|
|---|
| 254 | # @param $(libs) Libraries to search.
|
|---|
| 255 | # @param $(libpath) Library search paths.
|
|---|
| 256 | # @param $(flags) Flags.
|
|---|
| 257 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 258 | # @param $(deps) Other dependencies.
|
|---|
| 259 | # @param $(othersrc) Unhandled sources.
|
|---|
| 260 | # @param $(custom_pre) Custom step invoked before linking.
|
|---|
| 261 | # @param $(custom_post) Custom step invoked after linking.
|
|---|
| 262 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 263 | TOOL_GXX3_LINK_PROGRAM_OUTPUT =
|
|---|
| 264 | TOOL_GXX3_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
|
|---|
| 265 | TOOL_GXX3_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
|
|---|
| 266 | TOOL_GXX3_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
|---|
| 267 | TOOL_GXX3_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
|---|
| 268 | $(filter %.def, $(othersrc))
|
|---|
| 269 | TOOL_GXX3_LINK_PROGRAM_DEPORD =
|
|---|
| 270 | define TOOL_GXX3_LINK_PROGRAM_CMDS
|
|---|
| 271 | $(QUIET)$(TOOL_GXX3_LD) $(flags) -o $(out) $(objs)\
|
|---|
| 272 | $(filter %.def, $(othersrc))\
|
|---|
| 273 | $(foreach p,$(libpath), -L$(p))\
|
|---|
| 274 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
|---|
| 275 | $(call TOOL_GXX3_LD_MAP,$(outbase).map)
|
|---|
| 276 | ifeq ($(ld_debug),split)
|
|---|
| 277 | $(TOOL_GXX3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
|---|
| 278 | $(CHMOD) a-x $(outbase).debug
|
|---|
| 279 | $(TOOL_GXX3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
|---|
| 280 | endif
|
|---|
| 281 | endef
|
|---|
| 282 |
|
|---|
| 283 |
|
|---|
| 284 | ## Link DLL
|
|---|
| 285 | # @param $(target) Normalized main target name.
|
|---|
| 286 | # @param $(out) Program name.
|
|---|
| 287 | # @param $(objs) Object files to link together.
|
|---|
| 288 | # @param $(libs) Libraries to search.
|
|---|
| 289 | # @param $(libpath) Library search paths.
|
|---|
| 290 | # @param $(flags) Flags.
|
|---|
| 291 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 292 | # @param $(deps) Other dependencies.
|
|---|
| 293 | # @param $(othersrc) Unhandled sources.
|
|---|
| 294 | # @param $(custom_pre) Custom step invoked before linking.
|
|---|
| 295 | # @param $(custom_post) Custom step invoked after linking.
|
|---|
| 296 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 297 | TOOL_GXX3_LINK_DLL_OUTPUT =
|
|---|
| 298 | TOOL_GXX3_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
|
|---|
| 299 | TOOL_GXX3_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
|
|---|
| 300 | TOOL_GXX3_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
|---|
| 301 | TOOL_GXX3_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
|---|
| 302 | $(filter %.def, $(othersrc))
|
|---|
| 303 | TOOL_GXX3_LINK_DLL_DEPORD =
|
|---|
| 304 | define TOOL_GXX3_LINK_DLL_CMDS
|
|---|
| 305 | $(QUIET)$(TOOL_GXX3_LD) $(TOOL_GXX3_LDFLAGS.dll) $(flags) -o $(out)\
|
|---|
| 306 | $(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GXX3_LD_SONAME,$(target),$(out)))\
|
|---|
| 307 | $(objs)\
|
|---|
| 308 | $(filter %.def, $(othersrc))\
|
|---|
| 309 | $(foreach p,$(libpath), -L$(p))\
|
|---|
| 310 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
|---|
| 311 | $(call TOOL_GXX3_LD_MAP,$(outbase).map)
|
|---|
| 312 | ifeq ($(ld_debug),split)
|
|---|
| 313 | $(TOOL_GXX3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
|---|
| 314 | $(CHMOD) a-x $(outbase).debug
|
|---|
| 315 | $(TOOL_GXX3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
|---|
| 316 | endif
|
|---|
| 317 | endef
|
|---|
| 318 |
|
|---|
| 319 |
|
|---|
| 320 | ## Link system module (windows aka driver, linux aka kernel module)
|
|---|
| 321 | # @param $(target) Normalized main target name.
|
|---|
| 322 | # @param $(out) System module name.
|
|---|
| 323 | # @param $(objs) Object files to link together.
|
|---|
| 324 | # @param $(libs) Libraries to search.
|
|---|
| 325 | # @param $(libpath) Library search paths.
|
|---|
| 326 | # @param $(flags) Flags.
|
|---|
| 327 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 328 | # @param $(deps) Other dependencies.
|
|---|
| 329 | # @param $(othersrc) Unhandled sources.
|
|---|
| 330 | # @param $(custom_pre) Custom step invoked before linking.
|
|---|
| 331 | # @param $(custom_post) Custom step invoked after linking.
|
|---|
| 332 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 333 | TOOL_GXX3_LINK_SYSMOD_OUTPUT =
|
|---|
| 334 | TOOL_GXX3_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
|
|---|
| 335 | TOOL_GXX3_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
|
|---|
| 336 | TOOL_GXX3_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
|---|
| 337 | TOOL_GXX3_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
|---|
| 338 | $(filter %.def, $(othersrc))
|
|---|
| 339 | TOOL_GXX3_LINK_SYSMOD_DEPORD =
|
|---|
| 340 | define TOOL_GXX3_LINK_SYSMOD_CMDS
|
|---|
| 341 | $(QUIET)$(TOOL_GXX3_LD_SYSMOD) $(TOOL_GXX3_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
|
|---|
| 342 | $(filter %.def, $(othersrc))\
|
|---|
| 343 | $(foreach p,$(libpath), -L$(p))\
|
|---|
| 344 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
|---|
| 345 | $(call TOOL_GXX3_LD_SYSMOD_MAP,$(outbase).map)
|
|---|
| 346 | ifeq ($(ld_debug),split)
|
|---|
| 347 | $(TOOL_GXX3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
|---|
| 348 | $(CHMOD) a-x $(outbase).debug
|
|---|
| 349 | $(TOOL_GXX3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
|---|
| 350 | endif
|
|---|
| 351 | endef
|
|---|
| 352 |
|
|---|