@@ -37,23 +37,26 @@ AR := ${ar.${TOOLSET}}
3737
3838uname_m := $(shell uname -m)
3939
40- cxxflags.gcc.debug := -Og -fstack-protector-all -fno-omit-frame-pointer # -D_GLIBCXX_DEBUG
41- cxxflags.gcc.release.x86_64 := -march=native -mtune=native
42- cxxflags.gcc.release := -O3 -falign-{functions,loops}=64 -DNDEBUG ${cxxflags.gcc.release.${uname_m}}
40+ cxxflags.gcc.debug := -Og -march=native -fstack-protector-all -fno-omit-frame-pointer # -D_GLIBCXX_DEBUG
41+ cxxflags.gcc.release := -O3 -march=native -mtune=native -falign-{functions,loops}=64 -DNDEBUG
4342cxxflags.gcc.sanitize := ${cxxflags.gcc.release} -fsanitize=thread
4443cxxflags.gcc := -f{no-plt,no-math-errno,finite-math-only,message-length=0} -W{all,extra,error,no-{array-bounds,maybe-uninitialized,unused-variable,unused-function,unused-local-typedefs}} ${cxxflags.gcc.${BUILD}}
4544ldflags.gcc.sanitize := ${ldflags.gcc.release} -fsanitize=thread
4645ldflags.gcc := ${ldflags.gcc.${BUILD}}
4746
48- cxxflags.clang.debug := -O0 -fstack-protector-all
49- cxxflags.clang.release.x86_64 := -march=native -mtune=native
50- cxxflags.clang.release := -O3 -falign-functions=64 -DNDEBUG ${cxxflags.clang.release.${uname_m}}
47+ cxxflags.clang.debug := -O0 -march=native -fstack-protector-all
48+ cxxflags.clang.release := -O3 -march=native -mtune=native -falign-functions=64 -DNDEBUG
5149cxxflags.clang.sanitize := ${cxxflags.clang.release} -fsanitize=thread
5250cxxflags.clang := -stdlib=libstdc++ -f{no-plt,no-math-errno,finite-math-only,message-length=0} -W{all,extra,error,no-{unused-variable,unused-function,unused-local-typedefs}} ${cxxflags.clang.${BUILD}}
5351ldflags.clang.sanitize := ${ldflags.clang.release} -fsanitize=thread
5452ldflags.clang.debug := -latomic # A work-around for clang bug.
5553ldflags.clang := -stdlib=libstdc++ ${ldflags.clang.${BUILD}}
5654
55+ # clang-14 for arm doesn't support -march=native.
56+ ifneq (,$(and $(findstring clang,${CXX}) , $(findstring aarch64,${uname_m}) , $(shell ${CXX} -c -xc++ -march=native -o/dev/null /dev/null 2>&1) ) )
57+ cxxflags.clang := $(filter-out native,${cxxflags.clang})
58+ endif
59+
5760# Additional CPPFLAGS, CXXFLAGS, LDLIBS, LDFLAGS can come from the command line, e.g. make CPPFLAGS='-I<my-include-dir>', or from environment variables.
5861cxxflags := -std=c++14 -pthread -g ${cxxflags.${TOOLSET}} ${CXXFLAGS}
5962cppflags := -Iinclude ${CPPFLAGS}
0 commit comments