Copy BUILD_ options available to the compiler flags

This commit is contained in:
Martin Kroeker 2020-09-14 00:03:33 +02:00 committed by GitHub
parent 9e11c2d62f
commit ba644378dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 21 deletions

View File

@ -295,6 +295,7 @@ endif
ifeq ($(C_COMPILER), GCC) ifeq ($(C_COMPILER), GCC)
GCCVERSIONGTEQ4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4) GCCVERSIONGTEQ4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4)
GCCVERSIONGT4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 4) GCCVERSIONGT4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 4)
GCCVERSIONEQ5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` = 5)
GCCVERSIONGT5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 5) GCCVERSIONGT5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 5)
GCCVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 7) GCCVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 7)
GCCVERSIONGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9) GCCVERSIONGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9)
@ -593,35 +594,33 @@ endif
ifeq ($(ARCH), zarch) ifeq ($(ARCH), zarch)
DYNAMIC_CORE = ZARCH_GENERIC DYNAMIC_CORE = ZARCH_GENERIC
# if the compiler accepts -march=arch11 or -march=z13 and can compile a file # Z13 is supported since gcc-5.2, gcc-6, and in RHEL 7.3 and newer
# with z13-specific inline assembly, then we can include support for Z13. ifeq ($(GCCVERSIONGT5), 1)
# note: -march=z13 is equivalent to -march=arch11 yet some compiler releases ZARCH_SUPPORT_Z13 := 1
# only support one or the other. else ifeq ($(GCCVERSIONEQ5), 1)
# note: LLVM version 6.x supported -march=z13 yet could not handle vector ifeq ($(GCCMINORVERSIONGTEQ2), 1)
# registers in inline assembly, so the check for supporting the -march flag is ZARCH_SUPPORT_Z13 := 1
# not enough. endif
ZARCH_TEST_COMPILE=-c $(TOPDIR)/kernel/zarch/damin_z13.c -I$(TOPDIR) -o /dev/null > /dev/null 2> /dev/null endif
ZARCH_CC_SUPPORTS_ARCH11=$(shell $(CC) -march=arch11 $(ZARCH_TEST_COMPILE) && echo 1)
ZARCH_CC_SUPPORTS_Z13=$(shell $(CC) -march=z13 $(ZARCH_TEST_COMPILE) && echo 1)
ifeq ($(or $(ZARCH_CC_SUPPORTS_ARCH11), $(ZARCH_CC_SUPPORTS_Z13)), 1) ifeq ($(wildcard /etc/redhat-release), /etc/redhat-release)
ifeq ($(shell source /etc/os-release ; expr $$VERSION_ID \>= "7.3"), 1)
ZARCH_SUPPORT_Z13 := 1
endif
endif
ifeq ($(ZARCH_SUPPORT_Z13), 1)
DYNAMIC_CORE += Z13 DYNAMIC_CORE += Z13
CCOMMON_OPT += -DDYN_Z13
else else
$(info OpenBLAS: Not building Z13 kernels because the compiler $(CC) does not support it) $(info OpenBLAS: Not building Z13 kernels because gcc is older than 5.2 or 6.x)
endif endif
# as above for z13, check for -march=arch12 and z14 support in the compiler. ifeq ($(GCCVERSIONGTEQ7), 1)
ZARCH_CC_SUPPORTS_ARCH12=$(shell $(CC) -march=arch12 $(ZARCH_TEST_COMPILE) && echo 1)
ZARCH_CC_SUPPORTS_Z14=$(shell $(CC) -march=z14 $(ZARCH_TEST_COMPILE) && echo 1)
ifeq ($(or $(ZARCH_CC_SUPPORTS_ARCH12), $(ZARCH_CC_SUPPORTS_Z14)), 1)
DYNAMIC_CORE += Z14 DYNAMIC_CORE += Z14
CCOMMON_OPT += -DDYN_Z14
else else
$(info OpenBLAS: Not building Z14 kernels because the compiler $(CC) does not support it) $(info OpenBLAS: Not building Z14 kernels because gcc is older than 7.x)
endif
endif endif
endif # ARCH zarch
ifeq ($(ARCH), power) ifeq ($(ARCH), power)
DYNAMIC_CORE = POWER6 DYNAMIC_CORE = POWER6
@ -1223,6 +1222,18 @@ endif
ifeq ($(BUILD_HALF), 1) ifeq ($(BUILD_HALF), 1)
CCOMMON_OPT += -DBUILD_HALF CCOMMON_OPT += -DBUILD_HALF
endif endif
ifeq ($(BUILD_SINGLE), 1)
CCOMMON_OPT += -DBUILD_SINGLE
endif
ifeq ($(BUILD_DOUBLE), 1)
CCOMMON_OPT += -DBUILD_DOUBLE
endif
ifeq ($(BUILD_COMPLEX), 1)
CCOMMON_OPT += -DBUILD_COMPLEX
endif
ifeq ($(BUILD_COMPLEX16), 1)
CCOMMON_OPT += -DBUILD_COMPLEX16
endif
CCOMMON_OPT += -DVERSION=\"$(VERSION)\" CCOMMON_OPT += -DVERSION=\"$(VERSION)\"