Debian Codegraph @

include/makeinclude/platform_g++_common.GNU

raw
1 # -*- Makefile -*-
2
3 ifeq ($(insure),1)
4 CC = insure
5 CXX = insure
6 else
7 ifneq ($(CROSS_COMPILE),)
8 CROSS-COMPILE = 1
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
16 ifneq (,$(HOST_ROOT))
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
23 endif
24 endif
25 endif
26
27 ifneq ($(TCPU),)
28 ifeq ($(tunemodelflag),1)
29 FLAGS_C_CC += -mtune=$(TCPU)
30 endif
31
32 ifeq ($(cpumodelflag),1)
33 FLAGS_C_CC += -mcpu=$(TCPU)
34 endif
35
36 ifeq ($(archmodelflag),1)
37 FLAGS_C_CC += -march=$(TCPU)
38 endif
39 endif
40
41 ifeq ($(gprof),1)
42 FLAGS_C_CC += -pg
43 LDFLAGS += -pg
44 endif
45
46 ifeq ($(no_deprecated),1)
47 CCFLAGS += -Wno-deprecated
48 endif
49
50 ifeq ($(gcov),1)
51 CCFLAGS += --coverage
52 LDFLAGS += --coverage
53 endif
54
55 ifeq ($(CXX),insure)
56 # insure does not pass through the -dumpversion option.
57 CXX_FOR_VERSION_TEST ?= g++
58 else
59 CXX_FOR_VERSION_TEST ?= $(CXX)
60 endif
61
62 ifndef CXX_VERSION
63 CXX_VERSION := $(shell $(CXX_FOR_VERSION_TEST) -dumpversion)
64 endif
65 ifndef CXX_MACHINE
66 CXX_MACHINE := $(shell $(CXX_FOR_VERSION_TEST) -dumpmachine)
67 endif
68 ifndef CXX_FULL_VERSION
69 CXX_FULL_VERSION := $(shell $(CXX_FOR_VERSION_TEST) --version)
70 endif
71
72 CXX_MAJOR_VERSION := $(firstword $(subst ., ,$(CXX_VERSION)))
73 CXX_MINOR_VERSION := $(word 2,$(subst ., ,$(CXX_VERSION)))
74
75 # Minimum C++ level is now C++17, gcc until version 11 have an older version as default
76 ifeq ($(CXX_MAJOR_VERSION),7)
77 c++std ?= c++17
78 endif
79 ifeq ($(CXX_MAJOR_VERSION),8)
80 c++std ?= c++17
81 endif
82 ifeq ($(CXX_MAJOR_VERSION),9)
83 c++std ?= c++17
84 endif
85 ifeq ($(CXX_MAJOR_VERSION),10)
86 c++std ?= c++17
87 endif
88
89 # Only modify LDFLAGS if DLD has been set.
90 ifneq ($(DLD),)
91 ifeq ($(DLD),$(CXX_FOR_VERSION_TEST)) # only try this is we are using ld through gcc
92 LD_FOR_VERSION_TEST = $(shell $(CXX_FOR_VERSION_TEST) -print-prog-name=ld)
93 else
94 LD_FOR_VERSION_TEST = $(DLD)
95 endif # DLD = CXX_FOR_VERSION_TEST
96 # The -E option is GNU ld specific
97 ifneq ($(mingw32),1)
98 GNU_LD := $(shell sh -c '$(LD_FOR_VERSION_TEST) -v 2>&1 | grep -c "GNU ld"')
99 else
100 GNU_LD := $(if $(findstring GNU ld,$(shell $(LD_FOR_VERSION_TEST) -v)), 1, 0)
101 endif # mingw32
102 endif # DLD
103
104 ifeq ($(no-optimize-sibling-calls), 1)
105 FLAGS_C_CC += -fno-optimize-sibling-calls
106 endif
107
108 ifeq ($(no_strict_aliasing), 1)
109 FLAGS_C_CC += -fno-strict-aliasing
110 else
111 ifneq ($(no_strict_aliasing), 0)
112 # if not explicitly disabled enable suppression of strict-aliasing checks by default;
113 # these checks and the resulting warnings are very controversial and
114 # popular opinion on the web seems to be that it brings little practical value and a
115 # lot of pain to attempt to solve code issues and the best way to deal is to suppress
116 FLAGS_C_CC += -fno-strict-aliasing
117 endif
118 endif
119
120 minimaltoc ?= 0
121 ifeq ($(minimaltoc),1)
122 FLAGS_C_CC += -mminimal-toc
123 endif
124
125 address-sanitizer ?= 0
126 ifeq ($(address-sanitizer),1)
127 CPPFLAGS += -fsanitize=address -fno-omit-frame-pointer
128 LDFLAGS += -fsanitize=address
129 endif
130
131 thread-sanitizer ?= 0
132 ifeq ($(thread-sanitizer),1)
133 CPPFLAGS += -fsanitize=thread
134 LDFLAGS += -fsanitize=thread
135 endif
136
137 pipes ?= 1
138
139 # Things GCC has in common with Clang
140 include $(ACE_ROOT)/include/makeinclude/platform_gcc_clang_common.GNU