diff options
| author | RDR8 <rdr8@protonmail.com> | 2017-03-24 03:28:12 -0500 |
|---|---|---|
| committer | RDR8 <rdr8@protonmail.com> | 2017-03-24 03:28:12 -0500 |
| commit | e23c120c8b8ea16ffd39c7fe485b884d002b8327 (patch) | |
| tree | d997d61c33c95775af576f0c0f9b849ee5b9c315 /examples | |
| parent | 9875198a56263b5e282c016c67221ddfcfb51d31 (diff) | |
| download | raylib-e23c120c8b8ea16ffd39c7fe485b884d002b8327.tar.gz raylib-e23c120c8b8ea16ffd39c7fe485b884d002b8327.zip | |
Automate compiler flags selection.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/Makefile | 46 | ||||
| -rw-r--r-- | examples/audio_standalone.c | 2 |
2 files changed, 26 insertions, 22 deletions
diff --git a/examples/Makefile b/examples/Makefile index e271355d..84a8398b 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -40,7 +40,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) else UNAMEOS:=$(shell uname) ifeq ($(UNAMEOS),Linux) - PLATFORM_OS=linux + PLATFORM_OS=LINUX LIBPATH=linux else ifeq ($(UNAMEOS),Darwin) @@ -66,15 +66,24 @@ endif endif # define compiler flags: -# -O2 defines optimization level -# -s strip unnecessary data from build -# -Wall turns on most, but not all, compiler warnings -# -std=c99 use standard C from 1999 revision -ifeq ($(PLATFORM),PLATFORM_RPI) - CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline -else +# -O2 defines optimization level +# -Og enable debugging +# -s strip unnecessary data from build +# -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 drflac +ifeq ($(PLATFORM),PLATFORM_DESKTOP) + ifeq ($(PLATFORM_OS),WINDOWS) + CFLAGS = -O2 -s -Wall -std=c99 + endif ifeq ($(PLATFORM_OS),LINUX) - CFLAGS = -O2 -s -Wall -std=c99 --D_DEFAULT_SOURCE + CFLAGS = -O2 -s -Wall -std=c99 -D_DEFAULT_SOURCE + endif + ifeq ($(PLATFORM_OS),OSX) + CFLAGS = -O2 -s -Wall -std=c99 endif endif ifeq ($(PLATFORM),PLATFORM_WEB) @@ -82,7 +91,9 @@ ifeq ($(PLATFORM),PLATFORM_WEB) #-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 = -O2 -s -Wall -std=gnu99 -fgnu89-inline +endif #CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes # define raylib release directory for compiled library @@ -90,7 +101,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) RAYLIB_PATH = ../release/win32/mingw32 endif - ifeq ($(PLATFORM_OS),linux) + ifeq ($(PLATFORM_OS),LINUX) RAYLIB_PATH = ../release/linux endif ifeq ($(PLATFORM_OS),OSX) @@ -112,9 +123,7 @@ ifeq ($(PLATFORM),PLATFORM_RPI) endif ifeq ($(PLATFORM),PLATFORM_DESKTOP) # add standard directories for GNU/Linux - ifeq ($(PLATFORM_OS),linux) - INCLUDES += -I/usr/local/include/raylib/ - else ifeq ($(PLATFORM_OS),WINDOWS) + ifeq ($(PLATFORM_OS),WINDOWS) # external libraries headers # GLFW3 INCLUDES += -I../src/external/glfw3/include @@ -143,7 +152,7 @@ endif # define any libraries to link into executable # if you want to link libraries (libname.so or libname.a), use the -lname ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),linux) + ifeq ($(PLATFORM_OS),LINUX) # libraries for Debian GNU/Linux desktop compiling # requires the following packages: # libglfw3-dev libopenal-dev libegl1-mesa-dev @@ -187,11 +196,6 @@ ifeq ($(PLATFORM_OS),WINDOWS) WINFLAGS = ../src/resources -Wl,--subsystem,windows endif -# Linux Fix to timespect from -ifeq ($(PLATFORM_OS),linux) - CFLAGS += -D_DEFAULT_SOURCE - endif - ifeq ($(PLATFORM),PLATFORM_WEB) EXT = .html endif @@ -536,7 +540,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) find . -type f -perm +ugo+x -delete rm -f *.o else - ifeq ($(PLATFORM_OS),linux) + ifeq ($(PLATFORM_OS),LINUX) find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -f else del *.o *.exe diff --git a/examples/audio_standalone.c b/examples/audio_standalone.c index d090bb83..3edf8895 100644 --- a/examples/audio_standalone.c +++ b/examples/audio_standalone.c @@ -29,7 +29,7 @@ #endif #include "audio.h" -#if defined(__linux) +#if defined(__linux__) #include <stdio.h> #include <termios.h> |
