Skip to content

Commit ba64437

Browse files
authored
Copy BUILD_ options available to the compiler flags
1 parent 9e11c2d commit ba64437

File tree

1 file changed

+33
-22
lines changed

1 file changed

+33
-22
lines changed

Makefile.system

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ endif
295295
ifeq ($(C_COMPILER), GCC)
296296
GCCVERSIONGTEQ4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4)
297297
GCCVERSIONGT4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 4)
298+
GCCVERSIONEQ5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` = 5)
298299
GCCVERSIONGT5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 5)
299300
GCCVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 7)
300301
GCCVERSIONGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9)
@@ -593,35 +594,33 @@ endif
593594
ifeq ($(ARCH), zarch)
594595
DYNAMIC_CORE = ZARCH_GENERIC
595596

596-
# if the compiler accepts -march=arch11 or -march=z13 and can compile a file
597-
# with z13-specific inline assembly, then we can include support for Z13.
598-
# note: -march=z13 is equivalent to -march=arch11 yet some compiler releases
599-
# only support one or the other.
600-
# note: LLVM version 6.x supported -march=z13 yet could not handle vector
601-
# registers in inline assembly, so the check for supporting the -march flag is
602-
# not enough.
603-
ZARCH_TEST_COMPILE=-c $(TOPDIR)/kernel/zarch/damin_z13.c -I$(TOPDIR) -o /dev/null > /dev/null 2> /dev/null
604-
ZARCH_CC_SUPPORTS_ARCH11=$(shell $(CC) -march=arch11 $(ZARCH_TEST_COMPILE) && echo 1)
605-
ZARCH_CC_SUPPORTS_Z13=$(shell $(CC) -march=z13 $(ZARCH_TEST_COMPILE) && echo 1)
606-
607-
ifeq ($(or $(ZARCH_CC_SUPPORTS_ARCH11), $(ZARCH_CC_SUPPORTS_Z13)), 1)
597+
# Z13 is supported since gcc-5.2, gcc-6, and in RHEL 7.3 and newer
598+
ifeq ($(GCCVERSIONGT5), 1)
599+
ZARCH_SUPPORT_Z13 := 1
600+
else ifeq ($(GCCVERSIONEQ5), 1)
601+
ifeq ($(GCCMINORVERSIONGTEQ2), 1)
602+
ZARCH_SUPPORT_Z13 := 1
603+
endif
604+
endif
605+
606+
ifeq ($(wildcard /etc/redhat-release), /etc/redhat-release)
607+
ifeq ($(shell source /etc/os-release ; expr $$VERSION_ID \>= "7.3"), 1)
608+
ZARCH_SUPPORT_Z13 := 1
609+
endif
610+
endif
611+
612+
ifeq ($(ZARCH_SUPPORT_Z13), 1)
608613
DYNAMIC_CORE += Z13
609-
CCOMMON_OPT += -DDYN_Z13
610614
else
611-
$(info OpenBLAS: Not building Z13 kernels because the compiler $(CC) does not support it)
615+
$(info OpenBLAS: Not building Z13 kernels because gcc is older than 5.2 or 6.x)
612616
endif
613617

614-
# as above for z13, check for -march=arch12 and z14 support in the compiler.
615-
ZARCH_CC_SUPPORTS_ARCH12=$(shell $(CC) -march=arch12 $(ZARCH_TEST_COMPILE) && echo 1)
616-
ZARCH_CC_SUPPORTS_Z14=$(shell $(CC) -march=z14 $(ZARCH_TEST_COMPILE) && echo 1)
617-
ifeq ($(or $(ZARCH_CC_SUPPORTS_ARCH12), $(ZARCH_CC_SUPPORTS_Z14)), 1)
618+
ifeq ($(GCCVERSIONGTEQ7), 1)
618619
DYNAMIC_CORE += Z14
619-
CCOMMON_OPT += -DDYN_Z14
620620
else
621-
$(info OpenBLAS: Not building Z14 kernels because the compiler $(CC) does not support it)
621+
$(info OpenBLAS: Not building Z14 kernels because gcc is older than 7.x)
622+
endif
622623
endif
623-
624-
endif # ARCH zarch
625624

626625
ifeq ($(ARCH), power)
627626
DYNAMIC_CORE = POWER6
@@ -1223,6 +1222,18 @@ endif
12231222
ifeq ($(BUILD_HALF), 1)
12241223
CCOMMON_OPT += -DBUILD_HALF
12251224
endif
1225+
ifeq ($(BUILD_SINGLE), 1)
1226+
CCOMMON_OPT += -DBUILD_SINGLE
1227+
endif
1228+
ifeq ($(BUILD_DOUBLE), 1)
1229+
CCOMMON_OPT += -DBUILD_DOUBLE
1230+
endif
1231+
ifeq ($(BUILD_COMPLEX), 1)
1232+
CCOMMON_OPT += -DBUILD_COMPLEX
1233+
endif
1234+
ifeq ($(BUILD_COMPLEX16), 1)
1235+
CCOMMON_OPT += -DBUILD_COMPLEX16
1236+
endif
12261237

12271238
CCOMMON_OPT += -DVERSION=\"$(VERSION)\"
12281239

0 commit comments

Comments
 (0)