From a2dcfcf9972f8e240e990bf1235a862f3f14e4db Mon Sep 17 00:00:00 2001 From: Hayden Kowalchuk Date: Mon, 9 Dec 2019 12:07:49 -0500 Subject: [PATCH] fix: detect gcc version --- Makefile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index b24acae..ac987bd 100644 --- a/Makefile +++ b/Makefile @@ -14,9 +14,15 @@ OBJS += containers/stack.o containers/named_array.o containers/aligned_vector.o SUBDIRS = EXTRA_CFLAGS= -Wall -Wextra -KOS_CFLAGS += -ffast-math -O2 -funroll-loops -fsingle-precision-constant -Iinclude -funsafe-math-optimizations -DBUILD_LIBGL $(EXTRA_CFLAGS) +GCC5_FLAGS = +GCCVERSIONGTEQ4 := $(shell expr `sh-elf-gcc -dumpversion | cut -f1 -d.` \>= 5) + +ifeq "$(GCCVERSIONGTEQ4)" "1" + GCC5_FLAGS += -mfsca -mfsrra -mlra +endif +KOS_CFLAGS += -ffast-math -O2 -funroll-loops -fsingle-precision-constant -Iinclude -funsafe-math-optimizations -funit-at-a-time -DBUILD_LIBGL $(EXTRA_CFLAGS) $(GCC5_FLAGS) #KOS_CFLAGS += -O1 -mlra -Iinclude -DBUILD_LIBGL -Wall -Wextra -#GCC5_FLAGS = -mfsca -mfsrra -mlra + # Manipulate the CFLAGS to look our *our* version of the library and includes INC_DIR = $(abspath ./include) @@ -24,12 +30,12 @@ LIB_DIR = $(abspath ./) export CFLAGS := $(CFLAGS) -I $(INC_DIR) export OBJEXTRA := $(LIB_DIR)/libGLdc.a -default: build link +default: link -link: +link: build $(KOS_AR) rcs $(TARGET) $(OBJS) -build: $(OBJS) link +build: $(OBJS) samples: build $(KOS_MAKE) -C samples all