Commit 9f64cd5c authored by Gianfranco Costamagna's avatar Gianfranco Costamagna

New upstream version 0.1.9998svn3290+dfsg

parent 4e5caae5
# $Id: footer-pass2-compiling-targets.kmk 3160 2018-03-19 22:39:19Z bird $ # $Id: footer-pass2-compiling-targets.kmk 3285 2019-01-05 03:24:58Z bird $
## @file ## @file
# kBuild - Footer - Target lists - Pass 2 - Compiling Targets. # kBuild - Footer - Target lists - Pass 2 - Compiling Targets.
# #
# #
# Copyright (c) 2004-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net> # Copyright (c) 2004-2019 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
# #
# This file is part of kBuild. # This file is part of kBuild.
# #
...@@ -36,7 +36,79 @@ ...@@ -36,7 +36,79 @@
# Object processing. # Object processing.
# #
## wrapper the compile command dependency check. ifndef NO_COMPILE_CMDS_DEPS
## Generates the rules for building a specific object and the aliases.
# for building a source file.
# @param $(obj) The object file.
define def_target_source_rule_v3plus
$$(obj): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $$@),FORCE)
$$(obj) + $$(kbsrc_output) +| $$(kbsrc_output_maybe) : $$(kbsrc_depend) | $$(kbsrc_depord) $(target_intermediate_vars)
%$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
ifndef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT
$$(QUIET)$$(RM) -f -- $(dep) $(obj) $(kbsrc_output) $(kbsrc_output_maybe)
endif
$(kbsrc_cmds)
%$$(QUIET2)$$(APPEND) -in '$(dep)' '' 'define $(target)_$(subst :,_,$(source))_CMDS_PREV_' '--insert-command=$(obj)' 'endef'
$$(basename $$(notdir $$(obj))).o: $$(obj)
endef # def_target_source_rule_v3plus
## Generates the rules for building a specific object and the aliases, kObjCache variant.
# for building a source file.
# @param $(obj) The object file.
define def_target_source_rule_v3plus_objcache
$$(obj): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $$@),FORCE)
_OUT_FILES += $(outbase).koc
$$(outbase).koc +| $$(obj) $$(kbsrc_output) $$(kbsrc_output_maybe) : $$(kbsrc_depend) | $$(kbsrc_depord) $(target_intermediate_vars)
%$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
$(kbsrc_cmds)
%$$(QUIET2)$$(APPEND) -in '$(dep)' '' 'define $(target)_$(subst :,_,$(source))_CMDS_PREV_' '--insert-command=$(obj)' 'endef'
$$(basename $$(notdir $$(obj))).o: $$(obj)
endef # def_target_source_rule_v3plus_objcache
else # NO_COMPILE_CMDS_DEPS
## Generates the rules for building a specific object and the aliases.
# for building a source file.
# @param $(obj) The object file.
define def_target_source_rule_v3plus
$$(obj) + $$(kbsrc_output) +| $$(kbsrc_output_maybe) : $$(kbsrc_depend) | $$(kbsrc_depord) $(target_intermediate_vars)
%$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
ifndef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT
$$(QUIET)$$(RM) -f -- $(dep) $(obj) $(kbsrc_output) $(kbsrc_output_maybe)
endif
$(kbsrc_cmds)
$$(basename $$(notdir $$(obj))).o: $$(obj)
endef # def_target_source_rule_v3plus
## Generates the rules for building a specific object and the aliases, kObjCache variant.
# for building a source file.
# @param $(obj) The object file.
define def_target_source_rule_v3plus_objcache
_OUT_FILES += $(outbase).koc
$$(outbase).koc +| $$(obj) $$(kbsrc_output) $$(kbsrc_output_maybe) : $$(kbsrc_depend) | $$(kbsrc_depord) $(target_intermediate_vars)
%$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
$(kbsrc_cmds)
$$(basename $$(notdir $$(obj))).o: $$(obj)
endef # def_target_source_rule_v3plus_objcache
endif # NO_COMPILE_CMDS_DEPS
$(eval-opt-var def_target_source_rule_v3plus)
$(eval-opt-var def_target_source_rule_v3plus_objcache)
##
## Legacy legacy legacy - start
##
## Wrapper
ifndef NO_COMPILE_CMDS_DEPS ifndef NO_COMPILE_CMDS_DEPS
if1of ($(KMK_FEATURES),dot-must-make) if1of ($(KMK_FEATURES),dot-must-make)
_DEP_COMPILE_CMDS = _DEP_COMPILE_CMDS =
...@@ -48,40 +120,23 @@ else ...@@ -48,40 +120,23 @@ else
_DEP_COMPILE_CMDS = _DEP_COMPILE_CMDS =
endif endif
## Generates the rules for building a specific object, and the aliases - legacy version.
## Generates the rules for building a specific object, and the aliases
# for building a source file. # for building a source file.
# @param $(obj) The object file. # @param $(obj) The object file.
define def_target_source_rule define def_target_source_rule
ifndef NO_COMPILE_CMDS_DEPS ifndef NO_COMPILE_CMDS_DEPS
$(obj): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $$@),FORCE) $(obj): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_CMDS_PREV_),$$(commands $$@),FORCE)
endif endif
ifdef TOOL_$(tool)_COMPILE_$(type)_USES_KOBJCACHE ifneq ($(TOOL_$(tool)_COMPILE_$(type)_USES_KOBJCACHE),)
_OUT_FILES += $(outbase).koc _OUT_FILES += $(outbase).koc
$(outbase).koc +| $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_$(source)_OUTPUT_MAYBE_) : \ $(outbase).koc +| $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_$(source)_OUTPUT_MAYBE_) : \
$($(target)_$(source)_DEPEND_) \ $($(target)_$(source)_DEPEND_) $(value _DEP_COMPILE_CMDS) \
$(value _DEP_COMPILE_CMDS) \ | $($(target)_$(source)_DEPORD_) $(target_intermediate_vars)
| \
$($(target)_$(source)_DEPORD_) \
$$$$($(target)_INTERMEDIATES) \
$$$$($(target)_INTERMEDIATES.$(bld_trg)) \
$$$$($(target)_INTERMEDIATES.$(bld_trg).$(bld_trg_arch)) \
$$$$($(target)_INTERMEDIATES.$(bld_trg_arch)) \
$$$$($(target)_INTERMEDIATES.$(bld_trg_cpu)) \
$$$$($(target)_INTERMEDIATES.$(bld_type))
%$$(call MSG_COMPILE,$(target),$(source),$$@,$(type)) %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
else else
$(obj) + $($(target)_$(source)_OUTPUT_) +| $($(target)_$(source)_OUTPUT_MAYBE_) : \ $(obj) + $($(target)_$(source)_OUTPUT_) +| $($(target)_$(source)_OUTPUT_MAYBE_) : \
$($(target)_$(source)_DEPEND_) \ $($(target)_$(source)_DEPEND_) $(value _DEP_COMPILE_CMDS) \
$(value _DEP_COMPILE_CMDS) \ | $($(target)_$(source)_DEPORD_) $(target_intermediate_vars)
| \
$($(target)_$(source)_DEPORD_) \
$$$$($(target)_INTERMEDIATES) \
$$$$($(target)_INTERMEDIATES.$(bld_trg)) \
$$$$($(target)_INTERMEDIATES.$(bld_trg).$(bld_trg_arch)) \
$$$$($(target)_INTERMEDIATES.$(bld_trg_arch)) \
$$$$($(target)_INTERMEDIATES.$(bld_trg_cpu)) \
$$$$($(target)_INTERMEDIATES.$(bld_type))
%$$(call MSG_COMPILE,$(target),$(source),$$@,$(type)) %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
ifndef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT ifndef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT
$$(QUIET)$$(RM) -f -- $(dep) $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_OUTPUT_MAYBE_) $$(QUIET)$$(RM) -f -- $(dep) $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_OUTPUT_MAYBE_)
...@@ -105,7 +160,6 @@ ifndef NO_COMPILE_CMDS_DEPS ...@@ -105,7 +160,6 @@ ifndef NO_COMPILE_CMDS_DEPS
endif endif
$(basename $(notdir $(obj))).o: $(obj) $(basename $(notdir $(obj))).o: $(obj)
$(basename $(notdir $(obj))).obj: $(obj)
## @todo make this 'local cmds,output,output_maybe,depend and depord' in 0.2.x or when a new kb-src-one is added. ## @todo make this 'local cmds,output,output_maybe,depend and depord' in 0.2.x or when a new kb-src-one is added.
$(target)_$(source)_CMDS_ := $(target)_$(source)_CMDS_ :=
...@@ -115,6 +169,9 @@ $(target)_$(source)_DEPEND_ := ...@@ -115,6 +169,9 @@ $(target)_$(source)_DEPEND_ :=
$(target)_$(source)_DEPORD_ := $(target)_$(source)_DEPORD_ :=
endef # def_target_source_rule endef # def_target_source_rule
$(eval-opt-var def_target_source_rule) $(eval-opt-var def_target_source_rule)
##
## Legacy legacy legacy - end
## wrapper the link command dependency check. ## wrapper the link command dependency check.
...@@ -212,32 +269,32 @@ endef ...@@ -212,32 +269,32 @@ endef
# @{ # @{
define def_src_handler_c define def_src_handler_c
local type := C local type := C
$(kb-src-one 2) $(kb-src-one 3)
endef endef
define def_src_handler_cxx define def_src_handler_cxx
local type := CXX local type := CXX
$(kb-src-one 2) $(kb-src-one 3)
endef endef
define def_src_handler_objc define def_src_handler_objc
local type := OBJC local type := OBJC
$(kb-src-one 2) $(kb-src-one 3)
endef endef
define def_src_handler_objcxx define def_src_handler_objcxx
local type := OBJCXX local type := OBJCXX
$(kb-src-one 2) $(kb-src-one 3)
endef endef
define def_src_handler_asm define def_src_handler_asm
local type := AS local type := AS
$(kb-src-one 2) $(kb-src-one 3)
endef endef
define def_src_handler_rc define def_src_handler_rc
local type := RC local type := RC
$(kb-src-one 2) $(kb-src-one 3)
endef endef
define def_src_handler_obj define def_src_handler_obj
...@@ -488,6 +545,27 @@ $(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target) ...@@ -488,6 +545,27 @@ $(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)
# no local here - must be writable across some foreachs. # no local here - must be writable across some foreachs.
othersrc := othersrc :=
$(target)_2_OBJS := $(target)_2_OBJS :=
$(target)_2_INTERMEDIATES =
# kObjCache.
ifdef KBUILD_USE_KOBJCACHE
ifneq ($($(target)_KOBJCACHE),)
local use_objcache := 1
else
local use_objcache :=
endif
local use_objcache :=
endif
# Target level intermediates (before units!).
local target_intermediate_vars := $$$$($(target)_2_INTERMEDIATES) $(foreach var, \
$(target)_INTERMEDIATES \
$(target)_INTERMEDIATES.$(bld_trg) \
$(target)_INTERMEDIATES.$(bld_trg).$(bld_trg_arch) \
$(target)_INTERMEDIATES.$(bld_trg_arch) \
$(target)_INTERMEDIATES.$(bld_trg_cpu) \
$(target)_INTERMEDIATES.$(bld_type) \
,$(if-expr defined($(var)),$$$$($(var)),))
# Do units pre source callouts. # Do units pre source callouts.
local units := \ local units := \
...@@ -693,6 +771,27 @@ endif ...@@ -693,6 +771,27 @@ endif
# no local here - must be writable across some foreachs. # no local here - must be writable across some foreachs.
othersrc := othersrc :=
$(target)_2_OBJS := $(target)_2_OBJS :=
$(target)_2_INTERMEDIATES =
# kObjCache.
ifdef KBUILD_USE_KOBJCACHE
ifneq ($($(target)_KOBJCACHE),)
local use_objcache := 1
else
local use_objcache :=
endif
local use_objcache :=
endif
# Target level intermediates (before units!).
local target_intermediate_vars := $$$$($(target)_2_INTERMEDIATES) $(foreach var, \
$(target)_INTERMEDIATES \
$(target)_INTERMEDIATES.$(bld_trg) \
$(target)_INTERMEDIATES.$(bld_trg).$(bld_trg_arch) \
$(target)_INTERMEDIATES.$(bld_trg_arch) \
$(target)_INTERMEDIATES.$(bld_trg_cpu) \
$(target)_INTERMEDIATES.$(bld_type) \
,$(if-expr defined($(var)),$$$$($(var)),))
# Do units pre source callouts. # Do units pre source callouts.
local units := \ local units := \
......
# $Id: header.kmk 3166 2018-03-20 12:42:52Z bird $ # $Id: header.kmk 3253 2019-01-02 00:23:15Z bird $
## @file ## @file
# kBuild - File included at top of a makefile. # kBuild - File included at top of a makefile.
# #
...@@ -79,7 +79,7 @@ endif ...@@ -79,7 +79,7 @@ endif
# The revision in which this file was last modified. # The revision in which this file was last modified.
# This can be useful when using development versions of kBuild. # This can be useful when using development versions of kBuild.
# #
KMK_REVISION := $(patsubst %:,, $Rev: 3166 $ ) KMK_REVISION := $(patsubst %:,, $Rev: 3253 $ )
# #
...@@ -1089,15 +1089,15 @@ KBUILD_SRC_HANDLERS := \ ...@@ -1089,15 +1089,15 @@ KBUILD_SRC_HANDLERS := \
## PROPS_TOOLS ## PROPS_TOOLS
# This is a subset of PROPS_SINGLE. # This is a subset of PROPS_SINGLE.
PROPS_TOOLS := TOOL CTOOL CXXTOOL OBJCTOOL OBJCXXTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL PROPS_TOOLS := TOOL CTOOL CXXTOOL PCHTOOL OBJCTOOL OBJCXXTOOL ASTOOL RCTOOL ARTOOL LDTOOL FETCHTOOL UNPACKTOOL PATCHTOOL
## PROPS_SINGLE ## PROPS_SINGLE
# The list of non-accumulative target properties. # The list of non-accumulative target properties.
# A Config.kmk file can add it's own properties to this list and kBuild # A Config.kmk file can add it's own properties to this list and kBuild
# will do the necessary inheritance for templates, sdks, tools and targets. # will do the necessary inheritance for templates, sdks, tools and targets.
PROPS_SINGLE := $(PROPS_TOOLS) TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \ PROPS_SINGLE := $(PROPS_TOOLS) TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF OBJCXXOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF BINSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF \ OBJSUFF COBJSUFF CXXOBJSUFF PCHOBJSUFF OBJCOBJSUFF OBJCXXOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF BINSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF \
MODE UID GID LD_DEBUG DEBUG_INSTTYPE DEBUG_INST DEBUG_STAGE MODE UID GID LD_DEBUG DEBUG_INSTTYPE DEBUG_INST DEBUG_STAGE PCH_HDR
## PROPS_SINGLE_LNK ## PROPS_SINGLE_LNK
# Subset of PROPS_SINGLE which applies to all linkable targets. # Subset of PROPS_SINGLE which applies to all linkable targets.
PROPS_SINGLE_LNK := $(filter-out FETCHTOOL UNPACKTOOL PATCHTOOL FETCHDIR, $(PROPS_SINGLE)) PROPS_SINGLE_LNK := $(filter-out FETCHTOOL UNPACKTOOL PATCHTOOL FETCHDIR, $(PROPS_SINGLE))
...@@ -1119,6 +1119,7 @@ PROPS_ACCUMULATE_R := \ ...@@ -1119,6 +1119,7 @@ PROPS_ACCUMULATE_R := \
ARFLAGS \ ARFLAGS \
CFLAGS CDEFS \ CFLAGS CDEFS \
CXXFLAGS CXXDEFS \ CXXFLAGS CXXDEFS \
PCHFLAGS PCHDEFS \
OBJCFLAGS OBJCDEFS \ OBJCFLAGS OBJCDEFS \
OBJCXXFLAGS OBJCXXDEFS \ OBJCXXFLAGS OBJCXXDEFS \
ASFLAGS ASDEFS \ ASFLAGS ASDEFS \
...@@ -1137,7 +1138,7 @@ PROPS_ACCUMULATE_R_LNK := $(filter-out ARFLAGS LDFLAGS EXEC_IFFLAGS FETCHFLAGS U ...@@ -1137,7 +1138,7 @@ PROPS_ACCUMULATE_R_LNK := $(filter-out ARFLAGS LDFLAGS EXEC_IFFLAGS FETCHFLAGS U
# will do the necessary inheritance from templates to targets. # will do the necessary inheritance from templates to targets.
PROPS_ACCUMULATE_L := \ PROPS_ACCUMULATE_L := \
SDKS USES SOURCES EXEC_SOURCES SRC_HANDLERS INTERMEDIATES \ SDKS USES SOURCES EXEC_SOURCES SRC_HANDLERS INTERMEDIATES \
INCS CINCS CXXINCS OBJCINCS OBJCXXINCS ASINCS RCINCS \ INCS CINCS CXXINCS PCHINCS OBJCINCS OBJCXXINCS ASINCS RCINCS \
LIBS LIBPATH \ LIBS LIBPATH \
DIRS BLDDIRS CLEAN DIRS BLDDIRS CLEAN
## PROPS_ACCUMULATE_L_LNK ## PROPS_ACCUMULATE_L_LNK
...@@ -1207,7 +1208,7 @@ PROPS_FETCHES_ACCUMULATE_L := SOURCES CLEAN ...@@ -1207,7 +1208,7 @@ PROPS_FETCHES_ACCUMULATE_L := SOURCES CLEAN
## KBUILD_COMPILE_CATEGTORIES ## KBUILD_COMPILE_CATEGTORIES
# Tools categories for compiling. # Tools categories for compiling.
KBUILD_COMPILE_CATEGTORIES := AS C CXX OBJC OBJCXX RC KBUILD_COMPILE_CATEGTORIES := AS C CXX PCH OBJC OBJCXX RC
## KBUILD_GENERIC_CATEGORIES ## KBUILD_GENERIC_CATEGORIES
# Generic tool categories. # Generic tool categories.
......
# $Id: GXX.kmk 3121 2017-10-31 10:58:59Z bird $ # $Id: GXX.kmk 3257 2019-01-03 02:46:05Z bird $
## @file ## @file
# kBuild Tool Config - Generic GCC using the system GCC, for building C++ code. # kBuild Tool Config - Generic GCC using the system GCC, for building C++ code.
# #
...@@ -36,6 +36,7 @@ TOOL_GXX := Generic GCC using the system GCC, for building C++ code. ...@@ -36,6 +36,7 @@ TOOL_GXX := Generic GCC using the system GCC, for building C++ code.
# Tool Specific Properties # Tool Specific Properties
TOOL_GXX_CC ?= gcc$(HOSTSUFF_EXE) TOOL_GXX_CC ?= gcc$(HOSTSUFF_EXE)
TOOL_GXX_CXX ?= g++$(HOSTSUFF_EXE) TOOL_GXX_CXX ?= g++$(HOSTSUFF_EXE)
TOOL_GXX_PCH ?= $(TOOL_GXX_CXX)
TOOL_GXX_AS ?= gcc$(HOSTSUFF_EXE) TOOL_GXX_AS ?= gcc$(HOSTSUFF_EXE)
TOOL_GXX_AR ?= ar$(HOSTSUFF_EXE) TOOL_GXX_AR ?= ar$(HOSTSUFF_EXE)
TOOL_GXX_RANLIB ?= ranlib$(HOSTSUFF_EXE) TOOL_GXX_RANLIB ?= ranlib$(HOSTSUFF_EXE)
...@@ -66,6 +67,14 @@ TOOL_GXX_CXXFLAGS.release ?= -O2 ...@@ -66,6 +67,14 @@ TOOL_GXX_CXXFLAGS.release ?= -O2
TOOL_GXX_CXXINCS ?= TOOL_GXX_CXXINCS ?=
TOOL_GXX_CXXDEFS ?= TOOL_GXX_CXXDEFS ?=
TOOL_GXX_PCHOBJSUFF ?= .h.gch
TOOL_GXX_PCHFLAGS ?= $(TOOL_GXX_CXXFLAGS)
TOOL_GXX_PCHFLAGS.debug ?= $(TOOL_GXX_CXXFLAGS.debug)
TOOL_GXX_PCHFLAGS.profile ?= $(TOOL_GXX_CXXFLAGS.profile)
TOOL_GXX_PCHFLAGS.release ?= $(TOOL_GXX_CXXFLAGS.release)
TOOL_GXX_PCHINCS ?= $(TOOL_GXX_CXXINCS)
TOOL_GXX_PCHDEFS ?= $(TOOL_GXX_CXXDEFS)
TOOL_GXX_ASFLAGS ?= -x assembler-with-cpp TOOL_GXX_ASFLAGS ?= -x assembler-with-cpp
TOOL_GXX_ASFLAGS.debug ?= -g TOOL_GXX_ASFLAGS.debug ?= -g
TOOL_GXX_ASFLAGS.profile ?= -g TOOL_GXX_ASFLAGS.profile ?= -g
...@@ -109,24 +118,51 @@ endef ...@@ -109,24 +118,51 @@ endef
# @param $(target) Normalized main target name. # @param $(target) Normalized main target name.
# @param $(source) Source filename (relative). # @param $(source) Source filename (relative).
# @param $(obj) Object file name. This shall be (re)created by the compilation. # @param $(obj) Object file name. This shall be (re)created by the compilation.
# @param $(dep) Dependcy file. This shall be (re)created by the compilation. # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
# @param $(flags) Flags. # @param $(flags) Flags.
# @param $(defs) Definitions. No -D or something. # @param $(defs) Definitions. No -D or something.
# @param $(incs) Includes. No -I or something. # @param $(incs) Includes. No -I or something.
# @param $(dirdep) Directory creation dependency. # @param $(dirdep) Directory creation dependency.
# @param $(deps) Other dependencies. # @param $(deps) Other dependencies.
# #
# @param $(outbase) Output basename (full). Use this for list files and such. # @param $(outbase) Output basename (full). Use this for list files and such.
# @param $(objsuff) Object suffix. # @param $(objsuff) Object suffix.
TOOL_GXX_COMPILE_CXX_OUTPUT = TOOL_GXX_COMPILE_CXX_OUTPUT =
TOOL_GXX_COMPILE_CXX_DEPEND = TOOL_GXX_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
TOOL_GXX_COMPILE_CXX_DEPORD = TOOL_GXX_COMPILE_CXX_DEPORD =
define TOOL_GXX_COMPILE_CXX_CMDS define TOOL_GXX_COMPILE_CXX_CMDS
$(QUIET)$(TOOL_GXX_CXX) -c\ $(QUIET)$(TOOL_GXX_CXX) -c\
$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ $(flags) $(addprefix -I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(addprefix -D, $(defs))\
-Wp,-MD,$(dep) -Wp,-MT,$(obj) \ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
-o $(obj) $(if-expr defined($(target)_PCH_HDR) \
,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
$(abspath $(source))
$(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
endef
## Precompile C++ header.
# @param $(target) Normalized main target name.
# @param $(source) Source filename (relative).
# @param $(obj) Object file name. This shall be (re)created by the compilation.
# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
# @param $(flags) Flags.
# @param $(defs) Definitions. No -D or something.
# @param $(incs) Includes. No -I or something.
# @param $(dirdep) Directory creation dependency.
# @param $(deps) Other dependencies.
# @param $(outbase) Output basename (full). Use this for list files and such.
# @param $(objsuff) Object suffix.
TOOL_GXX_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
TOOL_GXX_COMPILE_PCH_DEPEND =
TOOL_GXX_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
define TOOL_GXX_COMPILE_PCH_CMDS
$(QUIET)$(TOOL_GXX_PCH) -c\
$(flags) $(addprefix -I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(addprefix -D, $(defs))\
-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
-o $(obj)\ -o $(obj)\
$(abspath $(source)) $(abspath $(source))
$(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
$(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
endef endef
...@@ -170,8 +206,8 @@ TOOL_GXX_LINK_LIBRARY_OUTPUT = ...@@ -170,8 +206,8 @@ TOOL_GXX_LINK_LIBRARY_OUTPUT =
TOOL_GXX_LINK_LIBRARY_DEPEND = TOOL_GXX_LINK_LIBRARY_DEPEND =
TOOL_GXX_LINK_LIBRARY_DEPORD = TOOL_GXX_LINK_LIBRARY_DEPORD =
define TOOL_GXX_LINK_LIBRARY_CMDS define TOOL_GXX_LINK_LIBRARY_CMDS
$(QUIET)$(TOOL_GXX_AR) $(flags) $(out) $(objs) $(QUIET)$(TOOL_GXX_AR) $(flags) $(out) $(filter-out %.h.gch,$(objs))
$(call xargs,$(QUIET)$(TOOL_GXX_AR) $(flags) $(out),$(objs)) $(call xargs,$(QUIET)$(TOOL_GXX_AR) $(flags) $(out),$(filter-out %.h.gch,$(objs)))
$(foreach lib,$(othersrc)\ $(foreach lib,$(othersrc)\
,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \ ,$(NL)$(TAB)$(call MSG_AR_MERGE,$(target),$(out),$(lib)) \
$(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \ $(NL)$(TAB)$(QUIET)$(RM_EXT) -f $(dir $(outbase))ar.tmp.dir/* \
...@@ -203,7 +239,7 @@ TOOL_GXX_LINK_PROGRAM_OUTPUT = ...@@ -203,7 +239,7 @@ TOOL_GXX_LINK_PROGRAM_OUTPUT =
TOOL_GXX_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) TOOL_GXX_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
TOOL_GXX_LINK_PROGRAM_DEPORD = TOOL_GXX_LINK_PROGRAM_DEPORD =
define TOOL_GXX_LINK_PROGRAM_CMDS define TOOL_GXX_LINK_PROGRAM_CMDS
$(QUIET)$(TOOL_GXX_LD) $(flags) -o $(out) $(objs) \ $(QUIET)$(TOOL_GXX_LD) $(flags) -o $(out) $(filter-out %.h.gch,$(objs)) \
$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
endef endef
...@@ -225,7 +261,7 @@ TOOL_GXX_LINK_DLL_OUTPUT = ...@@ -225,7 +261,7 @@ TOOL_GXX_LINK_DLL_OUTPUT =
TOOL_GXX_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) TOOL_GXX_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
TOOL_GXX_LINK_DLL_DEPORD = TOOL_GXX_LINK_DLL_DEPORD =
define TOOL_GXX_LINK_DLL_CMDS define TOOL_GXX_LINK_DLL_CMDS
$(QUIET)$(TOOL_GXX_LD) $(TOOL_GXX_LDFLAGS.dll) $(flags) -o $(out) $(objs) \ $(QUIET)$(TOOL_GXX_LD) $(TOOL_GXX_LDFLAGS.dll) $(flags) -o $(out) $(filter-out %.h.gch,$(objs)) \
$(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib))) $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
endef endef
# $Id: GXX3.kmk 3121 2017-10-31 10:58:59Z bird $ # $Id: GXX3.kmk 3257 2019-01-03 02:46:05Z bird $
## @file ## @file
# kBuild Tool Config - Generic GCC v3.2.x using the system GCC and Binutils, for building C++ code. # kBuild Tool Config - Generic GCC v3.2.x using the system GCC and Binutils, for building C++ code.
# #
...@@ -36,6 +36,7 @@ TOOL_GXX3 := Generic GCC v3.2.x or later using the system GCC and Binutils, for ...@@ -36,6 +36,7 @@ TOOL_GXX3 := Generic GCC v3.2.x or later using the system GCC and Binutils, for
# Tool Specific Properties # Tool Specific Properties
TOOL_GXX3_CC ?= gcc$(HOSTSUFF_EXE) TOOL_GXX3_CC ?= gcc$(HOSTSUFF_EXE)
TOOL_GXX3_CXX ?= g++$(HOSTSUFF_EXE) TOOL_GXX3_CXX ?= g++$(HOSTSUFF_EXE)
TOOL_GXX3_PCH ?= $(TOOL_GXX3_CXX)
TOOL_GXX3_AS ?= gcc$(HOSTSUFF_EXE) TOOL_GXX3_AS ?= gcc$(HOSTSUFF_EXE)
ifeq ($(KBUILD_TARGET),solaris) ifeq ($(KBUILD_TARGET),solaris)
TOOL_GXX3_AR ?= gar$(HOSTSUFF_EXE) TOOL_GXX3_AR ?= gar$(HOSTSUFF_EXE)
...@@ -72,6 +73,7 @@ endif ...@@ -72,6 +73,7 @@ endif
ifdef SLKRUNS ifdef SLKRUNS
TOOL_GXX3_CC += -fmessage-length=0 TOOL_GXX3_CC += -fmessage-length=0
TOOL_GXX3_CXX += -fmessage-length=0 TOOL_GXX3_CXX += -fmessage-length=0
TOOL_GXX3_PCH += -fmessage-length=0
endif endif
# General Properties used by kBuild # General Properties used by kBuild
...@@ -83,7 +85,6 @@ TOOL_GXX3_CFLAGS.release ?= -O2 ...@@ -83,7 +85,6 @@ TOOL_GXX3_CFLAGS.release ?= -O2
TOOL_GXX3_CINCS ?= TOOL_GXX3_CINCS ?=
TOOL_GXX3_CDEFS ?= TOOL_GXX3_CDEFS ?=
TOOL_GXX3_CXXOBJSUFF ?= .o
TOOL_GXX3_CXXOBJSUFF ?= .o TOOL_GXX3_CXXOBJSUFF ?= .o
TOOL_GXX3_CXXFLAGS ?= TOOL_GXX3_CXXFLAGS ?=
TOOL_GXX3_CXXFLAGS.debug ?= -g TOOL_GXX3_CXXFLAGS.debug ?= -g
...@@ -92,6 +93,14 @@ TOOL_GXX3_CXXFLAGS.release ?= -O2 ...@@ -92,6 +93,14 @@ TOOL_GXX3_CXXFLAGS.release ?= -O2
TOOL_GXX3_CXXINCS ?= TOOL_GXX3_CXXINCS ?=
TOOL_GXX3_CXXDEFS ?= TOOL_GXX3_CXXDEFS ?=
TOOL_GXX3_PCHOBJSUFF ?= .h.gch
TOOL_GXX3_PCHFLAGS ?= $(TOOL_GXX3_CXXFLAGS)
TOOL_GXX3_PCHFLAGS.debug ?= $(TOOL_GXX3_CXXFLAGS.debug)
TOOL_GXX3_PCHFLAGS.profile ?= $(TOOL_GXX3_CXXFLAGS.profile)
TOOL_GXX3_PCHFLAGS.release ?= $(TOOL_GXX3_CXXFLAGS.release)
TOOL_GXX3_PCHINCS ?= $(TOOL_GXX3_CXXINCS)
TOOL_GXX3_PCHDEFS ?= $(TOOL_GXX3_CXXDEFS)
TOOL_GXX3_ASFLAGS ?= -x assembler-with-cpp TOOL_GXX3_ASFLAGS ?= -x assembler-with-cpp
TOOL_GXX3_ASFLAGS.debug ?= -g TOOL_GXX3_ASFLAGS.debug ?= -g
TOOL_GXX3_ASFLAGS.profile ?= -g TOOL_GXX3_ASFLAGS.profile ?= -g
...@@ -120,10 +129,10 @@ TOOL_GXX3_LDFLAGS.profile ?= -g ...@@ -120,10 +129,10 @@ TOOL_GXX3_LDFLAGS.profile ?= -g
# @param $(objsuff) Object suffix. # @param $(objsuff) Object suffix.
TOOL_GXX3_COMPILE_C_DEPEND = TOOL_GXX3_COMPILE_C_DEPEND =
TOOL_GXX3_COMPILE_C_DEPORD = TOOL_GXX3_COMPILE_C_DEPORD =
ifdef KBUILD_USE_KOBJCACHE TOOL_GXX3_COMPILE_C_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).i,)
TOOL_GXX3_COMPILE_C_USES_KOBJCACHE = 1 TOOL_GXX3_COMPILE_C_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
TOOL_GXX3_COMPILE_C_OUTPUT = $(outbase).i
define TOOL_GXX3_COMPILE_C_CMDS define TOOL_GXX3_COMPILE_C_CMDS
if "$(use_objcache)" != ""
$(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
--kObjCache-cpp $(outbase).i\ --kObjCache-cpp $(outbase).i\
$(TOOL_GXX3_CC) -E -o -\ $(TOOL_GXX3_CC) -E -o -\
...@@ -135,63 +144,83 @@ define TOOL_GXX3_COMPILE_C_CMDS ...@@ -135,63 +144,83 @@ define TOOL_GXX3_COMPILE_C_CMDS
$(flags) -fpreprocessed -x c\ $(flags) -fpreprocessed -x c\
-o $(obj)\ -o $(obj)\
- -
$(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" else
endef
else # !KBUILD_USE_KOBJCACHE
TOOL_GXX3_COMPILE_C_OUTPUT =
define TOOL_GXX3_COMPILE_C_CMDS
$(QUIET)$(TOOL_GXX3_CC) -c\ $(QUIET)$(TOOL_GXX3_CC) -c\
$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
-o $(obj)\ -o $(obj)\
$(abspath $(source)) $(abspath $(source))
endif
$(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
endef endef
endif # !KBUILD_USE_KOBJCACHE
## Compile C++ source. ## Compile C++ source.
# @param $(target) Normalized main target name. # @param $(target) Normalized main target name.
# @param $(source) Source filename (relative). # @param $(source) Source filename (relative).
# @param $(obj) Object file name. This shall be (re)created by the compilation. # @param $(obj) Object file name. This shall be (re)created by the compilation.
# @param $(dep) Dependcy file. This shall be (re)created by the compilation. # @param $(dep) Dependcy file. This shall be (re)created by the compilation.
# @param $(flags) Flags. # @param $(flags) Flags.
# @param $(defs) Definitions. No -D or something. # @param $(defs) Definitions. No -D or something.
# @param $(incs) Includes. No -I or something. # @param $(incs) Includes. No -I or something.
# @param $(dirdep) Directory creation dependency. # @param $(dirdep) Directory creation dependency.
# @param $(deps) Other dependencies. # @param $(deps) Other dependencies.
# @param $(outbase) Output basename (full). Use this for list files and such. # @param $(outbase) Output basename (full). Use this for list files and such.
# @param $(objsuff) Object suffix. # @param $(objsuff) Object suffix.
TOOL_GXX3_COMPILE_CXX_DEPEND = TOOL_GXX3_COMPILE_CXX_OUTPUT = $(if-expr "$(use_objcache)" != "",$(outbase).ii,)
TOOL_GXX3_COMPILE_CXX_DEPORD = TOOL_GXX3_COMPILE_CXX_DEPEND = $($(target)_1_GCC_PCH_FILE)
ifdef KBUILD_USE_KOBJCACHE TOOL_GXX3_COMPILE_CXX_DEPORD =
TOOL_GXX3_COMPILE_CXX_USES_KOBJCACHE = 1 TOOL_GXX3_COMPILE_CXX_USES_KOBJCACHE = $(if-expr "$(use_objcache)" != "",1,)
TOOL_GXX3_COMPILE_CXX_OUTPUT = $(outbase).ii
define TOOL_GXX3_COMPILE_CXX_CMDS define TOOL_GXX3_COMPILE_CXX_CMDS
if "$(use_objcache)" != ""
$(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\ $(QUIET)$(KOBJCACHE) -f $(outbase).koc -d $(PATH_OBJCACHE) -t $(bld_trg).$(bld_trg_arch) -p\
--kObjCache-cpp $(outbase).ii\ --kObjCache-cpp $(outbase).ii\
$(TOOL_GXX3_CXX) -E -o -\ $(TOOL_GXX3_CXX) -E -o - $(if-expr defined($(target)_PCH_HDR)\
,-fpch-preprocess -Winvalid-pch -I$($(target)_1_GCC_PCH_DIR) -include $(basename $($(target)_1_GCC_PCH_FILE)),)\
$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
$(abspath $(source))\ $(abspath $(source))\
--kObjCache-cc $(obj)\ --kObjCache-cc $(obj)\
$(TOOL_GXX3_CXX) -c\ $(TOOL_GXX3_CXX) -c\
$(flags) -fpreprocessed -x c++\ $(flags) -fpreprocessed $(if-expr defined($(target)_PCH_HDR),-fpch-preprocess,) -x c++\
-o $(obj)\ -o $(obj)\
- -
else
$(QUIET)$(TOOL_GXX3_CXX) -c\
$(flags) $(addprefix -I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(addprefix -D, $(defs))\
-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
-o $(obj) $(if-expr defined($(target)_PCH_HDR) \
,-Winvalid-pch -include $(basename $($(target)_1_GCC_PCH_FILE)),) \
$(abspath $(source))
endif
$(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
endef endef
else # !KBUILD_USE_KOBJCACHE
TOOL_GXX3_COMPILE_CXX_OUTPUT =
define TOOL_GXX3_COMPILE_CXX_CMDS ## Precompile C++ header.
$(QUIET)$(TOOL_GXX3_CXX) -c\ # @param $(target) Normalized main target name.
$(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\ # @param $(source) Source filename (relative).
# @param $(obj) Object file name. This shall be (re)created by the compilation.
# @param $(dep) Dependcy file. This shall be (re)created by the compilation.
# @param $(flags) Flags.
# @param $(defs) Definitions. No -D or something.
# @param $(incs) Includes. No -I or something.
# @param $(dirdep) Directory creation dependency.
# @param $(deps) Other dependencies.
# @param $(outbase) Output basename (full). Use this for list files and such.
# @param $(objsuff) Object suffix.
TOOL_GXX3_COMPILE_PCH_OUTPUT = $($(target)_1_GCC_PCH_FILE)
TOOL_GXX3_COMPILE_PCH_DEPEND =
TOOL_GXX3_COMPILE_PCH_DEPORD = $($(target)_1_GCC_PCH_DIR)
define TOOL_GXX3_COMPILE_PCH_CMDS
$(QUIET)$(TOOL_GXX3_PCH) -c\
$(flags) $(addprefix -I, $($(target)_1_GCC_PCH_DIR) $(incs)) $(addprefix -D, $(defs))\
-Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\ -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
-o $(obj)\ -o $(obj)\
$(abspath $(source)) $(abspath $(source))
$(INSTALL) --hard-link-files-when-possible -m 0644 -- "$(obj)" "$($(target)_1_GCC_PCH_FILE)"
$(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" "" $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
endef endef
endif # !KBUILD_USE_KOBJCACHE
## Compile Assembly source. ## Compile Assembly source.
...@@ -222,11 +251,11 @@ endef ...@@ -222,11 +251,11 @@ endef