Add change gcc options via Enviroment arguments.

This commit is contained in:
t2-kob 2018-01-12 14:15:12 +09:00
parent 61663da4fd
commit c17e1779ea

View File

@ -58,7 +58,11 @@ GL_LIBS = -lGL -lXext -lX11
CC=gcc
# OPTIMISATION SETTINGS:
# Use gcc option if defined UB_GCC_OPTIONS via "Environment variable" or "Command-line arguments".
ifdef UB_GCC_OPTIONS
OPTON = $(UB_GCC_OPTIONS)
else
## Very generic
#OPTON = -O
@ -85,10 +89,13 @@ OPTON = -O3 -ffast-math
## OS detection. Comment out if gmake syntax not supported by other 'make'.
OSNAME:=$(shell uname -s)
ifeq ($(OSNAME),Linux)
# Not all CPU architectures support "-march" or "-march=native".
# - Supported : x86, x86_64, ARM, AARCH64, etc..
# - Not Supported: RISC-V, IBM Power, etc...
OPTON += -march=native -mtune=native
endif
ifeq ($(OSNAME),Darwin)
# (adjust flags or comment out this section for older versions of XCode or OS X)
# (-mmacosx-versin-min= requires at least that version of SDK be installed)
@ -97,6 +104,8 @@ OPTON += -march=native -mmacosx-version-min=10.10
CFLAGS += -Wa,-q
endif
endif
## generic gcc CFLAGS. -DTIME must be included.
CFLAGS += -Wall -pedantic $(OPTON) -I $(SRCDIR) -DTIME