@@ -53,6 +53,8 @@ COMPILER = scan-build
5353override CC := $(CC ) clang
5454endif
5555
56+ READELF ?= readelf
57+
5658#
5759# check for ALT linux gcc, define HAVE_ALT_LINUX_GCC, see core-shim.c
5860# https://github.com/ColinIanKing/stress-ng/issues/452
@@ -157,9 +159,17 @@ endif
157159#
158160# Test for hardening flags and apply them if applicable
159161#
160- MACHINE := $(shell make -f Makefile.machine)
162+ ARCH := $(shell if objdump -H > /dev/null 2>&1 ; then \
163+ $(CC ) test/test-machine.c -o test-machine > /dev/null 2>&1 && \
164+ $(READELF ) -h ./test-machine | grep Machine | tr '[:upper:]' '[:lower:]' | awk '{ print $$NF }' | sed 's/\///g' || echo "unknown"; \
165+ rm -f test-machine; \
166+ else echo "unknown"; fi)
167+
168+ all :
169+ @echo $(CFLAGS )
170+
161171ifneq ($(PRESERVE_CFLAGS ) ,1)
162- ifneq ($(MACHINE ) ,$(filter $(MACHINE ) ,alpha hppa ia64) )
172+ ifneq ($(ARCH ) ,$(filter $(ARCH ) ,alpha hppa ia64) )
163173flag = -Wformat -fstack-protector-strong -Werror=format-security
164174#
165175# add -D_FORTIFY_SOURCE=2 if _FORTIFY_SOURCE is not already defined
@@ -178,7 +188,7 @@ ifeq ($(BUILD_SMALL),1)
178188ifneq ($(filter-out clang icc scan-build,$(COMPILER ) ) ,)
179189override CFLAGS += $(foreach flag,-fipa-pta -fivopts,$(cc_supports_flag ) )
180190override CFLAGS += $(foreach flag,-ftree-vectorize -ftree-slp-vectorize,$(cc_supports_flag ) )
181- ifeq ($(filter $(MACHINE ) ,ibms390 s390) ,)
191+ ifeq ($(filter $(ARCH ) , s390) ,)
182192override CFLAGS += $(foreach flag,-fmodulo-sched,$(cc_supports_flag ) )
183193endif
184194endif
@@ -897,6 +907,7 @@ cov: cov_clean clean build_info config.h
897907
898908build_info :
899909 $(PRE_Q ) echo " Compiler: $( COMPILER) "
910+ $(PRE_Q ) echo " Arch: $( ARCH) "
900911 $(PRE_Q ) echo " CFLAGS: $( CFLAGS) "
901912 $(PRE_Q ) echo " LDFLAGS: $( LDFLAGS) "
902913
@@ -1016,7 +1027,7 @@ git-commit-id.h:
10161027 echo " #define STRESS_GIT_COMMIT_ID \"\" " > $@ ; \
10171028 fi
10181029
1019- $(OBJS ) : stress-ng.h Makefile Makefile.config Makefile.machine
1030+ $(OBJS ) : stress-ng.h Makefile Makefile.config
10201031
10211032stress-ng.1.gz : stress-ng.1
10221033 $(PRE_V ) gzip -n -c $< > $@
@@ -1025,7 +1036,7 @@ stress-ng.1.gz: stress-ng.1
10251036dist :
10261037 rm -rf stress-ng-$(VERSION )
10271038 mkdir stress-ng-$(VERSION )
1028- cp -rp Makefile Makefile.config Makefile.machine $(CORE_SRC ) \
1039+ cp -rp Makefile Makefile.config $(CORE_SRC ) \
10291040 $(STRESS_SRC ) $(HEADERS ) stress-ng.1 COPYING syscalls.txt \
10301041 mascot README.md CITATIONS.md \
10311042 Dockerfile README.Android test \
0 commit comments