From ab05ace3ce8b999ab665194e63b8b5d03a7787ac Mon Sep 17 00:00:00 2001 From: ratalaika Date: Sat, 22 Nov 2014 00:13:09 +0100 Subject: Added first version of OS X compilation support --- examples/makefile | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'examples/makefile') diff --git a/examples/makefile b/examples/makefile index 076c9594..f4453213 100644 --- a/examples/makefile +++ b/examples/makefile @@ -24,8 +24,8 @@ #************************************************************************************************** # define raylib platform (by default, compile for RPI) -# Other possible platforms: PLATFORM_DESKTOP PLATFORM_DESKTOP_LINUX -PLATFORM ?= PLATFORM_RPI +# Other possible platforms: PLATFORM_DESKTOP PLATFORM_DESKTOP_LINUX PLATFORM_DESKTOP_OSX +PLATFORM ?= PLATFORM_DESKTOP_OSX # define compiler: gcc for C program, define as g++ for C++ CC = gcc @@ -55,6 +55,14 @@ else LFLAGS = -L. -L../src -L/opt/vc/lib endif +# define library paths containing required libs +ifeq ($(PLATFORM),PLATFORM_DESKTOP_OSX) + LFLAGS = -L. -L../src -L../external/glfw3/lib/ -I../external/openal_soft/lib/ +else + LFLAGS = -L. -L../src +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_RPI) @@ -67,12 +75,19 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP_LINUX) # requires the following packages: # libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev LIBS = -lraylib -lglfw -lGLEW -lGL -lopenal +else +ifeq ($(PLATFORM),PLATFORM_DESKTOP_OSX) + # libraries for OS X 10.9 desktop compiling + # requires the following packages: + # libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev + LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa else # libraries for Windows desktop compiling # NOTE: GLFW3 and OpenAL Soft libraries should be installed LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32 endif endif +endif # define additional parameters and flags for windows ifeq ($(PLATFORM),PLATFORM_DESKTOP) @@ -253,9 +268,13 @@ else ifeq ($(PLATFORM),PLATFORM_DESKTOP_LINUX) find . -type f -executable -delete rm -f *.o +else +ifeq ($(PLATFORM),PLATFORM_DESKTOP_OSX) + rm -f *.o else del *.o *.exe endif +endif endif @echo Cleaning done -- cgit v1.2.3 From 7ea8326b52f596d16fe059d34ce6673c4b401f90 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Fri, 2 Jan 2015 20:59:05 +0100 Subject: makefiles reorganization Edited to better accomodate to multiple platforms --- examples/makefile | 97 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 45 deletions(-) (limited to 'examples/makefile') diff --git a/examples/makefile b/examples/makefile index d2656888..4771d94d 100644 --- a/examples/makefile +++ b/examples/makefile @@ -26,6 +26,23 @@ # WARNING: To compile examples to HTML5, they must be redesigned to use emscripten.h and emscripten_set_main_loop() PLATFORM ?= PLATFORM_DESKTOP +# determine SUBPLATFORM in case PLATFORM_DESKTOP selected +ifeq ($(PLATFORM),PLATFORM_DESKTOP) + # No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows + ifeq ($(OS),Windows_NT) + SUBPLATFORM=WINDOWS + else + UNAMEOS = $(shell uname -s) + ifeq ($(UNAMEOS),Linux) + SUBPLATFORM=LINUX + else + ifeq ($(UNAMEOS),Darwin) + SUBPLATFORM=OSX + endif + endif + endif +endif + # define compiler: gcc for C program, define as g++ for C++ ifeq ($(PLATFORM),PLATFORM_WEB) # define emscripten compiler @@ -44,14 +61,14 @@ ifeq ($(PLATFORM),PLATFORM_RPI) else CFLAGS = -O2 -Wall -std=c99 endif -#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes - 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 +#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes + # define any directories containing required header files ifeq ($(PLATFORM),PLATFORM_RPI) INCLUDES = -I. -I../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads @@ -63,45 +80,37 @@ endif ifeq ($(PLATFORM),PLATFORM_RPI) LFLAGS = -L. -L../src -L/opt/vc/lib else - LFLAGS = -L. -L../src -endif - -# define library paths containing required libs -ifeq ($(PLATFORM),PLATFORM_DESKTOP_OSX) - LFLAGS = -L. -L../src -L../external/glfw3/lib/ -I../external/openal_soft/lib/ -else - LFLAGS = -L. -L../src + LFLAGS = -L. -L../src -L../external/glfw3/lib/ -I../external/openal_soft/lib/ 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 ($(SUBPLATFORM),LINUX) + # libraries for Debian GNU/Linux desktop compiling + # requires the following packages: + # libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev + LIBS = -lraylib -lglfw -lGLEW -lGL -lopenal + endif + ifeq ($(SUBPLATFORM),OSX) + # libraries for OS X 10.9 desktop compiling + # requires the following packages: + # libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev + LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa + + else + # libraries for Windows desktop compiling + # NOTE: GLFW3 and OpenAL Soft libraries should be installed + LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32 + endif +endif ifeq ($(PLATFORM),PLATFORM_RPI) # libraries for Raspberry Pi compiling # NOTE: OpenAL Soft library should be installed (libopenal1 package) LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal -else -ifeq ($(PLATFORM),PLATFORM_DESKTOP_LINUX) - # libraries for Debian GNU/Linux desktop compiling - # requires the following packages: - # libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev - LIBS = -lraylib -lglfw -lGLEW -lGL -lopenal -else -ifeq ($(PLATFORM),PLATFORM_DESKTOP_OSX) - # libraries for OS X 10.9 desktop compiling - # requires the following packages: - # libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev - LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa -else +endif ifeq ($(PLATFORM),PLATFORM_WEB) LIBS = ../src/libraylib.bc -else - # libraries for Windows desktop compiling - # NOTE: GLFW3 and OpenAL Soft libraries should be installed - LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32 -endif -endif -endif endif # define additional parameters and flags for windows @@ -280,24 +289,22 @@ audio_music_stream: audio_music_stream.c # clean everything clean: +ifeq ($(PLATFORM),PLATFORM_DESKTOP) + ifeq ($(SUBPLATFORM),LINUX) + find . -type f -executable -delete + rm -f *.o + endif + ifeq ($(SUBPLATFORM),OSX) + rm -f *.o + else + del *.o *.exe + endif +endif ifeq ($(PLATFORM),PLATFORM_RPI) rm -f *.o -# find . -executable -delete -else -ifeq ($(PLATFORM),PLATFORM_DESKTOP_LINUX) - find . -type f -executable -delete - rm -f *.o -else -ifeq ($(PLATFORM),PLATFORM_DESKTOP_OSX) - rm -f *.o -else +endif ifeq ($(PLATFORM),PLATFORM_WEB) del *.o *.html *.js -else - del *.o *.exe -endif -endif -endif endif @echo Cleaning done -- cgit v1.2.3 From 4a7e522d4bb376d2277895d1d99eb0382f8bbefb Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 4 Jan 2015 18:05:50 +0100 Subject: Review build system for Android and RPI --- examples/makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'examples/makefile') diff --git a/examples/makefile b/examples/makefile index 4771d94d..9763b233 100644 --- a/examples/makefile +++ b/examples/makefile @@ -32,7 +32,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(OS),Windows_NT) SUBPLATFORM=WINDOWS else - UNAMEOS = $(shell uname -s) + UNAMEOS:=$(shell uname) ifeq ($(UNAMEOS),Linux) SUBPLATFORM=LINUX else @@ -290,17 +290,19 @@ audio_music_stream: audio_music_stream.c # clean everything clean: ifeq ($(PLATFORM),PLATFORM_DESKTOP) + ifeq ($(SUBPLATFORM),OSX) + rm -f *.o + else ifeq ($(SUBPLATFORM),LINUX) find . -type f -executable -delete rm -f *.o - endif - ifeq ($(SUBPLATFORM),OSX) - rm -f *.o else del *.o *.exe endif + endif endif ifeq ($(PLATFORM),PLATFORM_RPI) + find . -type f -executable -delete rm -f *.o endif ifeq ($(PLATFORM),PLATFORM_WEB) -- cgit v1.2.3