aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRDR8 <rdr8@protonmail.com>2017-03-24 03:28:12 -0500
committerRDR8 <rdr8@protonmail.com>2017-03-24 03:28:12 -0500
commite23c120c8b8ea16ffd39c7fe485b884d002b8327 (patch)
treed997d61c33c95775af576f0c0f9b849ee5b9c315 /src
parent9875198a56263b5e282c016c67221ddfcfb51d31 (diff)
downloadraylib-e23c120c8b8ea16ffd39c7fe485b884d002b8327.tar.gz
raylib-e23c120c8b8ea16ffd39c7fe485b884d002b8327.zip
Automate compiler flags selection.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile38
1 files changed, 29 insertions, 9 deletions
diff --git a/src/Makefile b/src/Makefile
index eeb0ce35..80b10c90 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -60,7 +60,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
else
UNAMEOS:=$(shell uname)
ifeq ($(UNAMEOS),Linux)
- PLATFORM_OS=linux
+ PLATFORM_OS=LINUX
else
ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS=OSX
@@ -152,16 +152,36 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID)
endif
# define compiler flags:
-# -O1 defines optimization level
+# -O2 defines optimization level
# -Og enable debugging
# -Wall turns on most, but not all, compiler warnings
# -std=c99 defines C language mode (standard C from 1999 revision)
# -std=gnu99 defines C language mode (GNU C from 1999 revision)
# -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
-# -D_DEFAULT_SOURCE use with -std=c99 on Linux to enable timespec and audio
-#CFLAGS = -O1 -Wall -std=gnu99 -fgnu89-inline -Wno-missing-braces
-CFLAGS = -O1 -Wall -std=c99 -D_DEFAULT_SOURCE
+# -D_DEFAULT_SOURCE use with -std=c99 on Linux to enable timespec and drflac
+ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ ifeq ($(PLATFORM_OS),WINDOWS)
+ CFLAGS = -O1 -Wall -std=gnu99 -fgnu89-inline -Wno-missing-braces
+ endif
+ ifeq ($(PLATFORM_OS),LINUX)
+ CFLAGS = -O1 -Wall -std=c99 -D_DEFAULT_SOURCE
+ endif
+ ifeq ($(PLATFORM_OS),OSX)
+ CFLAGS = -O1 -Wall -std=gnu99 -fgnu89-inline -Wno-missing-braces
+ endif
+endif
+ifeq ($(PLATFORM),PLATFORM_WEB)
+ CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 -s ASSERTIONS=1 --preload-file resources
+ #-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
+ #-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
+endif
+ifeq ($(PLATFORM),PLATFORM_RPI)
+ CFLAGS = -O1 -Wall -std=gnu99 -fgnu89-inline -Wno-missing-braces
+endif
+#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
+
+###########
# if shared library required, make sure code is compiled as position independent
@@ -217,7 +237,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
OUTPUT_PATH = ../release/win32/mingw32
endif
- ifeq ($(PLATFORM_OS),linux)
+ ifeq ($(PLATFORM_OS),LINUX)
OUTPUT_PATH = ../release/linux
endif
ifeq ($(PLATFORM_OS),OSX)
@@ -268,7 +288,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
@echo "libraylib.bc generated (web version)!"
else
ifeq ($(SHARED),YES)
- ifeq ($(PLATFORM_OS),linux)
+ ifeq ($(PLATFORM_OS),LINUX)
# compile raylib to shared library version for GNU/Linux.
# WARNING: you should type "make clean" before doing this target
$(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS)
@@ -337,7 +357,7 @@ utils.o : utils.c utils.h
# TODO: add other platforms.
install :
ifeq ($(ROOT),root)
- ifeq ($(PLATFORM_OS),linux)
+ ifeq ($(PLATFORM_OS),LINUX)
# On GNU/Linux there are some standard directories that contain
# libraries and header files. These directory (/usr/local/lib and
# /usr/local/include/) are for libraries that are installed
@@ -360,7 +380,7 @@ endif
# TODO: see 'install' target.
unistall :
ifeq ($(ROOT),root)
- ifeq ($(PLATFORM_OS),linux)
+ ifeq ($(PLATFORM_OS),LINUX)
rm --force /usr/local/include/raylib.h
ifeq ($(SHARED),YES)
rm --force /usr/local/lib/libraylib.so