7 ifneq ($(CROSS_COMPILE),)
9 # Build using the cross-tools
10 CC = ${CROSS_COMPILE}gcc${CROSS_COMPILE_SUFFIX}
11 CXX = ${CROSS_COMPILE}g++${CROSS_COMPILE_SUFFIX}
12 AR = ${CROSS_COMPILE}ar${CROSS_COMPILE_SUFFIX}
13 # Cross-linker requires this for linked in shared libs that depend
14 # themselves on other shared libs (not directly linked in)
15 LDFLAGS += -Wl,-rpath-link,$(ACE_ROOT)/lib
17 TAO_IDLFLAGS += -g $(HOST_ROOT)/bin/ace_gperf
18 TAO_IDL = $(HOST_ROOT)/bin/tao_idl
19 TAO_IDL_DEP = $(TAO_IDL)
20 # make sure to use the host compiler, not the cross-compiler
21 # as preprocessor for the cross-compiled idl tools
22 TAO_IDL_PREPROCESSOR = gcc
28 ifeq ($(tunemodelflag),1)
29 FLAGS_C_CC += -mtune=$(TCPU)
32 ifeq ($(cpumodelflag),1)
33 FLAGS_C_CC += -mcpu=$(TCPU)
36 ifeq ($(archmodelflag),1)
37 FLAGS_C_CC += -march=$(TCPU)
46 ifeq ($(no_deprecated),1)
47 CCFLAGS += -Wno-deprecated
56 # insure does not pass through the -dumpversion option.
57 CXX_FOR_VERSION_TEST ?= g++
59 CXX_FOR_VERSION_TEST ?= $(CXX)
62 CXX_VERSION := $(shell $(CXX_FOR_VERSION_TEST) -dumpversion)
63 CXX_MACHINE := $(shell $(CXX_FOR_VERSION_TEST) -dumpmachine)
64 ifeq (cmd,$(findstring cmd,$(SHELL)))
65 CXX_MAJOR_VERSION := $(firstword $(subst ., ,$(CXX_VERSION)))
67 CXX_MAJOR_VERSION := $(shell $(CXX_FOR_VERSION_TEST) -dumpversion | sed -e 's/[^0-9\.]//g' | sed -e 's/\..*$$//')
69 ifeq (cmd,$(findstring cmd,$(SHELL)))
70 CXX_MINOR_VERSION := $(word 2,$(subst ., ,$(CXX_VERSION)))
72 CXX_MINOR_VERSION := $(shell $(CXX_FOR_VERSION_TEST) -dumpversion | sed -e 's/[^0-9\.]//g' | sed -e 's/^[0-9]*\.//' | sed -e 's/\..*$$//')
75 CXX_FULL_VERSION := $(shell $(CXX_FOR_VERSION_TEST) --version)
77 # Minimum C++ level is now C++17, gcc until version 11 have an older version as default
78 ifeq ($(CXX_MAJOR_VERSION),7)
81 ifeq ($(CXX_MAJOR_VERSION),8)
84 ifeq ($(CXX_MAJOR_VERSION),9)
87 ifeq ($(CXX_MAJOR_VERSION),10)
91 # Only modify LDFLAGS if DLD has been set.
93 ifeq ($(DLD),$(CXX_FOR_VERSION_TEST)) # only try this is we are using ld through gcc
94 LD_FOR_VERSION_TEST = $(shell $(CXX_FOR_VERSION_TEST) -print-prog-name=ld)
96 LD_FOR_VERSION_TEST = $(DLD)
97 endif # DLD = CXX_FOR_VERSION_TEST
98 # The -E option is GNU ld specific
100 GNU_LD := $(shell sh -c '$(LD_FOR_VERSION_TEST) -v 2>&1 | grep -c "GNU ld"')
102 GNU_LD := $(if $(findstring GNU ld,$(shell $(LD_FOR_VERSION_TEST) -v)), 1, 0)
106 ifeq ($(no-optimize-sibling-calls), 1)
107 FLAGS_C_CC += -fno-optimize-sibling-calls
110 ifeq ($(no_strict_aliasing), 1)
111 FLAGS_C_CC += -fno-strict-aliasing
113 ifneq ($(no_strict_aliasing), 0)
114 # if not explicitly disabled enable suppression of strict-aliasing checks by default
115 # for GCC >= 4.2; these checks and the resulting warnings are very controversial and
116 # popular opinion on the web seems to be that it brings little practical value and a
117 # lot of pain to attempt to solve code issues and the best way to deal is to suppress
118 ifneq ($(findstring $(CXX_MAJOR_VERSION).$(CXX_MINOR_VERSION),4.1),$(CXX_MAJOR_VERSION).$(CXX_MINOR_VERSION))
119 FLAGS_C_CC += -fno-strict-aliasing
125 ifeq ($(minimaltoc),1)
126 FLAGS_C_CC += -mminimal-toc
129 address-sanitizer ?= 0
130 ifeq ($(address-sanitizer),1)
131 CPPFLAGS += -fsanitize=address -fno-omit-frame-pointer
132 LDFLAGS += -fsanitize=address
135 thread-sanitizer ?= 0
136 ifeq ($(thread-sanitizer),1)
137 CPPFLAGS += -fsanitize=thread
138 LDFLAGS += -fsanitize=thread
143 # Things GCC has in common with Clang
144 include $(ACE_ROOT)/include/makeinclude/platform_gcc_clang_common.GNU