Skip to content

Commit e23d936

Browse files
authored
common.mk: fix flags concatenation order (#876)
Details: - noopt-flags were added after some CROPTFLAGS or CKOPTFLAGS, which may alter expected behavior from user, since compiler only keeps the last occurrence of a flag. Flags should be appended from the most naive one (noopt) to the most advanced (opt) ones. - This commit moves noopt-flags to the first place of all sets.
1 parent 849bfe1 commit e23d936

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

common.mk

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ get-noopt-cxxflags-for = $(strip $(CXXFLAGS_PRESET) \
115115
$(CINCFLAGS) \
116116
)
117117

118-
get-refinit-cflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
119-
$(call get-noopt-cflags-for,$(1)) \
118+
get-refinit-cflags-for = $(strip $(call get-noopt-cflags-for,$(1)) \
119+
$(call load-var-for,COPTFLAGS,$(1)) \
120120
-DBLIS_CNAME=$(1) \
121121
-DBLIS_CNAME_UPPER=$(shell echo $(1) | tr a-z A-Z) \
122122
$(BUILD_ASANFLAGS) \
@@ -126,8 +126,8 @@ get-refinit-cflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
126126
-include $(CONFIG_PATH)/$(1)/bli_kernel_defs_$(1).h \
127127
)
128128

129-
get-refinit-cxxflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
130-
$(call get-noopt-cxxflags-for,$(1)) \
129+
get-refinit-cxxflags-for = $(strip $(call get-noopt-cxxflags-for,$(1)) \
130+
$(call load-var-for,COPTFLAGS,$(1)) \
131131
-DBLIS_CNAME=$(1) \
132132
-DBLIS_CNAME_UPPER=$(shell echo $(1) | tr a-z A-Z) \
133133
$(BUILD_ASANFLAGS) \
@@ -137,9 +137,9 @@ get-refinit-cxxflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
137137
-include $(CONFIG_PATH)/$(1)/bli_kernel_defs_$(1).h \
138138
)
139139

140-
get-refkern-cflags-for = $(strip $(call load-var-for,CROPTFLAGS,$(1)) \
140+
get-refkern-cflags-for = $(strip $(call get-noopt-cflags-for,$(1)) \
141+
$(call load-var-for,CROPTFLAGS,$(1)) \
141142
$(call load-var-for,CRVECFLAGS,$(1)) \
142-
$(call get-noopt-cflags-for,$(1)) \
143143
$(COMPSIMDFLAGS) \
144144
-DBLIS_CNAME=$(1) \
145145
-DBLIS_CNAME_UPPER=$(shell echo $(1) | tr a-z A-Z) \
@@ -150,9 +150,9 @@ get-refkern-cflags-for = $(strip $(call load-var-for,CROPTFLAGS,$(1)) \
150150
-include $(CONFIG_PATH)/$(1)/bli_kernel_defs_$(1).h \
151151
)
152152

153-
get-refkern-cxxflags-for = $(strip $(call load-var-for,CROPTFLAGS,$(1)) \
153+
get-refkern-cxxflags-for = $(strip $(call get-noopt-cxxflags-for,$(1)) \
154+
$(call load-var-for,CROPTFLAGS,$(1)) \
154155
$(call load-var-for,CRVECFLAGS,$(1)) \
155-
$(call get-noopt-cxxflags-for,$(1)) \
156156
$(COMPSIMDFLAGS) \
157157
-DBLIS_CNAME=$(1) \
158158
-DBLIS_CNAME_UPPER=$(shell echo $(1) | tr a-z A-Z) \
@@ -163,50 +163,50 @@ get-refkern-cxxflags-for = $(strip $(call load-var-for,CROPTFLAGS,$(1)) \
163163
-include $(CONFIG_PATH)/$(1)/bli_kernel_defs_$(1).h \
164164
)
165165

166-
get-config-cflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
167-
$(call get-noopt-cflags-for,$(1)) \
166+
get-config-cflags-for = $(strip $(call get-noopt-cflags-for,$(1)) \
167+
$(call load-var-for,COPTFLAGS,$(1)) \
168168
-DBLIS_CNAME=$(1) \
169169
-DBLIS_CNAME_UPPER=$(shell echo $(1) | tr a-z A-Z) \
170170
$(BUILD_ASANFLAGS) \
171171
$(BUILD_CPPFLAGS) \
172172
$(BUILD_SYMFLAGS) \
173173
)
174174

175-
get-config-cxxflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
176-
$(call get-noopt-cxxflags-for,$(1)) \
175+
get-config-cxxflags-for = $(strip $(call get-noopt-cxxflags-for,$(1)) \
176+
$(call load-var-for,COPTFLAGS,$(1)) \
177177
-DBLIS_CNAME=$(1) \
178178
-DBLIS_CNAME_UPPER=$(shell echo $(1) | tr a-z A-Z) \
179179
$(BUILD_ASANFLAGS) \
180180
$(BUILD_CPPFLAGS) \
181181
$(BUILD_SYMFLAGS) \
182182
)
183183

184-
get-frame-cflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
185-
$(call get-noopt-cflags-for,$(1)) \
184+
get-frame-cflags-for = $(strip $(call get-noopt-cflags-for,$(1)) \
185+
$(call load-var-for,COPTFLAGS,$(1)) \
186186
$(BUILD_ASANFLAGS) \
187187
$(BUILD_CPPFLAGS) \
188188
$(BUILD_SYMFLAGS) \
189189
)
190190

191-
get-frame-cxxflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
192-
$(call get-noopt-cxxflags-for,$(1)) \
191+
get-frame-cxxflags-for = $(strip $(call get-noopt-cxxflags-for,$(1)) \
192+
$(call load-var-for,COPTFLAGS,$(1)) \
193193
$(BUILD_ASANFLAGS) \
194194
$(BUILD_CPPFLAGS) \
195195
$(BUILD_SYMFLAGS) \
196196
)
197197

198-
get-kernel-cflags-for = $(strip $(call load-var-for,CKOPTFLAGS,$(1)) \
198+
get-kernel-cflags-for = $(strip $(call get-noopt-cflags-for,$(1)) \
199+
$(call load-var-for,CKOPTFLAGS,$(1)) \
199200
$(call load-var-for,CKVECFLAGS,$(1)) \
200-
$(call get-noopt-cflags-for,$(1)) \
201201
-DBLIS_CNAME=$(1) \
202202
-DBLIS_CNAME_UPPER=$(shell echo $(1) | tr a-z A-Z) \
203203
$(BUILD_CPPFLAGS) \
204204
$(BUILD_SYMFLAGS) \
205205
)
206206

207-
get-kernel-cxxflags-for = $(strip $(call load-var-for,CKOPTFLAGS,$(1)) \
207+
get-kernel-cxxflags-for = $(strip $(call get-noopt-cxxflags-for,$(1)) \
208+
$(call load-var-for,CKOPTFLAGS,$(1)) \
208209
$(call load-var-for,CKVECFLAGS,$(1)) \
209-
$(call get-noopt-cxxflags-for,$(1)) \
210210
-DBLIS_CNAME=$(1) \
211211
-DBLIS_CNAME_UPPER=$(shell echo $(1) | tr a-z A-Z) \
212212
$(BUILD_CPPFLAGS) \
@@ -216,23 +216,23 @@ get-kernel-cxxflags-for = $(strip $(call load-var-for,CKOPTFLAGS,$(1)) \
216216
# When compiling addons, we use flags similar to those of general framework
217217
# source. This ensures that the same code can be linked and run across various
218218
# sub-configurations.
219-
get-addon-c99flags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
220-
$(call get-noopt-cflags-for,$(1)) \
219+
get-addon-c99flags-for = $(strip $(call get-noopt-cflags-for,$(1)) \
220+
$(call load-var-for,COPTFLAGS,$(1)) \
221221
$(CADDONINCFLAGS) \
222222
$(BUILD_CPPFLAGS) \
223223
$(BUILD_SYMFLAGS) \
224224
)
225-
get-addon-cxxflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
226-
$(call get-noopt-cxxflags-for,$(1)) \
225+
get-addon-cxxflags-for = $(strip $(call get-noopt-cxxflags-for,$(1)) \
226+
$(call load-var-for,COPTFLAGS,$(1)) \
227227
$(CADDONINCFLAGS) \
228228
$(BUILD_CPPFLAGS) \
229229
$(BUILD_SYMFLAGS) \
230230
)
231231
# When compiling addon kernels, we use flags similar to those of kernels
232232
# flags, except we also include the addon header paths.
233-
get-addon-kernel-c99flags-for = $(strip $(call load-var-for,CKOPTFLAGS,$(1)) \
233+
get-addon-kernel-c99flags-for = $(strip $(call get-noopt-cflags-for,$(1)) \
234+
$(call load-var-for,CKOPTFLAGS,$(1)) \
234235
$(call load-var-for,CKVECFLAGS,$(1)) \
235-
$(call get-noopt-cflags-for,$(1)) \
236236
$(CADDONINCFLAGS) \
237237
$(BUILD_CPPFLAGS) \
238238
$(BUILD_SYMFLAGS) \
@@ -244,14 +244,14 @@ get-addon-kernel-c99flags-for = $(strip $(call load-var-for,CKOPTFLAGS,$(1)) \
244244
# flags, we should prevent enabling sandboxes for umbrella families by verifying
245245
# that config_list == config_name if --enable-sandbox is given. THIS ALSO
246246
# APPLIES TO ADDONS ABOVE.)
247-
get-sandbox-c99flags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
248-
$(call get-noopt-cflags-for,$(1)) \
247+
get-sandbox-c99flags-for = $(strip $(call get-noopt-cflags-for,$(1)) \
248+
$(call load-var-for,COPTFLAGS,$(1)) \
249249
$(CSANDINCFLAGS) \
250250
$(BUILD_CPPFLAGS) \
251251
$(BUILD_SYMFLAGS) \
252252
)
253-
get-sandbox-cxxflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
254-
$(call get-noopt-cxxflags-for,$(1)) \
253+
get-sandbox-cxxflags-for = $(strip $(call get-noopt-cxxflags-for,$(1)) \
254+
$(call load-var-for,COPTFLAGS,$(1)) \
255255
$(CSANDINCFLAGS) \
256256
$(BUILD_CPPFLAGS) \
257257
$(BUILD_SYMFLAGS) \
@@ -268,8 +268,8 @@ get-sandbox-cxxflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
268268
# needed when a shared library is being compiled/linked; and
269269
# - BUILD_ASANFLAGS, which contains a flag that causes the compiler to
270270
# insert instrumentation for memory error detection.
271-
get-user-cflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
272-
$(call get-noopt-cflags-for,$(1)) \
271+
get-user-cflags-for = $(strip $(call get-noopt-cflags-for,$(1)) \
272+
$(call load-var-for,COPTFLAGS,$(1)) \
273273
)
274274

275275
# Define functions that return messages appropriate for each non-verbose line

0 commit comments

Comments
 (0)