| 1 | # $Id: GXX3PLAIN.kmk 3567 2022-06-26 20:00:02Z bird $
|
|---|
| 2 | ## @file
|
|---|
| 3 | # kBuild Tool Config - Generic GCC v3.2.x or later using the system GCC, any Unix linker and Unix archiver to build C++ code.
|
|---|
| 4 | #
|
|---|
| 5 |
|
|---|
| 6 | #
|
|---|
| 7 | # Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@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_GXX3PLAIN := Generic GCC v3.2.x or later using the system GCC, any Unix linker and Unix archiver to build C++ code.
|
|---|
| 35 |
|
|---|
| 36 | # Tool Specific Properties
|
|---|
| 37 | ifndef TOOL_GXX3PLAIN_PREFIX
|
|---|
| 38 | TOOL_GXX3PLAIN_PREFIX :=
|
|---|
| 39 | endif
|
|---|
| 40 | ifndef TOOL_GXX3PLAIN_SUFFIX
|
|---|
| 41 | TOOL_GXX3PLAIN_SUFFIX := $(HOSTSUFF_EXE)
|
|---|
| 42 | endif
|
|---|
| 43 | TOOL_GXX3PLAIN_PREFIX2 ?=
|
|---|
| 44 | TOOL_GXX3PLAIN_SUFFIX2 ?= $(HOSTSUFF_EXE)
|
|---|
| 45 | TOOL_GXX3PLAIN_CC ?= $(TOOL_GXX3PLAIN_PREFIX)gcc$(TOOL_GXX3PLAIN_SUFFIX)
|
|---|
| 46 | TOOL_GXX3PLAIN_CXX ?= $(TOOL_GXX3PLAIN_PREFIX)g++$(TOOL_GXX3PLAIN_SUFFIX)
|
|---|
| 47 | TOOL_GXX3PLAIN_PCH ?= $(TOOL_GXX3PLAIN_CXX)
|
|---|
| 48 | TOOL_GXX3PLAIN_AS ?= $(TOOL_GXX3PLAIN_PREFIX)gcc$(TOOL_GXX3PLAIN_SUFFIX)
|
|---|
| 49 | TOOL_GXX3PLAIN_AR ?= $(TOOL_GXX3PLAIN_PREFIX2)ar$(TOOL_GXX3PLAIN_SUFFIX2)
|
|---|
| 50 | TOOL_GXX3PLAIN_RANLIB ?= $(TOOL_GXX3PLAIN_PREFIX2)ranlib$(TOOL_GXX3PLAIN_SUFFIX2)
|
|---|
| 51 | TOOL_GXX3PLAIN_LD ?= $(TOOL_GXX3PLAIN_PREFIX)g++$(TOOL_GXX3PLAIN_SUFFIX)
|
|---|
| 52 | TOOL_GXX3PLAIN_LD_SYSMOD ?= $(TOOL_GXX3PLAIN_PREFIX2)ld$(TOOL_GXX3PLAIN_SUFFIX2)
|
|---|
| 53 | TOOL_GXX3PLAIN_LD_SYSMOD.os2 ?= $(TOOL_GXX3PLAIN_PREFIX)g++$(TOOL_GXX3PLAIN_SUFFIX)
|
|---|
| 54 | TOOL_GXX3PLAIN_LDFLAGS.dll.os2 ?= -Zdll
|
|---|
| 55 | TOOL_GXX3PLAIN_LDFLAGS.dll.darwin ?= -dynamiclib
|
|---|
| 56 | ifndef TOOL_GXX3PLAIN_LDFLAGS.$(KBUILD_TARGET)
|
|---|
| 57 | TOOL_GXX3PLAIN_LDFLAGS.dll ?= -shared
|
|---|
| 58 | else
|
|---|
| 59 | TOOL_GXX3PLAIN_LDFLAGS.dll ?= $(TOOL_GXX3PLAIN_LDFLAGS.$(KBUILD_TARGET))
|
|---|
| 60 | endif
|
|---|
| 61 | TOOL_GXX3PLAIN_LD_SONAME.darwin ?= $(NO_SUCH_VARIABLE)
|
|---|
| 62 | TOOL_GXX3PLAIN_LD_SONAME.os2 ?= $(NO_SUCH_VARIABLE)
|
|---|
| 63 | TOOL_GXX3PLAIN_LD_SONAME.solaris ?= -Wl,-h,$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
|
|---|
| 64 | TOOL_GXX3PLAIN_LD_SONAME.win ?= $(NO_SUCH_VARIABLE)
|
|---|
| 65 | ifndef TOOL_GXX3PLAIN_LD_SONAME.$(KBUILD_TARGET)
|
|---|
| 66 | TOOL_GXX3PLAIN_LD_SONAME ?= -Wl,-soname=$(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
|
|---|
| 67 | else
|
|---|
| 68 | TOOL_GXX3PLAIN_LD_SONAME ?= $(TOOL_GXX3PLAIN_LD_SONAME.$(KBUILD_TARGET))
|
|---|
| 69 | endif
|
|---|
| 70 |
|
|---|
| 71 | # General Properties used by kBuild
|
|---|
| 72 | TOOL_GXX3PLAIN_COBJSUFF ?= .o
|
|---|
| 73 | TOOL_GXX3PLAIN_CFLAGS ?=
|
|---|
| 74 | TOOL_GXX3PLAIN_CFLAGS.debug ?= -g
|
|---|
| 75 | TOOL_GXX3PLAIN_CFLAGS.profile ?= -O2 #-g -pg
|
|---|
| 76 | TOOL_GXX3PLAIN_CFLAGS.release ?= -O2
|
|---|
| 77 | TOOL_GXX3PLAIN_CINCS ?=
|
|---|
| 78 | TOOL_GXX3PLAIN_CDEFS ?=
|
|---|
| 79 |
|
|---|
| 80 | TOOL_GXX3PLAIN_CXXOBJSUFF ?= .o
|
|---|
| 81 | TOOL_GXX3PLAIN_CXXFLAGS ?=
|
|---|
| 82 | TOOL_GXX3PLAIN_CXXFLAGS.debug ?= -g
|
|---|
| 83 | TOOL_GXX3PLAIN_CXXFLAGS.profile ?= -O2 #-g -pg
|
|---|
| 84 | TOOL_GXX3PLAIN_CXXFLAGS.release ?= -O2
|
|---|
| 85 | TOOL_GXX3PLAIN_CXXINCS ?=
|
|---|
| 86 | TOOL_GXX3PLAIN_CXXDEFS ?=
|
|---|
| 87 |
|
|---|
| 88 | TOOL_GXX3PLAIN_PCHOBJSUFF ?= .h.gch
|
|---|
| 89 | TOOL_GXX3PLAIN_PCHFLAGS ?= $(TOOL_GXX3PLAIN_CXXFLAGS)
|
|---|
| 90 | TOOL_GXX3PLAIN_PCHFLAGS.debug ?= $(TOOL_GXX3PLAIN_CXXFLAGS.debug)
|
|---|
| 91 | TOOL_GXX3PLAIN_PCHFLAGS.profile ?= $(TOOL_GXX3PLAIN_CXXFLAGS.profile)
|
|---|
| 92 | TOOL_GXX3PLAIN_PCHFLAGS.release ?= $(TOOL_GXX3PLAIN_CXXFLAGS.release)
|
|---|
| 93 | TOOL_GXX3PLAIN_PCHINCS ?= $(TOOL_GXX3PLAIN_CXXINCS)
|
|---|
| 94 | TOOL_GXX3PLAIN_PCHDEFS ?= $(TOOL_GXX3PLAIN_CXXDEFS)
|
|---|
| 95 |
|
|---|
| 96 | TOOL_GXX3PLAIN_ASFLAGS ?= -x assembler-with-cpp
|
|---|
| 97 | TOOL_GXX3PLAIN_ASFLAGS.debug ?= -g
|
|---|
| 98 | TOOL_GXX3PLAIN_ASFLAGS.profile ?= -g
|
|---|
| 99 | TOOL_GXX3PLAIN_ASOBJSUFF ?= .o
|
|---|
| 100 |
|
|---|
| 101 | TOOL_GXX3PLAIN_ARFLAGS ?= cr
|
|---|
| 102 | TOOL_GXX3PLAIN_ARLIBSUFF ?= .a
|
|---|
| 103 |
|
|---|
| 104 | TOOL_GXX3PLAIN_LDFLAGS ?=
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 | ## Compile C source.
|
|---|
| 108 | # @param $(target) Normalized main target name.
|
|---|
| 109 | # @param $(source) Source filename (relative).
|
|---|
| 110 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
|---|
| 111 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
|---|
| 112 | # @param $(flags) Flags.
|
|---|
| 113 | # @param $(defs) Definitions. No -D or something.
|
|---|
| 114 | # @param $(incs) Includes. No -I or something.
|
|---|
| 115 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 116 | # @param $(deps) Other dependencies.
|
|---|
| 117 | #
|
|---|
| 118 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 119 | # @param $(objsuff) Object suffix.
|
|---|
| 120 | TOOL_GXX3PLAIN_COMPILE_C_DEPEND =
|
|---|
| 121 | TOOL_GXX3PLAIN_COMPILE_C_DEPORD =
|
|---|
| 122 | TOOL_GXX3PLAIN_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
|
|---|
| 123 | TOOL_GXX3PLAIN_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
|---|
| 124 | define TOOL_GXX3PLAIN_COMPILE_C_CMDS
|
|---|
| 125 | if "$(use_objcache)" != ""
|
|---|
| 126 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
|---|
| 127 | --kObjCache-cpp $(outbase).i\
|
|---|
| 128 | $(TOOL_GXX3PLAIN_CC) -E -o -\
|
|---|
| 129 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
|---|
| 130 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
|---|
| 131 | $(abspath $(source))\
|
|---|
| 132 | --kObjCache-cc $(obj)\
|
|---|
| 133 | $(TOOL_GXX3PLAIN_CC) -c\
|
|---|
| 134 | $(flags) -fpreprocessed -x c\
|
|---|
| 135 | -o $(obj)\
|
|---|
| 136 | -
|
|---|
| 137 | else
|
|---|
| 138 | $(QUIET)$(TOOL_GXX3PLAIN_CC) -c\
|
|---|
| 139 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
|---|
| 140 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
|---|
| 141 | -o $(obj)\
|
|---|
| 142 | $(abspath $(source))
|
|---|
| 143 | endif
|
|---|
| 144 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
|---|
| 145 | endef
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 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 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 159 | # @param $(objsuff) Object suffix.
|
|---|
| 160 | TOOL_GXX3PLAIN_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
|
|---|
| 161 | TOOL_GXX3PLAIN_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
|
|---|
| 162 | TOOL_GXX3PLAIN_COMPILE_CXX_DEPORD =
|
|---|
| 163 | TOOL_GXX3PLAIN_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
|
|---|
| 164 | define TOOL_GXX3PLAIN_COMPILE_CXX_CMDS
|
|---|
| 165 | if "$(use_objcache)" != ""
|
|---|
| 166 | $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
|
|---|
| 167 | --kObjCache-cpp $(outbase).ii\
|
|---|
| 168 | $(TOOL_GXX3PLAIN_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
|
|---|
| 169 | ,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
|
|---|
| 170 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
|---|
| 171 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
|---|
| 172 | $(abspath $(source))\
|
|---|
| 173 | --kObjCache-cc $(obj)\
|
|---|
| 174 | $(TOOL_GXX3PLAIN_CXX) -c\
|
|---|
| 175 | $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
|
|---|
| 176 | -o $(obj)\
|
|---|
| 177 | -
|
|---|
| 178 | else
|
|---|
| 179 | $(QUIET)$(TOOL_GXX3PLAIN_CXX) -c\
|
|---|
| 180 | $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
|
|---|
| 181 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
|---|
| 182 | -o $(obj) $(if-expr defined($(target)_PCH_HDR) \
|
|---|
| 183 | ,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
|
|---|
| 184 | $(abspath $(source))
|
|---|
| 185 | endif
|
|---|
| 186 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
|---|
| 187 | endef
|
|---|
| 188 |
|
|---|
| 189 |
|
|---|
| 190 | ## Precompile C++ header.
|
|---|
| 191 | # @param $(target) Normalized main target name.
|
|---|
| 192 | # @param $(source) Source filename (relative).
|
|---|
| 193 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
|---|
| 194 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
|---|
| 195 | # @param $(flags) Flags.
|
|---|
| 196 | # @param $(defs) Definitions. No -D or something.
|
|---|
| 197 | # @param $(incs) Includes. No -I or something.
|
|---|
| 198 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 199 | # @param $(deps) Other dependencies.
|
|---|
| 200 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 201 | # @param $(objsuff) Object suffix.
|
|---|
| 202 | TOOL_GXX3PLAIN_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
|
|---|
| 203 | TOOL_GXX3PLAIN_COMPILE_PCH_DEPEND =
|
|---|
| 204 | TOOL_GXX3PLAIN_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
|
|---|
| 205 | define TOOL_GXX3PLAIN_COMPILE_PCH_CMDS
|
|---|
| 206 | $(QUIET)$(TOOL_GXX3PLAIN_PCH) -c\
|
|---|
| 207 | $(flags) $(qaddprefix sh,-I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(qaddprefix sh,-D, $(defs))\
|
|---|
| 208 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
|---|
| 209 | -o $(obj)\
|
|---|
| 210 | $(abspath $(source))
|
|---|
| 211 | $(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
|
|---|
| 212 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
|---|
| 213 | endef
|
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 | ## Compile Assembly source.
|
|---|
| 217 | # @param $(target) Normalized main target name.
|
|---|
| 218 | # @param $(source) Source filename (relative).
|
|---|
| 219 | # @param $(obj) Object file name. This shall be (re)created by the compilation.
|
|---|
| 220 | # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
|
|---|
| 221 | # @param $(flags) Flags.
|
|---|
| 222 | # @param $(defs) Definitions. No -D or something.
|
|---|
| 223 | # @param $(incs) Includes. No -I or something.
|
|---|
| 224 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 225 | # @param $(deps) Other dependencies.
|
|---|
| 226 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 227 | # @param $(objsuff) Object suffix.
|
|---|
| 228 | #
|
|---|
| 229 | TOOL_GXX3PLAIN_COMPILE_AS_OUTPUT =
|
|---|
| 230 | TOOL_GXX3PLAIN_COMPILE_AS_DEPEND =
|
|---|
| 231 | TOOL_GXX3PLAIN_COMPILE_AS_DEPORD =
|
|---|
| 232 | define TOOL_GXX3PLAIN_COMPILE_AS_CMDS
|
|---|
| 233 | $(QUIET)$(TOOL_GXX3PLAIN_AS) -c\
|
|---|
| 234 | $(flags) $(qaddprefix sh,-I, $(incs)) $(qaddprefix sh,-D, $(defs))\
|
|---|
| 235 | -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
|
|---|
| 236 | -o $(obj)\
|
|---|
| 237 | $(abspath $(source))
|
|---|
| 238 | $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
|
|---|
| 239 | endef
|
|---|
| 240 |
|
|---|
| 241 |
|
|---|
| 242 | ## Link library
|
|---|
| 243 | # @param $(target) Normalized main target name.
|
|---|
| 244 | # @param $(out) Library name.
|
|---|
| 245 | # @param $(objs) Object files to put in the library.
|
|---|
| 246 | # @param $(flags) Flags.
|
|---|
| 247 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 248 | # @param $(deps) Other dependencies.
|
|---|
| 249 | # @param $(othersrc) Unhandled sources.
|
|---|
| 250 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 251 | TOOL_GXX3PLAIN_LINK_LIBRARY_OUTPUT =
|
|---|
| 252 | TOOL_GXX3PLAIN_LINK_LIBRARY_DEPEND = $(othersrc)
|
|---|
| 253 | TOOL_GXX3PLAIN_LINK_LIBRARY_DEPORD =
|
|---|
| 254 | define TOOL_GXX3PLAIN_LINK_LIBRARY_CMDS
|
|---|
| 255 | $(call xargs,$(QUIET)$(TOOL_GXX3PLAIN_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs)))
|
|---|
| 256 | $(foreach lib,$(othersrc)\
|
|---|
| 257 | ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
|
|---|
| 258 | $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
|
|---|
| 259 | $(NL)$(TAB)$(QUIET)$(MKDIR) -p $(dir $(outbase))/ar.tmp.dir/ \
|
|---|
| 260 | $(NL)$(TAB)$(QUIET)(cd $(dir $(outbase))ar.tmp.dir/ \
|
|---|
| 261 | && $(TOOL_GXX3PLAIN_AR) x $(abspath $(lib)) \
|
|---|
| 262 | && $(TOOL_GXX3PLAIN_AR) $(flags) $(out) *) \
|
|---|
| 263 | $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))/ar.tmp.dir/* \
|
|---|
| 264 | $(NL)$(TAB)$(QUIET)$(RMDIR) $(dir $(outbase))ar.tmp.dir/)
|
|---|
| 265 | $(QUIET)$(TOOL_GXX3PLAIN_RANLIB) $(out)
|
|---|
| 266 | endef
|
|---|
| 267 |
|
|---|
| 268 |
|
|---|
| 269 | ## Link program
|
|---|
| 270 | # @param $(target) Normalized main target name.
|
|---|
| 271 | # @param $(out) Program name.
|
|---|
| 272 | # @param $(objs) Object files to link together.
|
|---|
| 273 | # @param $(libs) Libraries to search.
|
|---|
| 274 | # @param $(libpath) Library search paths.
|
|---|
| 275 | # @param $(flags) Flags.
|
|---|
| 276 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 277 | # @param $(deps) Other dependencies.
|
|---|
| 278 | # @param $(othersrc) Unhandled sources.
|
|---|
| 279 | # @param $(custom_pre) Custom step invoked before linking.
|
|---|
| 280 | # @param $(custom_post) Custom step invoked after linking.
|
|---|
| 281 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 282 | TOOL_GXX3PLAIN_LINK_PROGRAM_OUTPUT =
|
|---|
| 283 | TOOL_GXX3PLAIN_LINK_PROGRAM_OUTPUT_MAYBE = $(outbase).map
|
|---|
| 284 | TOOL_GXX3PLAIN_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
|---|
| 285 | $(filter %.def, $(othersrc))
|
|---|
| 286 | TOOL_GXX3PLAIN_LINK_PROGRAM_DEPORD =
|
|---|
| 287 | define TOOL_GXX3PLAIN_LINK_PROGRAM_CMDS
|
|---|
| 288 | $(QUIET)$(TOOL_GXX3PLAIN_LD) $(flags) -o $(out) $(filter-out %.h.gch,$(objs))\
|
|---|
| 289 | $(filter %.def, $(othersrc))\
|
|---|
| 290 | $(foreach p,$(libpath), -L$(p))\
|
|---|
| 291 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
|---|
| 292 | endef
|
|---|
| 293 |
|
|---|
| 294 |
|
|---|
| 295 | ## Link DLL
|
|---|
| 296 | # @param $(target) Normalized main target name.
|
|---|
| 297 | # @param $(out) Program name.
|
|---|
| 298 | # @param $(objs) Object files to link together.
|
|---|
| 299 | # @param $(libs) Libraries to search.
|
|---|
| 300 | # @param $(libpath) Library search paths.
|
|---|
| 301 | # @param $(flags) Flags.
|
|---|
| 302 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 303 | # @param $(deps) Other dependencies.
|
|---|
| 304 | # @param $(othersrc) Unhandled sources.
|
|---|
| 305 | # @param $(custom_pre) Custom step invoked before linking.
|
|---|
| 306 | # @param $(custom_post) Custom step invoked after linking.
|
|---|
| 307 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 308 | TOOL_GXX3PLAIN_LINK_DLL_OUTPUT =
|
|---|
| 309 | TOOL_GXX3PLAIN_LINK_DLL_OUTPUT_MAYBE = $(outbase).map
|
|---|
| 310 | TOOL_GXX3PLAIN_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
|---|
| 311 | $(filter %.def, $(othersrc))
|
|---|
| 312 | TOOL_GXX3PLAIN_LINK_DLL_DEPORD =
|
|---|
| 313 | define TOOL_GXX3PLAIN_LINK_DLL_CMDS
|
|---|
| 314 | $(QUIET)$(TOOL_GXX3PLAIN_LD) $(TOOL_GXX3PLAIN_LDFLAGS.dll) $(flags) -o $(out)\
|
|---|
| 315 | $(if $(filter-out win32 os2, $(KBUILD_TARGET)),$(call TOOL_GXX3PLAIN_LD_SONAME,$(target),$(out)))\
|
|---|
| 316 | $(filter-out %.h.gch,$(objs))\
|
|---|
| 317 | $(filter %.def, $(othersrc))\
|
|---|
| 318 | $(foreach p,$(libpath), -L$(p))\
|
|---|
| 319 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
|---|
| 320 | endef
|
|---|
| 321 |
|
|---|
| 322 |
|
|---|
| 323 | ## Link system module (windows aka driver, linux aka kernel module)
|
|---|
| 324 | # This tool target might not work everywhere, but is provided for the
|
|---|
| 325 | # platforms where it works (Solaris, etc).
|
|---|
| 326 | #
|
|---|
| 327 | # @param $(target) Normalized main target name.
|
|---|
| 328 | # @param $(out) System module name.
|
|---|
| 329 | # @param $(objs) Object files to link together.
|
|---|
| 330 | # @param $(libs) Libraries to search.
|
|---|
| 331 | # @param $(libpath) Library search paths.
|
|---|
| 332 | # @param $(flags) Flags.
|
|---|
| 333 | # @param $(dirdep) Directory creation dependency.
|
|---|
| 334 | # @param $(deps) Other dependencies.
|
|---|
| 335 | # @param $(othersrc) Unhandled sources.
|
|---|
| 336 | # @param $(custom_pre) Custom step invoked before linking.
|
|---|
| 337 | # @param $(custom_post) Custom step invoked after linking.
|
|---|
| 338 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
|---|
| 339 | TOOL_GXX3PLAIN_LINK_SYSMOD_OUTPUT =
|
|---|
| 340 | TOOL_GXX3PLAIN_LINK_SYSMOD_OUTPUT_MAYBE = $(outbase).map
|
|---|
| 341 | TOOL_GXX3PLAIN_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))\
|
|---|
| 342 | $(filter %.def, $(othersrc))
|
|---|
| 343 | TOOL_GXX3PLAIN_LINK_SYSMOD_DEPORD =
|
|---|
| 344 | define TOOL_GXX3PLAIN_LINK_SYSMOD_CMDS
|
|---|
| 345 | $(QUIET)$(if $(TOOL_GXX3PLAIN_LD_SYSMOD.$(bld_trg)),$(TOOL_GXX3PLAIN_LD_SYSMOD.$(bld_trg)),$(TOOL_GXX3PLAIN_LD_SYSMOD))\
|
|---|
| 346 | $(TOOL_GXX3PLAIN_LDFLAGS_SYSMOD.$(bld_trg)) $(flags) -o $(out) \
|
|---|
| 347 | $(filter-out %.h.gch,$(objs))\
|
|---|
| 348 | $(filter %.def, $(othersrc))\
|
|---|
| 349 | $(foreach p,$(libpath), -L$(p))\
|
|---|
| 350 | $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
|
|---|
| 351 | endef
|
|---|
| 352 |
|
|---|