[93] | 1 | # $Id: GCC3.kmk 3567 2022-06-26 20:00:02Z bird $
|
---|
| 2 | ## @file
|
---|
[824] | 3 | # kBuild Tool Config - Generic GCC v3.2.x or later Using The System GCC and Binutils.
|
---|
[93] | 4 | #
|
---|
[1547] | 5 |
|
---|
| 6 | #
|
---|
[3121] | 7 | # Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
|
---|
[93] | 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 | #
|
---|
[93] | 33 |
|
---|
[811] | 34 | TOOL_GCC3 := Generic GCC v3.2.x or later Using The System GCC and Binutils.
|
---|
[93] | 35 |
|
---|
[667] | 36 | # Tool Specific Properties
|
---|
[3393] | 37 | ifndef TOOL_GCC3_PREFIX
|
---|
| 38 | TOOL_GCC3_PREFIX :=
|
---|
| 39 | endif
|
---|
| 40 | ifndef TOOL_GCC3_SUFFIX
|
---|
| 41 | TOOL_GCC3_SUFFIX := $(HOSTSUFF_EXE)
|
---|
| 42 | endif
|
---|
| 43 | if1of ($(KBUILD_HOST), solaris)
|
---|
| 44 | TOOL_GCC3_PREFIX2 ?= g
|
---|
[811] | 45 | else
|
---|
[3393] | 46 | TOOL_GCC3_PREFIX2 ?=
|
---|
[811] | 47 | endif
|
---|
[3393] | 48 | TOOL_GCC3_SUFFIX2 ?= $(HOSTSUFF_EXE)
|
---|
| 49 | TOOL_GCC3_PREFIX3 ?=
|
---|
| 50 | TOOL_GCC3_SUFFIX3 ?= $(HOSTSUFF_EXE)
|
---|
| 51 | TOOL_GCC3_CC ?= $(TOOL_GCC3_PREFIX)gcc$(TOOL_GCC3_SUFFIX)
|
---|
| 52 | TOOL_GCC3_CXX ?= $(TOOL_GCC3_PREFIX)g++$(TOOL_GCC3_SUFFIX)
|
---|
| 53 | TOOL_GCC3_AS ?= $(TOOL_GCC3_PREFIX)gcc$(TOOL_GCC3_SUFFIX)
|
---|
| 54 | TOOL_GCC3_AR ?= $(TOOL_GCC3_PREFIX2)ar$(TOOL_GCC3_SUFFIX2)
|
---|
[1504] | 55 | ifeq ($(KBUILD_TARGET),os2)
|
---|
[3393] | 56 | TOOL_GCC3_AR_IMP ?= $(TOOL_GCC3_PREFIX3)emximp$(TOOL_GCC3_SUFFIX3)
|
---|
[474] | 57 | else
|
---|
[3393] | 58 | TOOL_GCC3_AR_IMP ?= $(ECHO) not supported!
|
---|
[474] | 59 | endif
|
---|
[3393] | 60 | TOOL_GCC3_LD ?= $(TOOL_GCC3_PREFIX)gcc$(TOOL_GCC3_SUFFIX)
|
---|
| 61 | if1of ($(KBUILD_HOST), solaris)
|
---|
| 62 | TOOL_GCC3_LD_SYSMOD ?= $(TOOL_GCC3_PREFIX3)ld$(TOOL_GCC3_SUFFIX3)
|
---|
| 63 | else
|
---|
| 64 | TOOL_GCC3_LD_SYSMOD ?= $(TOOL_GCC3_PREFIX2)ld$(TOOL_GCC3_SUFFIX2)
|
---|
| 65 | endif
|
---|
[1504] | 66 | ifndef TOOL_GCC3_LDFLAGS.$(KBUILD_TARGET)
|
---|
[811] | 67 | TOOL_GCC3_LDFLAGS.dll ?= -shared
|
---|
[130] | 68 | else
|
---|
[1504] | 69 | TOOL_GCC3_LDFLAGS.dll ?= $(TOOL_GCC3_LDFLAGS.$(KBUILD_TARGET))
|
---|
[130] | 70 | endif
|
---|
[667] | 71 | TOOL_GCC3_LDFLAGS.sysmod ?= -r
|
---|
[1504] | 72 | TOOL_GCC3_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
|
---|
| 73 | ifeq ($(KBUILD_TARGET),os2)
|
---|
[811] | 74 | TOOL_GCC3_LD_MAP ?= -Zmap=$(1)
|
---|
| 75 | TOOL_GCC3_LD_SYSMOD_MAP ?= -Zmap=$(1)
|
---|
[1612] | 76 | else
|
---|
| 77 | TOOL_GCC3_LD_MAP ?=
|
---|
| 78 | TOOL_GCC3_LD_SYSMOD_MAP ?=
|
---|
[231] | 79 | endif
|
---|
[3393] | 80 | TOOL_GCC3_OBJCOPY ?= $(TOOL_GCC3_PREFIX2)objcopy$(TOOL_GCC3_SUFFIX2)
|
---|
[2541] | 81 |
|
---|
[667] | 82 | # General Properties used by kBuild
|
---|
| 83 | TOOL_GCC3_COBJSUFF ?= .o
|
---|
[772] | 84 | TOOL_GCC3_CFLAGS ?=
|
---|
[667] | 85 | TOOL_GCC3_CFLAGS.debug ?= -g
|
---|
[1058] | 86 | TOOL_GCC3_CFLAGS.profile ?= -O2 #-g -pg
|
---|
[667] | 87 | TOOL_GCC3_CFLAGS.release ?= -O2
|
---|
| 88 | TOOL_GCC3_CINCS ?=
|
---|
| 89 | TOOL_GCC3_CDEFS ?=
|
---|
[137] | 90 |
|
---|
[667] | 91 | TOOL_GCC3_CXXOBJSUFF ?= .o
|
---|
| 92 | TOOL_GCC3_CXXOBJSUFF ?= .o
|
---|
[772] | 93 | TOOL_GCC3_CXXFLAGS ?=
|
---|
[667] | 94 | TOOL_GCC3_CXXFLAGS.debug ?= -g
|
---|
[1058] | 95 | TOOL_GCC3_CXXFLAGS.profile ?= -O2 #-g -pg
|
---|
[667] | 96 | TOOL_GCC3_CXXFLAGS.release ?= -O2
|
---|
| 97 | TOOL_GCC3_CXXINCS ?=
|
---|
| 98 | TOOL_GCC3_CXXDEFS ?=
|
---|
| 99 |
|
---|
| 100 | TOOL_GCC3_ASFLAGS ?= -x assembler-with-cpp
|
---|
| 101 | TOOL_GCC3_ASFLAGS.debug ?= -g
|
---|
| 102 | TOOL_GCC3_ASFLAGS.profile ?= -g
|
---|
| 103 | TOOL_GCC3_ASOBJSUFF ?= .o
|
---|
| 104 |
|
---|
| 105 | TOOL_GCC3_ARFLAGS ?= cr
|
---|
| 106 | TOOL_GCC3_ARLIBSUFF ?= .a
|
---|
| 107 |
|
---|
| 108 | TOOL_GCC3_LDFLAGS ?=
|
---|
| 109 | TOOL_GCC3_LDFLAGS.debug ?= -g
|
---|
| 110 | TOOL_GCC3_LDFLAGS.profile ?= -g
|
---|
| 111 |
|
---|
| 112 |
|
---|
[93] | 113 | ## Compile C source.
|
---|
| 114 | # @param $(target) Normalized main target name.
|
---|
| 115 | # @param $(source) Source filename (relative).
|
---|
[235] | 116 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
[93] | 117 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 118 | # @param $(flags) Flags.
|
---|
| 119 | # @param $(defs) Definitions. No -D or something.
|
---|
| 120 | # @param $(incs) Includes. No -I or something.
|
---|
[235] | 121 | # @param $(dirdep) Directory creation dependency.
|
---|
| 122 | # @param $(deps) Other dependencies.
|
---|
[93] | 123 | #
|
---|
| 124 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[235] | 125 | # @param $(objsuff) Object suffix.
|
---|
[380] | 126 | TOOL_GCC3_COMPILE_C_DEPEND =
|
---|
| 127 | TOOL_GCC3_COMPILE_C_DEPORD =
|
---|
[1418] | 128 | ifdef KBUILD_USE_KOBJCACHE
|
---|
[1015] | 129 | TOOL_GCC3_COMPILE_C_USES_KOBJCACHE = 1
|
---|
| 130 | TOOL_GCC3_COMPILE_C_OUTPUT = $(outbase).i
|
---|
[380] | 131 | define TOOL_GCC3_COMPILE_C_CMDS
|
---|
[1058] | 132 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
| 133 | --kObjCache-cpp $(outbase).i\
|
---|
[1015] | 134 | $(TOOL_GCC3_CC) -E -o -\
|
---|
[3566] | 135 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[1015] | 136 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
[1058] | 137 | $(abspath $(source))\
|
---|
| 138 | --kObjCache-cc $(obj)\
|
---|
[1015] | 139 | $(TOOL_GCC3_CC) -c\
|
---|
[1058] | 140 | $(flags) -fpreprocessed -x c\
|
---|
[1015] | 141 | -o $(obj)\
|
---|
[1058] | 142 | -
|
---|
[2431] | 143 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[1015] | 144 | endef
|
---|
[1418] | 145 | else # !KBUILD_USE_KOBJCACHE
|
---|
[1015] | 146 | TOOL_GCC3_COMPILE_C_OUTPUT =
|
---|
| 147 | define TOOL_GCC3_COMPILE_C_CMDS
|
---|
[696] | 148 | $(QUIET)$(TOOL_GCC3_CC) -c\
|
---|
[3566] | 149 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[380] | 150 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 151 | -o $(obj)\
|
---|
[697] | 152 | $(abspath $(source))
|
---|
[2431] | 153 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[93] | 154 | endef
|
---|
[1418] | 155 | endif # !KBUILD_USE_KOBJCACHE
|
---|
[93] | 156 |
|
---|
| 157 |
|
---|
| 158 | ## Compile C++ source.
|
---|
| 159 | # @param $(target) Normalized main target name.
|
---|
| 160 | # @param $(source) Source filename (relative).
|
---|
[235] | 161 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
[93] | 162 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 163 | # @param $(flags) Flags.
|
---|
| 164 | # @param $(defs) Definitions. No -D or something.
|
---|
| 165 | # @param $(incs) Includes. No -I or something.
|
---|
[235] | 166 | # @param $(dirdep) Directory creation dependency.
|
---|
| 167 | # @param $(deps) Other dependencies.
|
---|
[93] | 168 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[235] | 169 | # @param $(objsuff) Object suffix.
|
---|
[380] | 170 | TOOL_GCC3_COMPILE_CXX_DEPEND =
|
---|
| 171 | TOOL_GCC3_COMPILE_CXX_DEPORD =
|
---|
[1418] | 172 | ifdef KBUILD_USE_KOBJCACHE
|
---|
[1015] | 173 | TOOL_GCC3_COMPILE_CXX_USES_KOBJCACHE = 1
|
---|
| 174 | TOOL_GCC3_COMPILE_CXX_OUTPUT = $(outbase).ii
|
---|
[380] | 175 | define TOOL_GCC3_COMPILE_CXX_CMDS
|
---|
[1058] | 176 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
---|
| 177 | --kObjCache-cpp $(outbase).ii\
|
---|
[1015] | 178 | $(TOOL_GCC3_CXX) -E -o -\
|
---|
[3566] | 179 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[1015] | 180 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
[1058] | 181 | $(abspath $(source))\
|
---|
| 182 | --kObjCache-cc $(obj)\
|
---|
[1015] | 183 | $(TOOL_GCC3_CXX) -c\
|
---|
[1058] | 184 | $(flags) -fpreprocessed -x c++\
|
---|
[1015] | 185 | -o $(obj)\
|
---|
[1058] | 186 | -
|
---|
[2431] | 187 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[1015] | 188 | endef
|
---|
[1418] | 189 | else # !KBUILD_USE_KOBJCACHE
|
---|
[1015] | 190 | TOOL_GCC3_COMPILE_CXX_OUTPUT =
|
---|
| 191 | define TOOL_GCC3_COMPILE_CXX_CMDS
|
---|
[696] | 192 | $(QUIET)$(TOOL_GCC3_CXX) -c\
|
---|
[3566] | 193 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[380] | 194 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 195 | -o $(obj)\
|
---|
[697] | 196 | $(abspath $(source))
|
---|
[2431] | 197 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[93] | 198 | endef
|
---|
[1418] | 199 | endif # !KBUILD_USE_KOBJCACHE
|
---|
[93] | 200 |
|
---|
| 201 |
|
---|
[461] | 202 | ## Compile Assembly source.
|
---|
| 203 | # @param $(target) Normalized main target name.
|
---|
| 204 | # @param $(source) Source filename (relative).
|
---|
| 205 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
---|
| 206 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
---|
| 207 | # @param $(flags) Flags.
|
---|
| 208 | # @param $(defs) Definitions. No -D or something.
|
---|
| 209 | # @param $(incs) Includes. No -I or something.
|
---|
| 210 | # @param $(dirdep) Directory creation dependency.
|
---|
| 211 | # @param $(deps) Other dependencies.
|
---|
| 212 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
| 213 | # @param $(objsuff) Object suffix.
|
---|
| 214 | #
|
---|
[469] | 215 | TOOL_GCC3_COMPILE_AS_OUTPUT =
|
---|
[461] | 216 | TOOL_GCC3_COMPILE_AS_DEPEND =
|
---|
| 217 | TOOL_GCC3_COMPILE_AS_DEPORD =
|
---|
| 218 | define TOOL_GCC3_COMPILE_AS_CMDS
|
---|
[696] | 219 | $(QUIET)$(TOOL_GCC3_AS) -c\
|
---|
[3566] | 220 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
---|
[461] | 221 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
---|
| 222 | -o $(obj)\
|
---|
[697] | 223 | $(abspath $(source))
|
---|
[2431] | 224 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
---|
[461] | 225 | endef
|
---|
| 226 |
|
---|
| 227 |
|
---|
[93] | 228 | ## Link library
|
---|
| 229 | # @param $(target) Normalized main target name.
|
---|
[380] | 230 | # @param $(out) Library name.
|
---|
[93] | 231 | # @param $(objs) Object files to put in the library.
|
---|
| 232 | # @param $(flags) Flags.
|
---|
[235] | 233 | # @param $(dirdep) Directory creation dependency.
|
---|
| 234 | # @param $(deps) Other dependencies.
|
---|
| 235 | # @param $(othersrc) Unhandled sources.
|
---|
[93] | 236 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[1034] | 237 | TOOL_GCC3_LINK_LIBRARY_OUTPUT = $(out).ar-script
|
---|
| 238 | TOOL_GCC3_LINK_LIBRARY_OUTPUT_MAYBE = $(outbase).imp.a
|
---|
[772] | 239 | TOOL_GCC3_LINK_LIBRARY_DEPEND = $(othersrc)
|
---|
[380] | 240 | TOOL_GCC3_LINK_LIBRARY_DEPORD =
|
---|
| 241 | define TOOL_GCC3_LINK_LIBRARY_CMDS
|
---|
[772] | 242 | $(QUIET)$(APPEND) $(out).ar-script 'CREATE $(out)'
|
---|
| 243 | $(QUIET)$(APPEND) -n $(out).ar-script \
|
---|
| 244 | $(foreach o,$(objs), 'ADDMOD $(o)') \
|
---|
[2775] | 245 | $(foreach o,$(filter-out %.def %.imp %.dll,$(othersrc)), 'ADDLIB $(o)')
|
---|
| 246 | $(if $(filter %.def %.imp %.dll,$(othersrc))\
|
---|
| 247 | ,$(TOOL_GCC3_AR_IMP) -o $(outbase).imp.a $(filter %.def %.imp %.dll,$(othersrc))\
|
---|
[772] | 248 | $(NL)$(TAB)$(QUIET)$(APPEND) $(out).ar-script 'ADDLIB $(outbase).imp.a')
|
---|
| 249 | $(QUIET)$(APPEND) $(out).ar-script 'SAVE'
|
---|
| 250 | $(QUIET)$(APPEND) $(out).ar-script 'END'
|
---|
[1315] | 251 | $(QUIET)$(REDIRECT) -rti $(out).ar-script -- $(TOOL_GCC3_AR) -M
|
---|
[772] | 252 | endef
|
---|
[206] | 253 |
|
---|
| 254 |
|
---|
[93] | 255 | ## Link program
|
---|
| 256 | # @param $(target) Normalized main target name.
|
---|
[353] | 257 | # @param $(out) Program name.
|
---|
[93] | 258 | # @param $(objs) Object files to link together.
|
---|
| 259 | # @param $(libs) Libraries to search.
|
---|
| 260 | # @param $(libpath) Library search paths.
|
---|
| 261 | # @param $(flags) Flags.
|
---|
[235] | 262 | # @param $(dirdep) Directory creation dependency.
|
---|
| 263 | # @param $(deps) Other dependencies.
|
---|
| 264 | # @param $(othersrc) Unhandled sources.
|
---|
| 265 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
| 266 | # @param $(custom_post) Custom step invoked after linking.
|
---|
[93] | 267 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[1032] | 268 | TOOL_GCC3_LINK_PROGRAM_OUTPUT =
|
---|
| 269 | TOOL_GCC3_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
|
---|
[2541] | 270 | TOOL_GCC3_LINK_PROGRAM_OUTPUT_DEBUG = $(outbase).debug
|
---|
| 271 | TOOL_GCC3_LINK_PROGRAM_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
---|
[572] | 272 | TOOL_GCC3_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
| 273 | $(filter %.def, $(othersrc))
|
---|
[461] | 274 | TOOL_GCC3_LINK_PROGRAM_DEPORD =
|
---|
[380] | 275 | define TOOL_GCC3_LINK_PROGRAM_CMDS
|
---|
[696] | 276 | $(QUIET)$(TOOL_GCC3_LD) $(flags) -o $(out) $(objs)\
|
---|
[572] | 277 | $(filter %.def, $(othersrc))\
|
---|
[380] | 278 | $(foreach p,$(libpath), -L$(p))\
|
---|
[1259] | 279 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
---|
[231] | 280 | $(call TOOL_GCC3_LD_MAP,$(outbase).map)
|
---|
[2541] | 281 | ifeq ($(ld_debug),split)
|
---|
[2774] | 282 | $(QUIET)$(TOOL_GCC3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
---|
| 283 | $(QUIET)$(CHMOD) a-x $(outbase).debug
|
---|
| 284 | $(QUIET)$(TOOL_GCC3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
---|
[2541] | 285 | endif
|
---|
[93] | 286 | endef
|
---|
| 287 |
|
---|
[130] | 288 |
|
---|
| 289 | ## Link DLL
|
---|
| 290 | # @param $(target) Normalized main target name.
|
---|
[353] | 291 | # @param $(out) Program name.
|
---|
[130] | 292 | # @param $(objs) Object files to link together.
|
---|
| 293 | # @param $(libs) Libraries to search.
|
---|
| 294 | # @param $(libpath) Library search paths.
|
---|
| 295 | # @param $(flags) Flags.
|
---|
[235] | 296 | # @param $(dirdep) Directory creation dependency.
|
---|
| 297 | # @param $(deps) Other dependencies.
|
---|
| 298 | # @param $(othersrc) Unhandled sources.
|
---|
| 299 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
| 300 | # @param $(custom_post) Custom step invoked after linking.
|
---|
[130] | 301 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[1032] | 302 | TOOL_GCC3_LINK_DLL_OUTPUT =
|
---|
| 303 | TOOL_GCC3_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
|
---|
[2541] | 304 | TOOL_GCC3_LINK_DLL_OUTPUT_DEBUG = $(outbase).debug
|
---|
| 305 | TOOL_GCC3_LINK_DLL_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
---|
[572] | 306 | TOOL_GCC3_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
| 307 | $(filter %.def, $(othersrc))
|
---|
[380] | 308 | TOOL_GCC3_LINK_DLL_DEPORD =
|
---|
| 309 | define TOOL_GCC3_LINK_DLL_CMDS
|
---|
[696] | 310 | $(QUIET)$(TOOL_GCC3_LD) $(TOOL_GCC3_LDFLAGS.dll) $(flags) -o $(out)\
|
---|
[2541] | 311 | $(if $(filter-out win os2, $(KBUILD_TARGET)),$(call TOOL_GCC3_LD_SONAME,$(target),$(out)))\
|
---|
[380] | 312 | $(objs)\
|
---|
[572] | 313 | $(filter %.def, $(othersrc))\
|
---|
[380] | 314 | $(foreach p,$(libpath), -L$(p))\
|
---|
[1259] | 315 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
---|
[231] | 316 | $(call TOOL_GCC3_LD_MAP,$(outbase).map)
|
---|
[2541] | 317 | ifeq ($(ld_debug),split)
|
---|
[2774] | 318 | $(QUIET)$(TOOL_GCC3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
---|
| 319 | $(QUIET)$(CHMOD) a-x $(outbase).debug
|
---|
| 320 | $(QUIET)$(TOOL_GCC3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
---|
[2541] | 321 | endif
|
---|
[130] | 322 | endef
|
---|
| 323 |
|
---|
[380] | 324 |
|
---|
[137] | 325 | ## Link system module (windows aka driver, linux aka kernel module)
|
---|
| 326 | # @param $(target) Normalized main target name.
|
---|
[353] | 327 | # @param $(out) System module name.
|
---|
[137] | 328 | # @param $(objs) Object files to link together.
|
---|
| 329 | # @param $(libs) Libraries to search.
|
---|
| 330 | # @param $(libpath) Library search paths.
|
---|
| 331 | # @param $(flags) Flags.
|
---|
[235] | 332 | # @param $(dirdep) Directory creation dependency.
|
---|
| 333 | # @param $(deps) Other dependencies.
|
---|
| 334 | # @param $(othersrc) Unhandled sources.
|
---|
| 335 | # @param $(custom_pre) Custom step invoked before linking.
|
---|
| 336 | # @param $(custom_post) Custom step invoked after linking.
|
---|
[137] | 337 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
[1032] | 338 | TOOL_GCC3_LINK_SYSMOD_OUTPUT =
|
---|
| 339 | TOOL_GCC3_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
|
---|
[2541] | 340 | TOOL_GCC3_LINK_SYSMOD_OUTPUT_DEBUG = $(outbase).debug
|
---|
| 341 | TOOL_GCC3_LINK_SYSMOD_DEBUG_INSTALL_FN = $(2).debug=>$(basename $(3)).debug
|
---|
[572] | 342 | TOOL_GCC3_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
---|
| 343 | $(filter %.def, $(othersrc))
|
---|
[380] | 344 | TOOL_GCC3_LINK_SYSMOD_DEPORD =
|
---|
| 345 | define TOOL_GCC3_LINK_SYSMOD_CMDS
|
---|
[696] | 346 | $(QUIET)$(TOOL_GCC3_LD_SYSMOD) $(TOOL_GCC3_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
|
---|
[572] | 347 | $(filter %.def, $(othersrc))\
|
---|
[380] | 348 | $(foreach p,$(libpath), -L$(p))\
|
---|
[1259] | 349 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))\
|
---|
[231] | 350 | $(call TOOL_GCC3_LD_SYSMOD_MAP,$(outbase).map)
|
---|
[2541] | 351 | ifeq ($(ld_debug),split)
|
---|
[2774] | 352 | $(QUIET)$(TOOL_GCC3_OBJCOPY) --only-keep-debug $(out) $(outbase).debug
|
---|
| 353 | $(QUIET)$(CHMOD) a-x $(outbase).debug
|
---|
| 354 | $(QUIET)$(TOOL_GCC3_OBJCOPY) --strip-debug --strip-unneeded --add-gnu-debuglink=$(outbase).debug $(out)
|
---|
[2541] | 355 | endif
|
---|
[137] | 356 | endef
|
---|
[184] | 357 |
|
---|