From 4a8644e999698189ffaf68f01398c092a76a6828 Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 23 Sep 2017 18:40:30 +0200 Subject: Update Android libs and building --- src/Makefile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 06b67a04..72f37b09 100644 --- a/src/Makefile +++ b/src/Makefile @@ -97,14 +97,9 @@ ifeq ($(PLATFORM),PLATFORM_WEB) endif ifeq ($(PLATFORM),PLATFORM_ANDROID) - # Android NDK path - # NOTE: Required for standalone toolchain generation - ANDROID_NDK = $(ANDROID_NDK_HOME) - - # Android standalone toolchain path - # NOTE: This path is also used if toolchain generation - #ANDROID_TOOLCHAIN = $(CURDIR)/toolchain - ANDROID_TOOLCHAIN = $(RAYLIB_PATH)/android-toolchain + # Android required path variables + ANDROID_NDK = C:/android-ndk + ANDROID_TOOLCHAIN = C:/android_toolchain_arm_api16 # Android architecture: ARM or ARM64 ANDROID_ARCH ?= ARM @@ -217,6 +212,10 @@ ifeq ($(PLATFORM),PLATFORM_WEB) # -s USE_PTHREADS=1 # multithreading support endif +ifeq ($(PLATFORM),PLATFORM_ANDROID) + CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 +endif + #CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes # if shared library required, make sure code is compiled as position independent -- cgit v1.2.3 From ccd6271a7f036e72e3192efcee4350e225f353ab Mon Sep 17 00:00:00 2001 From: Ray San Date: Fri, 29 Sep 2017 13:57:00 +0200 Subject: Added some compiler flags for Android --- src/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 72f37b09..af36d0ec 100644 --- a/src/Makefile +++ b/src/Makefile @@ -213,7 +213,14 @@ ifeq ($(PLATFORM),PLATFORM_WEB) endif ifeq ($(PLATFORM),PLATFORM_ANDROID) + # Compiler flags for arquitecture CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 + # Compilation functions attributes options + CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC + # Compiler options for the linker + CFLAGS += -Wa,--noexecstack -Wformat -Werror=format-security -no-canonical-prefixes + # Preprocessor macro definitions + CFLAGS += -DANDROID -DPLATFORM_ANDROID -D__ANDROID_API__=16 endif #CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes -- cgit v1.2.3 From 1c7416910efb4255c16b279683ea729bfb196070 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 29 Sep 2017 23:44:31 +0200 Subject: Default to OpenAL static lib --- src/Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index af36d0ec..6f456beb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -58,9 +58,6 @@ SHARED_OPENAL ?= NO ifeq ($(PLATFORM),PLATFORM_WEB) SHARED_OPENAL = YES endif -ifeq ($(PLATFORM),PLATFORM_ANDROID) - SHARED_OPENAL = YES -endif # determine if the file has root access (only for installing raylib) # "whoami" prints the name of the user that calls him (so, if it is the root @@ -201,7 +198,7 @@ endif # -fgnu89-inline declaring inline functions support (GCC optimized) # -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -D_DEFAULT_SOURCE use with -std=c99 -CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces +CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces ifeq ($(PLATFORM),PLATFORM_WEB) CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 --profiling --preload-file resources -- cgit v1.2.3 From b2789949ee93028e5780e45fcc503db67fdcf6ef Mon Sep 17 00:00:00 2001 From: Ray San Date: Mon, 2 Oct 2017 14:12:03 +0200 Subject: Working on Makefiles... --- src/Makefile | 170 +++++++++++++++++++++++++++-------------------------------- 1 file changed, 77 insertions(+), 93 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 6f456beb..e9383c54 100644 --- a/src/Makefile +++ b/src/Makefile @@ -44,19 +44,16 @@ # possible platforms: PLATFORM_DESKTOP PLATFORM_ANDROID PLATFORM_RPI PLATFORM_WEB PLATFORM ?= PLATFORM_DESKTOP -# define raylib default path, required to look for emsdk and android-toolchain -RAYLIB_PATH ?= C:/raylib +# define raylib library type: STATIC (.a) or SHARED (.so/.dll) +RAYLIB_LIBTYPE ?= STATIC -# define YES if you want shared/dynamic version of library instead of static (default) -SHARED_RAYLIB ?= NO - -# use OpenAL Soft as shared library (.so / .dll) -# NOTE: If defined NO, static OpenAL Soft library should be provided -SHARED_OPENAL ?= NO +# define OpenAL Soft library type: STATIC (.a) or SHARED (.so/.dll) +# NOTE: OpenAL Soft library should be provided in the selected form +OPENAL_LIBTYPE ?= STATIC # on PLATFORM_WEB force OpenAL Soft shared library ifeq ($(PLATFORM),PLATFORM_WEB) - SHARED_OPENAL = YES + OPENAL_LIBTYPE = SHARED endif # determine if the file has root access (only for installing raylib) @@ -82,9 +79,14 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) endif endif +ifeq ($(PLATFORM),PLATFORM_RPI) + # RPI cross-compiler + RPI_CROSS_COMPILE ?= NO +endif + ifeq ($(PLATFORM),PLATFORM_WEB) # Emscripten required variables - EMSDK_PATH = $(RAYLIB_PATH)/emsdk + EMSDK_PATH = C:/emsdk EMSCRIPTEN_VERSION = 1.37.9 CLANG_VERSION=e1.37.9_64bit PYTHON_VERSION=2.7.5.3_64bit @@ -100,15 +102,6 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) # Android architecture: ARM or ARM64 ANDROID_ARCH ?= ARM - - # Android compiler: gcc or clang - # NOTE: Define YES to use clang instead of gcc - ANDROID_LLVM ?= NO -endif - -ifeq ($(PLATFORM),PLATFORM_RPI) - # RPI cross-compiler - CROSS_COMPILE ?= NO endif # define raylib graphics api depending on selected platform @@ -118,14 +111,17 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) #GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1 #GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1 endif + ifeq ($(PLATFORM),PLATFORM_RPI) # on RPI OpenGL ES 2.0 must be used GRAPHICS = GRAPHICS_API_OPENGL_ES2 endif + ifeq ($(PLATFORM),PLATFORM_WEB) # on HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0 GRAPHICS = GRAPHICS_API_OPENGL_ES2 endif + ifeq ($(PLATFORM),PLATFORM_ANDROID) # by default use OpenGL ES 2.0 on Android GRAPHICS = GRAPHICS_API_OPENGL_ES2 @@ -134,52 +130,41 @@ endif # NOTE: makefiles targets require tab indentation # NOTE: define compiler: gcc for C program, define as g++ for C++ -# default gcc compiler +# default C compiler: gcc CC = gcc - -# For OS X ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),OSX) - CC = clang + # OSX default compiler + CC = clang endif endif - -# Android toolchain compiler -ifeq ($(PLATFORM),PLATFORM_ANDROID) - ifeq ($(ANDROID_ARCH),ARM) - ifeq ($(ANDROID_LLVM),YES) - CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-clang - else - CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-gcc - endif - endif - ifeq ($(ANDROID_ARCH),ARM64) - ifeq ($(ANDROID_LLVM),YES) - CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-clang - else - CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-gcc - endif - endif -endif - -# RPI cross-compiler ifeq ($(PLATFORM),PLATFORM_RPI) - ifeq ($(CROSS_COMPILE),YES) - # rpi compiler + ifeq ($(RPI_CROSS_COMPILE),YES) + # RPI cross-compiler CC = armv6j-hardfloat-linux-gnueabi-gcc endif endif - -# HTML5 emscripten compiler ifeq ($(PLATFORM),PLATFORM_WEB) + # HTML5 emscripten compiler CC = emcc endif +ifeq ($(PLATFORM),PLATFORM_ANDROID) + # Android toolchain (must be provided for desired architecture and compiler) + # NOTE: gcc compiler is being deprecated at Android NDK r16 + ifeq ($(ANDROID_ARCH),ARM) + CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-clang + endif + ifeq ($(ANDROID_ARCH),ARM64) + CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-clang + endif +endif + # default archiver program to pack libraries AR = ar -# Android archiver +# Android archiver (also depends on desired architecture) ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(ANDROID_ARCH),ARM) AR = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-ar @@ -192,6 +177,7 @@ endif # define compiler flags: # -O1 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) @@ -200,15 +186,16 @@ endif # -D_DEFAULT_SOURCE use with -std=c99 CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces +# additional flags for compiler (if desired) +#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes ifeq ($(PLATFORM),PLATFORM_WEB) - CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 --profiling --preload-file resources # -O2 # if used, also set --memory-init-file 0 # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s USE_PTHREADS=1 # multithreading support + CFLAGS += -s USE_GLFW=3 -s ASSERTIONS=1 --profiling endif - ifeq ($(PLATFORM),PLATFORM_ANDROID) # Compiler flags for arquitecture CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 @@ -220,54 +207,51 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) CFLAGS += -DANDROID -DPLATFORM_ANDROID -D__ANDROID_API__=16 endif -#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes - -# if shared library required, make sure code is compiled as position independent -ifeq ($(SHARED_RAYLIB),YES) - CFLAGS += -fPIC - SHAREDFLAG = BUILDING_DLL -else - SHAREDFLAG = BUILDING_STATIC +# define raylib libtype required compilation flags +ifeq ($(RAYLIB_LIBTYPE),SHARED) + # make sure code is compiled as position independent + # BE CAREFUL: It seems that for gcc -fpic si not the same as -fPIC + # MinGW32 just doesn't need -fPIC, it shows warnings + CFLAGS += -fPIC -DBUILD_LIBTYPE_SHARED endif # if static OpenAL Soft required, define the corresponding flags -ifeq ($(SHARED_OPENAL),NO) - SHAREDLIBS += -lopenal32 -lwinmm - SHAREDOPENALFLAG = AL_LIBTYPE_STATIC +# NOTE: ALLIBS flag only required for raylib Win32 SHARED library building +ifeq ($(OPENAL_LIBTYPE),STATIC) + ALLIBS = -lopenal32 -lwinmm + ALFLAGS = AL_LIBTYPE_STATIC else - SHAREDLIBS += -lopenal32dll - SHAREDOPENALFLAG = SHARED_OPENAL + ALLIBS = -lopenal32dll endif -#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes - +# define include paths for required headers # external required libraries (stb and others) -INCLUDES = -I. -Iexternal +INCLUDE_PATHS = -I. -Iexternal # OpenAL Soft library -INCLUDES += -Iexternal/openal_soft/include +INCLUDE_PATHS += -Iexternal/openal_soft/include # define any directories containing required header files ifeq ($(PLATFORM),PLATFORM_DESKTOP) # GLFW3 library - INCLUDES += -Iexternal/glfw3/include + INCLUDE_PATHS += -Iexternal/glfw3/include endif ifeq ($(PLATFORM),PLATFORM_RPI) # RPI requried libraries - INCLUDES += -I/opt/vc/include - INCLUDES += -I/opt/vc/include/interface/vmcs_host/linux - INCLUDES += -I/opt/vc/include/interface/vcos/pthreads + INCLUDE_PATHS += -I/opt/vc/include + INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux + INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads endif ifeq ($(PLATFORM),PLATFORM_WEB) # GLFW3 library - INCLUDES += -Iexternal/glfw3/include + INCLUDE_PATHS += -Iexternal/glfw3/include endif ifeq ($(PLATFORM),PLATFORM_ANDROID) # Android required libraries - INCLUDES += -I$(ANDROID_TOOLCHAIN)/sysroot/usr/include + INCLUDE_PATHS += -I$(ANDROID_TOOLCHAIN)/sysroot/usr/include # Include android_native_app_glue.h - INCLUDES += -Iexternal/android/native_app_glue - #INCLUDES += -I$(ANDROID_NDK)/sources/android/native_app_glue + INCLUDE_PATHS += -Iexternal/android/native_app_glue + #INCLUDE_PATHS += -I$(ANDROID_NDK)/sources/android/native_app_glue endif # define output directory for compiled library @@ -301,7 +285,7 @@ endif # The wildcard takes all files that finish with ".c", then it replaces the # extentions with ".o", that are the object files. OBJS = $(patsubst %.c, %.o, $(wildcard *.c)) -OBJS += external/stb_vorbis.o +OBJS += stb_vorbis.o # typing 'make' will invoke the default target entry called 'all', # in this case, the 'default' target entry is raylib @@ -324,12 +308,12 @@ raylib: $(OBJS) ifeq ($(PLATFORM),PLATFORM_WEB) # compile raylib for web. emcc -O1 $(OBJS) -o $(OUTPUT_PATH)/libraylib.bc - @echo "libraylib.bc generated (web version)!" + @echo "raylib library generated (libraylib.bc)!" else - ifeq ($(SHARED_RAYLIB),YES) + ifeq ($(RAYLIB_LIBTYPE),SHARED) # NOTE: If using OpenAL Soft as static library, all its dependencies must be also linked in the shared library ifeq ($(PLATFORM_OS),WINDOWS) - $(CC) -shared -o $(OUTPUT_PATH)/raylib.dll $(OBJS) $(SHAREDLIBS) -Lexternal/glfw3/lib/win32 -Lexternal/openal_soft/lib/win32 -lglfw3 -lgdi32 -Wl,--out-implib,$(OUTPUT_PATH)/libraylibdll.a + $(CC) -shared -o $(OUTPUT_PATH)/raylib.dll $(OBJS) $(ALLIBS) -Lexternal/glfw3/lib/win32 -Lexternal/openal_soft/lib/win32 -lglfw3 -lgdi32 -Wl,--out-implib,$(OUTPUT_PATH)/libraylibdll.a @echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!" endif ifeq ($(PLATFORM_OS),LINUX) @@ -351,7 +335,7 @@ else # compile raylib static library. $(AR) rcs $(OUTPUT_PATH)/libraylib.a $(OBJS) @echo "raylib static library generated (libraylib.a)!" - ifeq ($(SHARED_OPENAL),NO) + ifeq ($(OPENAL_LIBTYPE),STATIC) @echo "expected OpenAL Soft static library linking" else @echo "expected OpenAL Soft shared library linking" @@ -363,39 +347,39 @@ endif # compile core module core.o : core.c raylib.h rlgl.h utils.h raymath.h gestures.h - $(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(SHAREDFLAG) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) # compile rlgl module rlgl.o : rlgl.c rlgl.h raymath.h - $(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(GRAPHICS) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) # compile shapes module shapes.o : shapes.c raylib.h rlgl.h - $(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(SHAREDFLAG) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) # compile textures module textures.o : textures.c rlgl.h utils.h - $(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS) -D$(SHAREDFLAG) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) # compile text module text.o : text.c raylib.h utils.h - $(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(SHAREDFLAG) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) # compile models module models.o : models.c raylib.h rlgl.h raymath.h - $(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(SHAREDFLAG) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) # compile audio module audio.o : audio.c raylib.h - $(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(SHAREDFLAG) -D$(SHAREDOPENALFLAG) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(ALFLAGS) # compile stb_vorbis library external/stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h - $(CC) -c -o $@ $< -O1 $(CFLAGS) $(INCLUDES) -D$(PLATFORM) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) # compile utils module utils.o : utils.c utils.h - $(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(SHAREDFLAG) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) # It installs generated and needed files to compile projects using raylib. # The installation works manually. @@ -407,7 +391,7 @@ ifeq ($(ROOT),root) # libraries and header files. These directory (/usr/local/lib and # /usr/local/include/) are for libraries that are installed # manually (without a package manager). - ifeq ($(SHARED_RAYLIB),YES) + ifeq ($(RAYLIB_LIBTYPE),SHARED) cp --update $(OUTPUT_PATH)/libraylib.so /usr/local/lib/libraylib.so else cp --update raylib.h /usr/local/include/raylib.h @@ -427,14 +411,14 @@ uninstall : ifeq ($(ROOT),root) ifeq ($(PLATFORM_OS),LINUX) rm --force /usr/local/include/raylib.h - ifeq ($(SHARED_RAYLIB),YES) + ifeq ($(RAYLIB_LIBTYPE),SHARED) rm --force /usr/local/lib/libraylib.so else rm --force /usr/local/lib/libraylib.a endif - @echo "raylib dev files removed!" + @echo "raylib development files removed!" else - @echo "This function works only on GNU/Linux systems" + @echo "This function works only on GNU/Linux systems" endif else @echo "Error: no root permissions" -- cgit v1.2.3 From ca0ff820462639b48f30f3be93d9260946071307 Mon Sep 17 00:00:00 2001 From: Ray San Date: Tue, 3 Oct 2017 15:02:32 +0200 Subject: Keep working on Makefiles... --- src/Makefile | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index e9383c54..117cbe5a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -45,11 +45,11 @@ PLATFORM ?= PLATFORM_DESKTOP # define raylib library type: STATIC (.a) or SHARED (.so/.dll) -RAYLIB_LIBTYPE ?= STATIC +RAYLIB_LIBTYPE ?= SHARED # define OpenAL Soft library type: STATIC (.a) or SHARED (.so/.dll) # NOTE: OpenAL Soft library should be provided in the selected form -OPENAL_LIBTYPE ?= STATIC +OPENAL_LIBTYPE ?= SHARED # on PLATFORM_WEB force OpenAL Soft shared library ifeq ($(PLATFORM),PLATFORM_WEB) @@ -153,10 +153,10 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) # Android toolchain (must be provided for desired architecture and compiler) # NOTE: gcc compiler is being deprecated at Android NDK r16 ifeq ($(ANDROID_ARCH),ARM) - CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-clang + CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-gcc endif ifeq ($(ANDROID_ARCH),ARM64) - CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-clang + CC = $(ANDROID_TOOLCHAIN)/bin/aarch64-linux-android-gcc endif endif @@ -184,7 +184,7 @@ endif # -fgnu89-inline declaring inline functions support (GCC optimized) # -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -D_DEFAULT_SOURCE use with -std=c99 -CFLAGS += -O1 -s -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces +CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces # additional flags for compiler (if desired) #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes @@ -219,7 +219,7 @@ endif # NOTE: ALLIBS flag only required for raylib Win32 SHARED library building ifeq ($(OPENAL_LIBTYPE),STATIC) ALLIBS = -lopenal32 -lwinmm - ALFLAGS = AL_LIBTYPE_STATIC + ALFLAGS = -DAL_LIBTYPE_STATIC else ALLIBS = -lopenal32dll endif @@ -254,6 +254,18 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) #INCLUDE_PATHS += -I$(ANDROID_NDK)/sources/android/native_app_glue endif +# Linker options +ifeq ($(PLATFORM),PLATFORM_ANDROID) + LDFLAGS = -Wl,-soname,libraylib.so -Wl,--exclude-libs,libatomic.a + LDFLAGS += -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings + # Force linking of library module to define symbol + LDFLAGS += -u ANativeActivity_onCreate + # Library paths containing required libs + LDFLAGS += -L. -Lsrc -L$(OUTPUT_PATH) + + LDLIBS = -lopenal -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm +endif + # define output directory for compiled library ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) @@ -328,7 +340,7 @@ else @echo "raylib shared library generated (libraylib.dylib)!" endif ifeq ($(PLATFORM),PLATFORM_ANDROID) - $(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS) + $(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS) $(LDFLAGS) $(LDLIBS) @echo "raylib shared library generated (libraylib.so)!" endif else @@ -371,10 +383,10 @@ models.o : models.c raylib.h rlgl.h raymath.h # compile audio module audio.o : audio.c raylib.h - $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(ALFLAGS) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) $(ALFLAGS) # compile stb_vorbis library -external/stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h +stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) # compile utils module -- cgit v1.2.3 From 9000fc28a3286f0af189a4e25f5e6e13568cab4d Mon Sep 17 00:00:00 2001 From: Ray San Date: Wed, 4 Oct 2017 12:51:53 +0200 Subject: Keep working on Android shared libs... --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 117cbe5a..405f9194 100644 --- a/src/Makefile +++ b/src/Makefile @@ -261,7 +261,7 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) # Force linking of library module to define symbol LDFLAGS += -u ANativeActivity_onCreate # Library paths containing required libs - LDFLAGS += -L. -Lsrc -L$(OUTPUT_PATH) + LDFLAGS += -L. -Lsrc -L$(OUTPUT_PATH) -Lexternal/openal_soft/lib/android LDLIBS = -lopenal -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm endif -- cgit v1.2.3 From 7114c1b1f3bf7da755a70b7f0b0ca813dd5f4d18 Mon Sep 17 00:00:00 2001 From: Ray San Date: Wed, 11 Oct 2017 13:28:38 +0200 Subject: Updated compilation output paths --- src/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 405f9194..f577ebae 100644 --- a/src/Makefile +++ b/src/Makefile @@ -269,27 +269,27 @@ endif # define output directory for compiled library ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) - OUTPUT_PATH = ../release/win32/mingw32 + OUTPUT_PATH = ../release/libs/win32/mingw32 endif ifeq ($(PLATFORM_OS),LINUX) - OUTPUT_PATH = ../release/linux + OUTPUT_PATH = ../release/libs/linux endif ifeq ($(PLATFORM_OS),OSX) - OUTPUT_PATH = ../release/osx + OUTPUT_PATH = ../release/libs/osx endif endif ifeq ($(PLATFORM),PLATFORM_RPI) - OUTPUT_PATH = ../release/rpi + OUTPUT_PATH = ../release/libs/rpi endif ifeq ($(PLATFORM),PLATFORM_WEB) - OUTPUT_PATH = ../release/html5 + OUTPUT_PATH = ../release/libs/html5 endif ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(ANDROID_ARCH),ARM) - OUTPUT_PATH = ../release/android/armeabi-v7a + OUTPUT_PATH = ../release/libs/android/armeabi-v7a endif ifeq ($(ANDROID_ARCH),ARM64) - OUTPUT_PATH = ../release/android/arm64-v8a + OUTPUT_PATH = ../release/libs/android/arm64-v8a endif endif -- cgit v1.2.3 From 5430d5d52e61ce5cd7e02d99b5d98f8fc56ddb28 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 14 Oct 2017 00:13:23 +0200 Subject: Review Makefiles --- src/Makefile | 203 ++++++++++++++++++++++++++--------------------------------- 1 file changed, 88 insertions(+), 115 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index f577ebae..2545fd59 100644 --- a/src/Makefile +++ b/src/Makefile @@ -40,35 +40,33 @@ .PHONY: all clean install uninstall -# define raylib platform to compile for -# possible platforms: PLATFORM_DESKTOP PLATFORM_ANDROID PLATFORM_RPI PLATFORM_WEB +# Define required raylib variables PLATFORM ?= PLATFORM_DESKTOP +RAYLIB_PATH ?= .. -# define raylib library type: STATIC (.a) or SHARED (.so/.dll) -RAYLIB_LIBTYPE ?= SHARED - -# define OpenAL Soft library type: STATIC (.a) or SHARED (.so/.dll) +# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # NOTE: OpenAL Soft library should be provided in the selected form -OPENAL_LIBTYPE ?= SHARED +RAYLIB_LIBTYPE ?= STATIC +OPENAL_LIBTYPE ?= STATIC -# on PLATFORM_WEB force OpenAL Soft shared library +# On PLATFORM_WEB force OpenAL Soft shared library ifeq ($(PLATFORM),PLATFORM_WEB) OPENAL_LIBTYPE = SHARED endif -# determine if the file has root access (only for installing raylib) +# Determine if the file has root access (only for installing raylib) # "whoami" prints the name of the user that calls him (so, if it is the root # user, "whoami" prints "root"). ROOT = $(shell whoami) -# determine PLATFORM_OS in case PLATFORM_DESKTOP selected +# Determine PLATFORM_OS 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) PLATFORM_OS=WINDOWS else - UNAMEOS:=$(shell uname) + UNAMEOS=$(shell uname) ifeq ($(UNAMEOS),Linux) PLATFORM_OS=LINUX else @@ -95,6 +93,33 @@ ifeq ($(PLATFORM),PLATFORM_WEB) EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION) endif +# Define output directory for compiled library +ifeq ($(PLATFORM),PLATFORM_DESKTOP) + ifeq ($(PLATFORM_OS),WINDOWS) + RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/win32/mingw32 + endif + ifeq ($(PLATFORM_OS),LINUX) + RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/linux + endif + ifeq ($(PLATFORM_OS),OSX) + RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx + endif +endif +ifeq ($(PLATFORM),PLATFORM_RPI) + RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/rpi +endif +ifeq ($(PLATFORM),PLATFORM_WEB) + RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/html5 +endif +ifeq ($(PLATFORM),PLATFORM_ANDROID) + ifeq ($(ANDROID_ARCH),ARM) + RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/android/armeabi-v7a + endif + ifeq ($(ANDROID_ARCH),ARM64) + RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/android/arm64-v8a + endif +endif + ifeq ($(PLATFORM),PLATFORM_ANDROID) # Android required path variables ANDROID_NDK = C:/android-ndk @@ -104,33 +129,31 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) ANDROID_ARCH ?= ARM endif -# define raylib graphics api depending on selected platform +# Define raylib graphics api depending on selected platform ifeq ($(PLATFORM),PLATFORM_DESKTOP) - # by default use OpenGL 3.3 on desktop platforms + # By default use OpenGL 3.3 on desktop platforms GRAPHICS ?= GRAPHICS_API_OPENGL_33 #GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1 #GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1 endif ifeq ($(PLATFORM),PLATFORM_RPI) - # on RPI OpenGL ES 2.0 must be used + # On RPI OpenGL ES 2.0 must be used GRAPHICS = GRAPHICS_API_OPENGL_ES2 endif ifeq ($(PLATFORM),PLATFORM_WEB) - # on HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0 + # On HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0 GRAPHICS = GRAPHICS_API_OPENGL_ES2 endif ifeq ($(PLATFORM),PLATFORM_ANDROID) - # by default use OpenGL ES 2.0 on Android + # By default use OpenGL ES 2.0 on Android GRAPHICS = GRAPHICS_API_OPENGL_ES2 endif -# NOTE: makefiles targets require tab indentation -# NOTE: define compiler: gcc for C program, define as g++ for C++ - -# default C compiler: gcc +# Default C compiler: gcc +# NOTE: define g++ compiler if using C++ CC = gcc ifeq ($(PLATFORM),PLATFORM_DESKTOP) @@ -151,7 +174,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB) endif ifeq ($(PLATFORM),PLATFORM_ANDROID) # Android toolchain (must be provided for desired architecture and compiler) - # NOTE: gcc compiler is being deprecated at Android NDK r16 + # NOTE: gcc compiler is being deprecated in Android NDK r16 ifeq ($(ANDROID_ARCH),ARM) CC = $(ANDROID_TOOLCHAIN)/bin/arm-linux-androideabi-gcc endif @@ -160,8 +183,7 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) endif endif - -# default archiver program to pack libraries +# Default archiver program to pack libraries AR = ar # Android archiver (also depends on desired architecture) @@ -174,7 +196,7 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) endif endif -# define compiler flags: +# Define compiler flags: # -O1 defines optimization level # -Og enable debugging # -s strip unnecessary data from build @@ -186,7 +208,7 @@ endif # -D_DEFAULT_SOURCE use with -std=c99 CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -# additional flags for compiler (if desired) +# Additional flags for compiler (if desired) #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes ifeq ($(PLATFORM),PLATFORM_WEB) # -O2 # if used, also set --memory-init-file 0 @@ -207,7 +229,7 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) CFLAGS += -DANDROID -DPLATFORM_ANDROID -D__ANDROID_API__=16 endif -# define raylib libtype required compilation flags +# Define required compilation flags for raylib SHARED lib ifeq ($(RAYLIB_LIBTYPE),SHARED) # make sure code is compiled as position independent # BE CAREFUL: It seems that for gcc -fpic si not the same as -fPIC @@ -215,37 +237,17 @@ ifeq ($(RAYLIB_LIBTYPE),SHARED) CFLAGS += -fPIC -DBUILD_LIBTYPE_SHARED endif -# if static OpenAL Soft required, define the corresponding flags -# NOTE: ALLIBS flag only required for raylib Win32 SHARED library building -ifeq ($(OPENAL_LIBTYPE),STATIC) - ALLIBS = -lopenal32 -lwinmm - ALFLAGS = -DAL_LIBTYPE_STATIC -else - ALLIBS = -lopenal32dll -endif - -# define include paths for required headers -# external required libraries (stb and others) -INCLUDE_PATHS = -I. -Iexternal +# Define include paths for required headers +# NOTE: Several external required libraries (stb and others) +INCLUDE_PATHS = -I. -Iexternal -Iexternal/include -# OpenAL Soft library -INCLUDE_PATHS += -Iexternal/openal_soft/include - -# define any directories containing required header files -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - # GLFW3 library - INCLUDE_PATHS += -Iexternal/glfw3/include -endif +# Define additional directories containing required header files ifeq ($(PLATFORM),PLATFORM_RPI) # RPI requried libraries INCLUDE_PATHS += -I/opt/vc/include INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads endif -ifeq ($(PLATFORM),PLATFORM_WEB) - # GLFW3 library - INCLUDE_PATHS += -Iexternal/glfw3/include -endif ifeq ($(PLATFORM),PLATFORM_ANDROID) # Android required libraries INCLUDE_PATHS += -I$(ANDROID_TOOLCHAIN)/sysroot/usr/include @@ -254,58 +256,30 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) #INCLUDE_PATHS += -I$(ANDROID_NDK)/sources/android/native_app_glue endif -# Linker options +# Define linker options ifeq ($(PLATFORM),PLATFORM_ANDROID) LDFLAGS = -Wl,-soname,libraylib.so -Wl,--exclude-libs,libatomic.a LDFLAGS += -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings # Force linking of library module to define symbol LDFLAGS += -u ANativeActivity_onCreate # Library paths containing required libs - LDFLAGS += -L. -Lsrc -L$(OUTPUT_PATH) -Lexternal/openal_soft/lib/android + LDFLAGS += -L. -Lsrc -L$(RAYLIB_RELEASE_PATH) -Lexternal/openal_soft/lib/android LDLIBS = -lopenal -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm endif -# define output directory for compiled library -ifeq ($(PLATFORM),PLATFORM_DESKTOP) - ifeq ($(PLATFORM_OS),WINDOWS) - OUTPUT_PATH = ../release/libs/win32/mingw32 - endif - ifeq ($(PLATFORM_OS),LINUX) - OUTPUT_PATH = ../release/libs/linux - endif - ifeq ($(PLATFORM_OS),OSX) - OUTPUT_PATH = ../release/libs/osx - endif -endif -ifeq ($(PLATFORM),PLATFORM_RPI) - OUTPUT_PATH = ../release/libs/rpi -endif -ifeq ($(PLATFORM),PLATFORM_WEB) - OUTPUT_PATH = ../release/libs/html5 -endif -ifeq ($(PLATFORM),PLATFORM_ANDROID) - ifeq ($(ANDROID_ARCH),ARM) - OUTPUT_PATH = ../release/libs/android/armeabi-v7a - endif - ifeq ($(ANDROID_ARCH),ARM64) - OUTPUT_PATH = ../release/libs/android/arm64-v8a - endif -endif - -# define all object files required with a wildcard -# The wildcard takes all files that finish with ".c", then it replaces the -# extentions with ".o", that are the object files. +# Define all object files required with a wildcard +# The wildcard takes all files that finish with ".c", +# and replaces extentions with ".o", that are the object files OBJS = $(patsubst %.c, %.o, $(wildcard *.c)) OBJS += stb_vorbis.o -# typing 'make' will invoke the default target entry called 'all', -# in this case, the 'default' target entry is raylib +# Default target entry all: raylib -# generate standalone Android toolchain +# Generate standalone Android toolchain # NOTE: Android toolchain could already be provided -toolchain: +generate_android_toolchain: ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(ANDROID_ARCH),ARM) $(ANDROID_NDK)/build/tools/make-standalone-toolchain.sh --platform=android-9 --toolchain=arm-linux-androideabi-4.9 --use-llvm --install-dir=$(ANDROID_TOOLCHAIN) @@ -315,37 +289,37 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) endif endif -# compile raylib library +# Compile raylib library raylib: $(OBJS) ifeq ($(PLATFORM),PLATFORM_WEB) - # compile raylib for web. - emcc -O1 $(OBJS) -o $(OUTPUT_PATH)/libraylib.bc + # Compile raylib for web. + emcc -O1 $(OBJS) -o $(RAYLIB_RELEASE_PATH)/libraylib.bc @echo "raylib library generated (libraylib.bc)!" else ifeq ($(RAYLIB_LIBTYPE),SHARED) # NOTE: If using OpenAL Soft as static library, all its dependencies must be also linked in the shared library ifeq ($(PLATFORM_OS),WINDOWS) - $(CC) -shared -o $(OUTPUT_PATH)/raylib.dll $(OBJS) $(ALLIBS) -Lexternal/glfw3/lib/win32 -Lexternal/openal_soft/lib/win32 -lglfw3 -lgdi32 -Wl,--out-implib,$(OUTPUT_PATH)/libraylibdll.a + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) $(ALLIBS) -Lexternal/glfw3/lib/win32 -Lexternal/openal_soft/lib/win32 -lglfw3 -lgdi32 -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylibdll.a @echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!" endif ifeq ($(PLATFORM_OS),LINUX) - # compile raylib to shared library version for GNU/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) -lglfw -lGL -lopenal -lm -lpthread -ldl + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lglfw -lGL -lopenal -lm -lpthread -ldl @echo "raylib shared library generated (libraylib.so)!" endif ifeq ($(PLATFORM_OS),OSX) - $(CC) -dynamiclib -o $(OUTPUT_PATH)/libraylib.dylib $(OBJS) -L/usr/local/Cellar/glfw/3.2.1/lib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa - install_name_tool -id "libraylib.dylib" $(OUTPUT_PATH)/libraylib.dylib + $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.dylib $(OBJS) -L/usr/local/Cellar/glfw/3.2.1/lib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa + install_name_tool -id "libraylib.dylib" $(RAYLIB_RELEASE_PATH)/libraylib.dylib @echo "raylib shared library generated (libraylib.dylib)!" endif ifeq ($(PLATFORM),PLATFORM_ANDROID) - $(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS) $(LDFLAGS) $(LDLIBS) + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) $(LDFLAGS) $(LDLIBS) @echo "raylib shared library generated (libraylib.so)!" endif else - # compile raylib static library. - $(AR) rcs $(OUTPUT_PATH)/libraylib.a $(OBJS) + # Compile raylib static library. + $(AR) rcs $(RAYLIB_RELEASE_PATH)/libraylib.a $(OBJS) @echo "raylib static library generated (libraylib.a)!" ifeq ($(OPENAL_LIBTYPE),STATIC) @echo "expected OpenAL Soft static library linking" @@ -355,46 +329,45 @@ else endif endif -# compile all modules with their prerequisites +# Compile all modules with their prerequisites -# compile core module +# Compile core module core.o : core.c raylib.h rlgl.h utils.h raymath.h gestures.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) -# compile rlgl module +# Compile rlgl module rlgl.o : rlgl.c rlgl.h raymath.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) -# compile shapes module +# Compile shapes module shapes.o : shapes.c raylib.h rlgl.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) -# compile textures module +# Compile textures module textures.o : textures.c rlgl.h utils.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) -# compile text module +# Compile text module text.o : text.c raylib.h utils.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) -# compile models module +# Compile models module models.o : models.c raylib.h rlgl.h raymath.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) -# compile audio module +# Compile audio module audio.o : audio.c raylib.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) $(ALFLAGS) -# compile stb_vorbis library +# Compile stb_vorbis library stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -# compile utils module +# Compile utils module utils.o : utils.c utils.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -# It installs generated and needed files to compile projects using raylib. -# The installation works manually. +# Install generated and needed files to required directories # TODO: add other platforms. install : ifeq ($(ROOT),root) @@ -404,10 +377,10 @@ ifeq ($(ROOT),root) # /usr/local/include/) are for libraries that are installed # manually (without a package manager). ifeq ($(RAYLIB_LIBTYPE),SHARED) - cp --update $(OUTPUT_PATH)/libraylib.so /usr/local/lib/libraylib.so + cp --update $(RAYLIB_RELEASE_PATH)/libraylib.so /usr/local/lib/libraylib.so else cp --update raylib.h /usr/local/include/raylib.h - cp --update $(OUTPUT_PATH)/libraylib.a /usr/local/lib/libraylib.a + cp --update $(RAYLIB_RELEASE_PATH)/libraylib.a /usr/local/lib/libraylib.a endif @echo "raylib dev files installed/updated!" else @@ -417,7 +390,7 @@ else @echo "Error: no root permissions" endif -# it removes raylib dev files installed on the system. +# Remove raylib dev files installed on the system # TODO: see 'install' target. uninstall : ifeq ($(ROOT),root) @@ -436,12 +409,12 @@ else @echo "Error: no root permissions" endif -# clean everything +# Clean everything clean: ifeq ($(PLATFORM_OS),WINDOWS) - del *.o $(OUTPUT_PATH)/libraylib.a $(OUTPUT_PATH)/libraylib.bc $(OUTPUT_PATH)/libraylib.so external/stb_vorbis.o + del *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so external/stb_vorbis.o else - rm -f *.o $(OUTPUT_PATH)/libraylib.a $(OUTPUT_PATH)/libraylib.bc $(OUTPUT_PATH)/libraylib.so external/stb_vorbis.o + rm -f *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so external/stb_vorbis.o endif ifeq ($(PLATFORM),PLATFORM_ANDROID) rm -rf $(ANDROID_TOOLCHAIN) -- cgit v1.2.3 From 4909f9711c327db22166adfa6e1cf60007847d56 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 14 Oct 2017 12:25:36 +0200 Subject: Small tweak, remove tabs --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 2545fd59..95b739c2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -160,7 +160,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),OSX) # OSX default compiler CC = clang - endif + endif endif ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(RPI_CROSS_COMPILE),YES) -- cgit v1.2.3 From a6ccc14d390c0289474e923c6cc2ed8efde0e1de Mon Sep 17 00:00:00 2001 From: Ray San Date: Mon, 16 Oct 2017 13:37:10 +0200 Subject: Corrected issue with OpenAL Soft static --- src/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 95b739c2..3a903cb6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -237,6 +237,11 @@ ifeq ($(RAYLIB_LIBTYPE),SHARED) CFLAGS += -fPIC -DBUILD_LIBTYPE_SHARED endif +# Define required compilation flags for OpenAL Soft STATIC lib +ifeq ($(OPENAL_LIBTYPE),STATIC) + ALFLAGS = -DAL_LIBTYPE_STATIC -Wl,-allow-multiple-definition +endif + # Define include paths for required headers # NOTE: Several external required libraries (stb and others) INCLUDE_PATHS = -I. -Iexternal -Iexternal/include @@ -263,7 +268,7 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) # Force linking of library module to define symbol LDFLAGS += -u ANativeActivity_onCreate # Library paths containing required libs - LDFLAGS += -L. -Lsrc -L$(RAYLIB_RELEASE_PATH) -Lexternal/openal_soft/lib/android + LDFLAGS += -L. -Lsrc -L$(RAYLIB_RELEASE_PATH) LDLIBS = -lopenal -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm endif -- cgit v1.2.3 From df67e799ddab275006bc264b9672d83d2e7ed5a4 Mon Sep 17 00:00:00 2001 From: Ray San Date: Fri, 20 Oct 2017 17:14:58 +0200 Subject: Updated release versions for raylib 1.8 --- src/Makefile | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 3a903cb6..1da4557d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -46,7 +46,7 @@ RAYLIB_PATH ?= .. # Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # NOTE: OpenAL Soft library should be provided in the selected form -RAYLIB_LIBTYPE ?= STATIC +RAYLIB_LIBTYPE ?= SHARED OPENAL_LIBTYPE ?= STATIC # On PLATFORM_WEB force OpenAL Soft shared library @@ -85,14 +85,25 @@ endif ifeq ($(PLATFORM),PLATFORM_WEB) # Emscripten required variables EMSDK_PATH = C:/emsdk - EMSCRIPTEN_VERSION = 1.37.9 - CLANG_VERSION=e1.37.9_64bit + EMSCRIPTEN_VERSION = 1.37.21 + CLANG_VERSION=e1.37.21_64bit PYTHON_VERSION=2.7.5.3_64bit NODE_VERSION=4.1.1_64bit export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH) EMSCRIPTEN=$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION) endif +ifeq ($(PLATFORM),PLATFORM_ANDROID) + # Android required path variables + ANDROID_NDK = C:/android-ndk + ANDROID_TOOLCHAIN = C:/android_toolchain_arm_api16 + + # Android architecture: ARM or ARM64 + ANDROID_ARCH ?= ARM +endif + +RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/release/libs + # Define output directory for compiled library ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) @@ -120,15 +131,6 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) endif endif -ifeq ($(PLATFORM),PLATFORM_ANDROID) - # Android required path variables - ANDROID_NDK = C:/android-ndk - ANDROID_TOOLCHAIN = C:/android_toolchain_arm_api16 - - # Android architecture: ARM or ARM64 - ANDROID_ARCH ?= ARM -endif - # Define raylib graphics api depending on selected platform ifeq ($(PLATFORM),PLATFORM_DESKTOP) # By default use OpenGL 3.3 on desktop platforms @@ -304,8 +306,9 @@ else ifeq ($(RAYLIB_LIBTYPE),SHARED) # NOTE: If using OpenAL Soft as static library, all its dependencies must be also linked in the shared library ifeq ($(PLATFORM_OS),WINDOWS) - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) $(ALLIBS) -Lexternal/glfw3/lib/win32 -Lexternal/openal_soft/lib/win32 -lglfw3 -lgdi32 -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylibdll.a + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) -L$(RAYLIB_RELEASE_PATH) -lglfw3 -lgdi32 -lopenal32 -lwinmm -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylibdll.a @echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!" + @echo "expected OpenAL Soft static library linking" endif ifeq ($(PLATFORM_OS),LINUX) # Compile raylib to shared library version for GNU/Linux. @@ -324,6 +327,7 @@ else endif else # Compile raylib static library. + @echo raylib library release path is $(RAYLIB_RELEASE_PATH) $(AR) rcs $(RAYLIB_RELEASE_PATH)/libraylib.a $(OBJS) @echo "raylib static library generated (libraylib.a)!" ifeq ($(OPENAL_LIBTYPE),STATIC) -- cgit v1.2.3 From ad31730b6abdb07cb2450c4e3795ba921709da19 Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 22 Oct 2017 20:00:38 +0200 Subject: Added cross-compiler RPI libs --- src/Makefile | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 1da4557d..13be7844 100644 --- a/src/Makefile +++ b/src/Makefile @@ -46,7 +46,7 @@ RAYLIB_PATH ?= .. # Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) # NOTE: OpenAL Soft library should be provided in the selected form -RAYLIB_LIBTYPE ?= SHARED +RAYLIB_LIBTYPE ?= STATIC OPENAL_LIBTYPE ?= STATIC # On PLATFORM_WEB force OpenAL Soft shared library @@ -54,6 +54,13 @@ ifeq ($(PLATFORM),PLATFORM_WEB) OPENAL_LIBTYPE = SHARED endif +# Use cross-compiler for PLATFORM_RPI +ifeq ($(PLATFORM),PLATFORM_RPI) + RPI_CROSS_COMPILE ?= YES + RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry + RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot +endif + # Determine if the file has root access (only for installing raylib) # "whoami" prints the name of the user that calls him (so, if it is the root # user, "whoami" prints "root"). @@ -77,11 +84,6 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) endif endif -ifeq ($(PLATFORM),PLATFORM_RPI) - # RPI cross-compiler - RPI_CROSS_COMPILE ?= NO -endif - ifeq ($(PLATFORM),PLATFORM_WEB) # Emscripten required variables EMSDK_PATH = C:/emsdk @@ -166,8 +168,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) endif ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(RPI_CROSS_COMPILE),YES) - # RPI cross-compiler - CC = armv6j-hardfloat-linux-gnueabi-gcc + # Define RPI cross-compiler + #CC = armv6j-hardfloat-linux-gnueabi-gcc + CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc endif endif ifeq ($(PLATFORM),PLATFORM_WEB) @@ -188,6 +191,14 @@ endif # Default archiver program to pack libraries AR = ar +ifeq ($(PLATFORM),PLATFORM_RPI) + ifeq ($(RPI_CROSS_COMPILE),YES) + # Define RPI cross-archiver + #CC = armv6j-hardfloat-linux-gnueabi-gcc + AR = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-ar + endif +endif + # Android archiver (also depends on desired architecture) ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(ANDROID_ARCH),ARM) @@ -251,9 +262,10 @@ INCLUDE_PATHS = -I. -Iexternal -Iexternal/include # Define additional directories containing required header files ifeq ($(PLATFORM),PLATFORM_RPI) # RPI requried libraries - INCLUDE_PATHS += -I/opt/vc/include - INCLUDE_PATHS += -I/opt/vc/include/interface/vmcs_host/linux - INCLUDE_PATHS += -I/opt/vc/include/interface/vcos/pthreads + INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include + INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vmcs_host/linux + INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vcos/pthreads + INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vcos/pthreads endif ifeq ($(PLATFORM),PLATFORM_ANDROID) # Android required libraries @@ -326,7 +338,7 @@ else @echo "raylib shared library generated (libraylib.so)!" endif else - # Compile raylib static library. + # Compile raylib static library @echo raylib library release path is $(RAYLIB_RELEASE_PATH) $(AR) rcs $(RAYLIB_RELEASE_PATH)/libraylib.a $(OBJS) @echo "raylib static library generated (libraylib.a)!" -- cgit v1.2.3 From b3110c14feee4036e5504b2a16b2b8e506fc9b7a Mon Sep 17 00:00:00 2001 From: Martinfx Date: Sat, 28 Oct 2017 17:30:02 +0200 Subject: Added support FreeBSD --- src/Makefile | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 13be7844..14d9760d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,6 +6,7 @@ # PLATFORM_DESKTOP: Windows (win32/Win64) # PLATFORM_DESKTOP: Linux # PLATFORM_DESKTOP: OSX (Mac) +# PLATFORM_DESKTOP: FreeBSD # PLATFORM_ANDROID: Android (ARM or ARM64) # PLATFORM_RPI: Raspberry Pi (Raspbian) # PLATFORM_WEB: HTML5 (Chrome, Firefox) @@ -76,11 +77,13 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) UNAMEOS=$(shell uname) ifeq ($(UNAMEOS),Linux) PLATFORM_OS=LINUX - else + endif + ifeq ($(UNAMEOS),FreeBSD) + PLATFORM_OS=FREEBSD + endif ifeq ($(UNAMEOS),Darwin) PLATFORM_OS=OSX endif - endif endif endif @@ -117,6 +120,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),OSX) RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/osx endif + ifeq ($(PLATFORM_OS),FREEBSD) + RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/freebsd + endif endif ifeq ($(PLATFORM),PLATFORM_RPI) RAYLIB_RELEASE_PATH = $(RAYLIB_PATH)/release/libs/rpi @@ -165,6 +171,10 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) # OSX default compiler CC = clang endif + ifeq ($(PLATFORM_OS),FREEBSD) + # default compiler + CC = clang + endif endif ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(RPI_CROSS_COMPILE),YES) @@ -259,6 +269,13 @@ endif # NOTE: Several external required libraries (stb and others) INCLUDE_PATHS = -I. -Iexternal -Iexternal/include +ifeq ($(PLATFORM),PLATFORM_DESKTOP) + ifeq ($(PLATFORM_OS),FREEBSD) + INCLUDE_PATHS += -I/usr/local/include + LDFLAGS += -L. -Lsrc -L/usr/local/lib -L$(RAYLIB_RELEASE_PATH) + endif +endif + # Define additional directories containing required header files ifeq ($(PLATFORM),PLATFORM_RPI) # RPI requried libraries @@ -333,6 +350,12 @@ else install_name_tool -id "libraylib.dylib" $(RAYLIB_RELEASE_PATH)/libraylib.dylib @echo "raylib shared library generated (libraylib.dylib)!" endif + ifeq ($(PLATFORM_OS),FREEBSD) + # Compile raylib to shared library version for FreeBSD + # WARNING: you should type "make clean" before doing this target + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lglfw -lGL -lopenal -lpthread + @echo "raylib shared library generated (libraylib.so)!" + endif ifeq ($(PLATFORM),PLATFORM_ANDROID) $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) $(LDFLAGS) $(LDLIBS) @echo "raylib shared library generated (libraylib.so)!" -- cgit v1.2.3 From 47c7f3624f187db057cd5a05a46247f99730c7b2 Mon Sep 17 00:00:00 2001 From: Martinfx Date: Sat, 28 Oct 2017 18:41:29 +0200 Subject: Added support FreeBSD for example --- src/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 14d9760d..176991bb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -172,7 +172,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) CC = clang endif ifeq ($(PLATFORM_OS),FREEBSD) - # default compiler + # FreeBSD default compiler CC = clang endif endif @@ -351,8 +351,7 @@ else @echo "raylib shared library generated (libraylib.dylib)!" endif ifeq ($(PLATFORM_OS),FREEBSD) - # Compile raylib to shared library version for FreeBSD - # WARNING: you should type "make clean" before doing this target + # WARNING: you should type "gmake clean" before doing this target $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lglfw -lGL -lopenal -lpthread @echo "raylib shared library generated (libraylib.so)!" endif -- cgit v1.2.3 From 743cc6add68111cde0366476823537210c38cab4 Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 30 Oct 2017 00:14:13 +0100 Subject: Review new build platform: FreeBSD Corrected issue with RPI_CROSS_COMPILE --- src/Makefile | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 176991bb..29b3fb75 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,11 +3,11 @@ # raylib makefile # # Platforms supported: -# PLATFORM_DESKTOP: Windows (win32/Win64) +# PLATFORM_DESKTOP: Windows (Win32, Win64) # PLATFORM_DESKTOP: Linux -# PLATFORM_DESKTOP: OSX (Mac) +# PLATFORM_DESKTOP: OSX/macOS # PLATFORM_DESKTOP: FreeBSD -# PLATFORM_ANDROID: Android (ARM or ARM64) +# PLATFORM_ANDROID: Android (ARM, ARM64) # PLATFORM_RPI: Raspberry Pi (Raspbian) # PLATFORM_WEB: HTML5 (Chrome, Firefox) # @@ -57,9 +57,12 @@ endif # Use cross-compiler for PLATFORM_RPI ifeq ($(PLATFORM),PLATFORM_RPI) - RPI_CROSS_COMPILE ?= YES - RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry - RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot + RPI_CROSS_COMPILE ?= NO + + ifeq ($(RPI_CROSS_COMPILE),YES) + RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry + RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot + endif endif # Determine if the file has root access (only for installing raylib) @@ -352,8 +355,8 @@ else endif ifeq ($(PLATFORM_OS),FREEBSD) # WARNING: you should type "gmake clean" before doing this target - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lglfw -lGL -lopenal -lpthread - @echo "raylib shared library generated (libraylib.so)!" + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lglfw -lGL -lopenal -lpthread + @echo "raylib shared library generated (libraylib.so)!" endif ifeq ($(PLATFORM),PLATFORM_ANDROID) $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) $(LDFLAGS) $(LDLIBS) -- cgit v1.2.3 From 9a7524661fd31aef254abc1266132775aa4f0d07 Mon Sep 17 00:00:00 2001 From: Ray San Date: Thu, 30 Nov 2017 16:59:09 +0100 Subject: Removed GLFW3 linking and added rglfw --- src/Makefile | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 29b3fb75..2408f0f1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -89,6 +89,12 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) endif endif endif +ifeq ($(PLATFORM),PLATFORM_RPI) + UNAMEOS=$(shell uname) + ifeq ($(UNAMEOS),Linux) + PLATFORM_OS=LINUX + endif +endif ifeq ($(PLATFORM),PLATFORM_WEB) # Emscripten required variables @@ -224,7 +230,7 @@ endif # Define compiler flags: # -O1 defines optimization level -# -Og enable debugging +# -g 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) @@ -270,7 +276,7 @@ endif # Define include paths for required headers # NOTE: Several external required libraries (stb and others) -INCLUDE_PATHS = -I. -Iexternal -Iexternal/include +INCLUDE_PATHS = -I. -Iexternal -Iexternal/include -Iexternal/glfw/include ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),FREEBSD) @@ -310,8 +316,23 @@ endif # Define all object files required with a wildcard # The wildcard takes all files that finish with ".c", # and replaces extentions with ".o", that are the object files -OBJS = $(patsubst %.c, %.o, $(wildcard *.c)) -OBJS += stb_vorbis.o +# NOTE: Some objects depend on the PLATFORM to be added or not! +# OBJS = $(patsubst %.c, %.o, $(wildcard *.c)) + +# Define object required on compilation +OBJS = core.o \ + rlgl.o \ + shapes.o \ + textures.o \ + text.o \ + models.o \ + audio.o \ + stb_vorbis.o \ + utils.o + +ifeq ($(PLATFORM),PLATFORM_DESKTOP) + OBJS += rglfw.o +endif # Default target entry all: raylib @@ -338,24 +359,24 @@ else ifeq ($(RAYLIB_LIBTYPE),SHARED) # NOTE: If using OpenAL Soft as static library, all its dependencies must be also linked in the shared library ifeq ($(PLATFORM_OS),WINDOWS) - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) -L$(RAYLIB_RELEASE_PATH) -lglfw3 -lgdi32 -lopenal32 -lwinmm -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylibdll.a + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) -L$(RAYLIB_RELEASE_PATH) -lgdi32 -lopenal32 -lwinmm -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylibdll.a @echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!" @echo "expected OpenAL Soft static library linking" endif 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 $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lglfw -lGL -lopenal -lm -lpthread -ldl + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lopenal -lm -lpthread -ldl @echo "raylib shared library generated (libraylib.so)!" endif ifeq ($(PLATFORM_OS),OSX) - $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.dylib $(OBJS) -L/usr/local/Cellar/glfw/3.2.1/lib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa + $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.dylib $(OBJS) -L/usr/local/Cellar/glfw/3.2.1/lib -framework OpenGL -framework OpenAL -framework Cocoa install_name_tool -id "libraylib.dylib" $(RAYLIB_RELEASE_PATH)/libraylib.dylib @echo "raylib shared library generated (libraylib.dylib)!" endif ifeq ($(PLATFORM_OS),FREEBSD) # WARNING: you should type "gmake clean" before doing this target - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lglfw -lGL -lopenal -lpthread + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lopenal -lpthread @echo "raylib shared library generated (libraylib.so)!" endif ifeq ($(PLATFORM),PLATFORM_ANDROID) @@ -380,6 +401,10 @@ endif # Compile core module core.o : core.c raylib.h rlgl.h utils.h raymath.h gestures.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) + +# Compile rglfw module +rglfw.o : rglfw.c + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) # Compile rlgl module rlgl.o : rlgl.c rlgl.h raymath.h -- cgit v1.2.3 From 3b5a26099e0cde67084481eb6048058578b30a0c Mon Sep 17 00:00:00 2001 From: Ray San Date: Tue, 5 Dec 2017 14:01:35 +0100 Subject: Removed OpenAL Soft dependency on building OpenAL Soft backend is still available in audio module, I'm thinking if exposing it for building in some way or just left it there for advance users to switch to it manually in case of necessity... --- src/Makefile | 44 +++++++++++++++----------------------------- 1 file changed, 15 insertions(+), 29 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 2408f0f1..83aec5dd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,7 +4,7 @@ # # Platforms supported: # PLATFORM_DESKTOP: Windows (Win32, Win64) -# PLATFORM_DESKTOP: Linux +# PLATFORM_DESKTOP: Linux (32 and 64 bit) # PLATFORM_DESKTOP: OSX/macOS # PLATFORM_DESKTOP: FreeBSD # PLATFORM_ANDROID: Android (ARM, ARM64) @@ -14,7 +14,7 @@ # Many thanks to Milan Nikolic (@gen2brain) for implementing Android platform pipeline. # Many thanks to Emanuele Petriglia for his contribution on GNU/Linux pipeline. # -# Copyright (c) 2014-2017 Ramon Santamaria (@raysan5) +# Copyright (c) 2014-2018 Ramon Santamaria (@raysan5) # # This software is provided "as-is", without any express or implied warranty. # In no event will the authors be held liable for any damages arising from @@ -43,17 +43,10 @@ # Define required raylib variables PLATFORM ?= PLATFORM_DESKTOP -RAYLIB_PATH ?= .. +RAYLIB_PATH = .. -# Library type used for raylib and OpenAL Soft: STATIC (.a) or SHARED (.so/.dll) -# NOTE: OpenAL Soft library should be provided in the selected form +# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) RAYLIB_LIBTYPE ?= STATIC -OPENAL_LIBTYPE ?= STATIC - -# On PLATFORM_WEB force OpenAL Soft shared library -ifeq ($(PLATFORM),PLATFORM_WEB) - OPENAL_LIBTYPE = SHARED -endif # Use cross-compiler for PLATFORM_RPI ifeq ($(PLATFORM),PLATFORM_RPI) @@ -269,14 +262,9 @@ ifeq ($(RAYLIB_LIBTYPE),SHARED) CFLAGS += -fPIC -DBUILD_LIBTYPE_SHARED endif -# Define required compilation flags for OpenAL Soft STATIC lib -ifeq ($(OPENAL_LIBTYPE),STATIC) - ALFLAGS = -DAL_LIBTYPE_STATIC -Wl,-allow-multiple-definition -endif - # Define include paths for required headers # NOTE: Several external required libraries (stb and others) -INCLUDE_PATHS = -I. -Iexternal -Iexternal/include -Iexternal/glfw/include +INCLUDE_PATHS = -I. -Iexternal -Iexternal/glfw/include ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),FREEBSD) @@ -310,7 +298,7 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) # Library paths containing required libs LDFLAGS += -L. -Lsrc -L$(RAYLIB_RELEASE_PATH) - LDLIBS = -lopenal -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm + LDLIBS = -llog -landroid -lEGL -lGLESv2 -lOpenSLES -latomic -lc -lm endif # Define all object files required with a wildcard @@ -327,6 +315,7 @@ OBJS = core.o \ text.o \ models.o \ audio.o \ + mini_al.o \ stb_vorbis.o \ utils.o @@ -357,16 +346,14 @@ ifeq ($(PLATFORM),PLATFORM_WEB) @echo "raylib library generated (libraylib.bc)!" else ifeq ($(RAYLIB_LIBTYPE),SHARED) - # NOTE: If using OpenAL Soft as static library, all its dependencies must be also linked in the shared library ifeq ($(PLATFORM_OS),WINDOWS) - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) -L$(RAYLIB_RELEASE_PATH) -lgdi32 -lopenal32 -lwinmm -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylibdll.a + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) -L$(RAYLIB_RELEASE_PATH) -static-libgcc -lopengl32 -lgdi32 -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylibdll.a @echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!" - @echo "expected OpenAL Soft static library linking" endif 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 $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lopenal -lm -lpthread -ldl + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lm -lpthread -ldl @echo "raylib shared library generated (libraylib.so)!" endif ifeq ($(PLATFORM_OS),OSX) @@ -376,7 +363,7 @@ else endif ifeq ($(PLATFORM_OS),FREEBSD) # WARNING: you should type "gmake clean" before doing this target - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lopenal -lpthread + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lpthread @echo "raylib shared library generated (libraylib.so)!" endif ifeq ($(PLATFORM),PLATFORM_ANDROID) @@ -388,11 +375,6 @@ else @echo raylib library release path is $(RAYLIB_RELEASE_PATH) $(AR) rcs $(RAYLIB_RELEASE_PATH)/libraylib.a $(OBJS) @echo "raylib static library generated (libraylib.a)!" - ifeq ($(OPENAL_LIBTYPE),STATIC) - @echo "expected OpenAL Soft static library linking" - else - @echo "expected OpenAL Soft shared library linking" - endif endif endif @@ -428,7 +410,11 @@ models.o : models.c raylib.h rlgl.h raymath.h # Compile audio module audio.o : audio.c raylib.h - $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) $(ALFLAGS) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) + +# Compile mini_al audio library +mini_al.o : external/mini_al.c external/mini_al.h + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) # Compile stb_vorbis library stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h -- cgit v1.2.3 From 5ae2c0d15b349ce59425c319165505bda8298a6c Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 9 Dec 2017 19:05:42 +0100 Subject: Added Wayland support Updated to latest GLFW library and working on Wayland support, still looking how to implement it on raylib because it just exposes PLATFORM_DESKTOP and defaults to X11 windowing system on Linux... --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 83aec5dd..e3bb91cc 100644 --- a/src/Makefile +++ b/src/Makefile @@ -353,7 +353,7 @@ else 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 $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lm -lpthread -ldl + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lm -lpthread -ldl -lrt @echo "raylib shared library generated (libraylib.so)!" endif ifeq ($(PLATFORM_OS),OSX) -- cgit v1.2.3 From d24b89bb0ec8abe7243963bdbca96cb254c27256 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Sun, 10 Dec 2017 21:57:25 +0100 Subject: Add library versioning to Make/CMake build systems See #401 for the discussion. Also bumps version number to 1.9.2 without the -dev, because neither ELF nor MachO like such a suffix. The -dev suffix will have to be restricted to the git tags. --- src/Makefile | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index e3bb91cc..b9c21929 100644 --- a/src/Makefile +++ b/src/Makefile @@ -42,6 +42,8 @@ .PHONY: all clean install uninstall # Define required raylib variables +VERSION = 1.9.2 +API_VERSION = 1 PLATFORM ?= PLATFORM_DESKTOP RAYLIB_PATH = .. @@ -172,6 +174,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),OSX) # OSX default compiler CC = clang + GLFW_CFLAGS = -x objective-c endif ifeq ($(PLATFORM_OS),FREEBSD) # FreeBSD default compiler @@ -291,7 +294,7 @@ endif # Define linker options ifeq ($(PLATFORM),PLATFORM_ANDROID) - LDFLAGS = -Wl,-soname,libraylib.so -Wl,--exclude-libs,libatomic.a + LDFLAGS = -Wl,-soname,libraylib.$(API_VERSION).so -Wl,--exclude-libs,libatomic.a LDFLAGS += -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings # Force linking of library module to define symbol LDFLAGS += -u ANativeActivity_onCreate @@ -353,22 +356,30 @@ else 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 $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lm -lpthread -ldl -lrt - @echo "raylib shared library generated (libraylib.so)!" + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so $(OBJS) -Wl,-soname,libraylib.$(API_VERSION).so -lGL -lm -lpthread -ldl -lrt + @echo "raylib shared library generated (libraylib.$(VERSION).so)!" + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.$(API_VERSION).so + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.so endif ifeq ($(PLATFORM_OS),OSX) - $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.dylib $(OBJS) -L/usr/local/Cellar/glfw/3.2.1/lib -framework OpenGL -framework OpenAL -framework Cocoa - install_name_tool -id "libraylib.dylib" $(RAYLIB_RELEASE_PATH)/libraylib.dylib - @echo "raylib shared library generated (libraylib.dylib)!" + $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).dylib $(OBJS) -compatibility_version $(API_VERSION) -current_version $(VERSION) -framework OpenGL -framework OpenAL -framework IOKit -framework CoreVideo -framework Cocoa + install_name_tool -id "libraylib.$(VERSION).dylib" $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).dylib + @echo "raylib shared library generated (libraylib.$(VERSION).dylib)!" + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).dylib libraylib.$(API_VERSION).dylib + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).dylib libraylib.dylib endif ifeq ($(PLATFORM_OS),FREEBSD) # WARNING: you should type "gmake clean" before doing this target - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) -lGL -lpthread - @echo "raylib shared library generated (libraylib.so)!" + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so $(OBJS) -Wl,-soname,libraylib.$(API_VERSION).so -lGL -lpthread + @echo "raylib shared library generated (libraylib.$(VERSION).so)!" + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.$(API_VERSION).so + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.so endif ifeq ($(PLATFORM),PLATFORM_ANDROID) - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so $(OBJS) $(LDFLAGS) $(LDLIBS) - @echo "raylib shared library generated (libraylib.so)!" + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS) + @echo "raylib shared library generated (libraylib.$(VERSION).so)!" + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.$(API_VERSION).so + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.so endif else # Compile raylib static library @@ -386,7 +397,7 @@ core.o : core.c raylib.h rlgl.h utils.h raymath.h gestures.h # Compile rglfw module rglfw.o : rglfw.c - $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) + $(CC) $(GLFW_CFLAGS) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) # Compile rlgl module rlgl.o : rlgl.c rlgl.h raymath.h @@ -434,6 +445,8 @@ ifeq ($(ROOT),root) # /usr/local/include/) are for libraries that are installed # manually (without a package manager). ifeq ($(RAYLIB_LIBTYPE),SHARED) + cp --update $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so /usr/local/lib/libraylib.$(VERSION).so + cp --update $(RAYLIB_RELEASE_PATH)/libraylib.$(API_VERSION).so /usr/local/lib/libraylib.$(API_VERSION).so cp --update $(RAYLIB_RELEASE_PATH)/libraylib.so /usr/local/lib/libraylib.so else cp --update raylib.h /usr/local/include/raylib.h @@ -455,6 +468,8 @@ ifeq ($(ROOT),root) rm --force /usr/local/include/raylib.h ifeq ($(RAYLIB_LIBTYPE),SHARED) rm --force /usr/local/lib/libraylib.so + rm --force /usr/local/lib/libraylib.$(API_VERSION).so + rm --force /usr/local/lib/libraylib.$(VERSION).so else rm --force /usr/local/lib/libraylib.a endif @@ -471,7 +486,7 @@ clean: ifeq ($(PLATFORM_OS),WINDOWS) del *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so external/stb_vorbis.o else - rm -f *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so external/stb_vorbis.o + rm -f *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so $(RAYLIB_RELEASE_PATH)/libraylib.$(API_VERSION).so $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so external/stb_vorbis.o endif ifeq ($(PLATFORM),PLATFORM_ANDROID) rm -rf $(ANDROID_TOOLCHAIN) -- cgit v1.2.3 From b155333178247d917e99e806cdcb27e9ab2d5c3c Mon Sep 17 00:00:00 2001 From: Ray San Date: Fri, 15 Dec 2017 17:02:29 +0100 Subject: Support audio module skip on compiling Some programs like tools could not require audio support --- src/Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index b9c21929..00f5fa2f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -47,6 +47,10 @@ API_VERSION = 1 PLATFORM ?= PLATFORM_DESKTOP RAYLIB_PATH = .. +# Included raylib audio module on compilation +# NOTE: Some programs like tools could not require audio support +INCLUDE_AUDIO_MODULE ?= YES + # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) RAYLIB_LIBTYPE ?= STATIC @@ -317,15 +321,18 @@ OBJS = core.o \ textures.o \ text.o \ models.o \ - audio.o \ - mini_al.o \ - stb_vorbis.o \ utils.o ifeq ($(PLATFORM),PLATFORM_DESKTOP) OBJS += rglfw.o endif +ifeq ($(INCLUDE_AUDIO_MODULE),YES) + OBJS += audio.o + OBJS += mini_al.o + OBJS += stb_vorbis.o +endif + # Default target entry all: raylib -- cgit v1.2.3 From 61afd07bd7b3a96c6f0f460b668f52cf1a8bd90f Mon Sep 17 00:00:00 2001 From: Ray San Date: Wed, 20 Dec 2017 12:34:18 +0100 Subject: Force OpenAL backend on some platforms OpenAL audio backend is being forced on HTML5 and OSX --- src/Makefile | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 00f5fa2f..1d1aa75c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -47,12 +47,20 @@ API_VERSION = 1 PLATFORM ?= PLATFORM_DESKTOP RAYLIB_PATH = .. +# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) +RAYLIB_LIBTYPE ?= STATIC + # Included raylib audio module on compilation # NOTE: Some programs like tools could not require audio support INCLUDE_AUDIO_MODULE ?= YES -# Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) -RAYLIB_LIBTYPE ?= STATIC +# Force OpenAL Soft backend for audio +FORCE_OPENAL_BACKEND ?= FALSE + +# OpenAL Soft audio backend forced on HTML5 and OSX (see below) +ifeq ($(PLATFORM),PLATFORM_WEB) + FORCE_OPENAL_BACKEND = TRUE +endif # Use cross-compiler for PLATFORM_RPI ifeq ($(PLATFORM),PLATFORM_RPI) @@ -95,6 +103,13 @@ ifeq ($(PLATFORM),PLATFORM_RPI) endif endif +# Force OpenAL Soft audio backend for OSX platform +# NOTE 1: mini_al library does not support CoreAudio yet +# NOTE 2: Required OpenAL libraries should be available on OSX +ifeq ($(PLATFORM_OS),OSX) + FORCE_OPENAL_BACKEND = TRUE +endif + ifeq ($(PLATFORM),PLATFORM_WEB) # Emscripten required variables EMSDK_PATH = C:/emsdk @@ -269,6 +284,10 @@ ifeq ($(RAYLIB_LIBTYPE),SHARED) CFLAGS += -fPIC -DBUILD_LIBTYPE_SHARED endif +ifeq ($(FORCE_OPENAL_BACKEND),TRUE) + CFLAGS += -DFORCE_OPENAL_BACKEND +endif + # Define include paths for required headers # NOTE: Several external required libraries (stb and others) INCLUDE_PATHS = -I. -Iexternal -Iexternal/glfw/include @@ -329,8 +348,10 @@ endif ifeq ($(INCLUDE_AUDIO_MODULE),YES) OBJS += audio.o - OBJS += mini_al.o OBJS += stb_vorbis.o +ifeq ($(FORCE_OPENAL_BACKEND),FALSE) + OBJS += mini_al.o +endif endif # Default target entry -- cgit v1.2.3 From c93bca8c272af83ae752afb46db2b54d85dca454 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Thu, 28 Dec 2017 17:58:09 +0100 Subject: Review Makefile config flags Support external GLFW usage Renamed some flags for consistency --- src/Makefile | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 1d1aa75c..de9a639e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -52,21 +52,24 @@ RAYLIB_LIBTYPE ?= STATIC # Included raylib audio module on compilation # NOTE: Some programs like tools could not require audio support -INCLUDE_AUDIO_MODULE ?= YES +INCLUDE_AUDIO_MODULE ?= TRUE # Force OpenAL Soft backend for audio -FORCE_OPENAL_BACKEND ?= FALSE +USE_OPENAL_BACKEND ?= FALSE + +# Use external GLFW library instead of rglfw module +USE_EXTERNAL_GLFW ?= FALSE # OpenAL Soft audio backend forced on HTML5 and OSX (see below) ifeq ($(PLATFORM),PLATFORM_WEB) - FORCE_OPENAL_BACKEND = TRUE + USE_OPENAL_BACKEND = TRUE endif # Use cross-compiler for PLATFORM_RPI ifeq ($(PLATFORM),PLATFORM_RPI) - RPI_CROSS_COMPILE ?= NO + USE_RPI_CROSS_COMPILER ?= FALSE - ifeq ($(RPI_CROSS_COMPILE),YES) + ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot endif @@ -107,7 +110,7 @@ endif # NOTE 1: mini_al library does not support CoreAudio yet # NOTE 2: Required OpenAL libraries should be available on OSX ifeq ($(PLATFORM_OS),OSX) - FORCE_OPENAL_BACKEND = TRUE + USE_OPENAL_BACKEND = TRUE endif ifeq ($(PLATFORM),PLATFORM_WEB) @@ -201,7 +204,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) endif endif ifeq ($(PLATFORM),PLATFORM_RPI) - ifeq ($(RPI_CROSS_COMPILE),YES) + ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) # Define RPI cross-compiler #CC = armv6j-hardfloat-linux-gnueabi-gcc CC = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-gcc @@ -226,7 +229,7 @@ endif AR = ar ifeq ($(PLATFORM),PLATFORM_RPI) - ifeq ($(RPI_CROSS_COMPILE),YES) + ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) # Define RPI cross-archiver #CC = armv6j-hardfloat-linux-gnueabi-gcc AR = $(RPI_TOOLCHAIN)/bin/arm-linux-gnueabihf-ar @@ -284,8 +287,8 @@ ifeq ($(RAYLIB_LIBTYPE),SHARED) CFLAGS += -fPIC -DBUILD_LIBTYPE_SHARED endif -ifeq ($(FORCE_OPENAL_BACKEND),TRUE) - CFLAGS += -DFORCE_OPENAL_BACKEND +ifeq ($(USE_OPENAL_BACKEND),TRUE) + CFLAGS += -DUSE_OPENAL_BACKEND endif # Define include paths for required headers @@ -297,6 +300,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) INCLUDE_PATHS += -I/usr/local/include LDFLAGS += -L. -Lsrc -L/usr/local/lib -L$(RAYLIB_RELEASE_PATH) endif + ifeq ($(USE_EXTERNAL_GLFW),TRUE) + LDFLAGS += -lglfw + endif endif # Define additional directories containing required header files @@ -343,15 +349,17 @@ OBJS = core.o \ utils.o ifeq ($(PLATFORM),PLATFORM_DESKTOP) - OBJS += rglfw.o + ifeq ($(USE_EXTERNAL_GLFW),FALSE) + OBJS += rglfw.o + endif endif -ifeq ($(INCLUDE_AUDIO_MODULE),YES) +ifeq ($(INCLUDE_AUDIO_MODULE),TRUE) OBJS += audio.o OBJS += stb_vorbis.o -ifeq ($(FORCE_OPENAL_BACKEND),FALSE) - OBJS += mini_al.o -endif + ifeq ($(USE_OPENAL_BACKEND),FALSE) + OBJS += mini_al.o + endif endif # Default target entry -- cgit v1.2.3 From 7965f983baa91afa7ac8019574a14e4814c91cf2 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Thu, 28 Dec 2017 18:14:39 +0100 Subject: Support Wayland display on Linux desktop --- src/Makefile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index de9a639e..2ee9f909 100644 --- a/src/Makefile +++ b/src/Makefile @@ -54,12 +54,16 @@ RAYLIB_LIBTYPE ?= STATIC # NOTE: Some programs like tools could not require audio support INCLUDE_AUDIO_MODULE ?= TRUE -# Force OpenAL Soft backend for audio +# Use OpenAL Soft backend for audio USE_OPENAL_BACKEND ?= FALSE # Use external GLFW library instead of rglfw module USE_EXTERNAL_GLFW ?= FALSE +# Use Wayland display server protocol on Linux desktop +# by default it uses X11 windowing system +USE_WAYLAND_DISPLAY ?= FALSE + # OpenAL Soft audio backend forced on HTML5 and OSX (see below) ifeq ($(PLATFORM),PLATFORM_WEB) USE_OPENAL_BACKEND = TRUE @@ -287,10 +291,20 @@ ifeq ($(RAYLIB_LIBTYPE),SHARED) CFLAGS += -fPIC -DBUILD_LIBTYPE_SHARED endif +# Use OpenAL Soft backend instead of mini_al ifeq ($(USE_OPENAL_BACKEND),TRUE) CFLAGS += -DUSE_OPENAL_BACKEND endif +# Use Wayland display on Linux desktop +ifeq ($(PLATFORM),PLATFORM_DESKTOP) + ifeq ($(PLATFORM_OS), LINUX) + ifeq ($(USE_WAYLAND_DISPLAY),TRUE) + CFLAGS += -D_GLFW_WAYLAND + endif + endif +endif + # Define include paths for required headers # NOTE: Several external required libraries (stb and others) INCLUDE_PATHS = -I. -Iexternal -Iexternal/glfw/include -- cgit v1.2.3 From f2a675ae53321b5909e9324d3bb81250e704e4f2 Mon Sep 17 00:00:00 2001 From: - <-> Date: Mon, 15 Jan 2018 13:54:06 +0100 Subject: Reviewed Makefiles... - Renamed VERSION to RAYLIB_VERSION - Renamed API_VERSION to RAYLIB_API_VERSION - Renamed RAYLIB_RELEASE to RAYLIB_RELEASE_PATH - Support Web Assembly compilation on PLATFORM_WEB --- src/Makefile | 67 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 33 insertions(+), 34 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 2ee9f909..fbab6725 100644 --- a/src/Makefile +++ b/src/Makefile @@ -36,19 +36,18 @@ # #****************************************************************************** -# Please read the wiki to know how to compile raylib, because there are -# different methods. +# Please read the wiki to know how to compile raylib, because there are different methods. +# https://github.com/raysan5/raylib/wiki .PHONY: all clean install uninstall # Define required raylib variables -VERSION = 1.9.2 -API_VERSION = 1 -PLATFORM ?= PLATFORM_DESKTOP -RAYLIB_PATH = .. - +PLATFORM ?= PLATFORM_DESKTOP +RAYLIB_PATH = .. +RAYLIB_VERSION = 1.9.2 +RAYLIB_API_VERSION = 1 # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) -RAYLIB_LIBTYPE ?= STATIC +RAYLIB_LIBTYPE ?= STATIC # Included raylib audio module on compilation # NOTE: Some programs like tools could not require audio support @@ -120,8 +119,8 @@ endif ifeq ($(PLATFORM),PLATFORM_WEB) # Emscripten required variables EMSDK_PATH = C:/emsdk - EMSCRIPTEN_VERSION = 1.37.21 - CLANG_VERSION=e1.37.21_64bit + EMSCRIPTEN_VERSION = 1.37.28 + CLANG_VERSION=e1.37.28_64bit PYTHON_VERSION=2.7.5.3_64bit NODE_VERSION=4.1.1_64bit export PATH=$(EMSDK_PATH);$(EMSDK_PATH)\clang\$(CLANG_VERSION);$(EMSDK_PATH)\node\$(NODE_VERSION)\bin;$(EMSDK_PATH)\python\$(PYTHON_VERSION);$(EMSDK_PATH)\emscripten\$(EMSCRIPTEN_VERSION);C:\raylib\MinGW\bin:$$(PATH) @@ -192,7 +191,7 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) GRAPHICS = GRAPHICS_API_OPENGL_ES2 endif -# Default C compiler: gcc +# Define default C compiler: gcc # NOTE: define g++ compiler if using C++ CC = gcc @@ -259,7 +258,7 @@ endif # -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 +# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces # Additional flags for compiler (if desired) @@ -406,30 +405,30 @@ else 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 $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so $(OBJS) -Wl,-soname,libraylib.$(API_VERSION).so -lGL -lm -lpthread -ldl -lrt - @echo "raylib shared library generated (libraylib.$(VERSION).so)!" - cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.$(API_VERSION).so - cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.so + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).so $(OBJS) -Wl,-soname,libraylib.$(RAYLIB_API_VERSION).so -lGL -lm -lpthread -ldl -lrt + @echo "raylib shared library generated (libraylib.$(RAYLIB_VERSION).so)!" + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).so libraylib.$(RAYLIB_API_VERSION).so + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).so libraylib.so endif ifeq ($(PLATFORM_OS),OSX) - $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).dylib $(OBJS) -compatibility_version $(API_VERSION) -current_version $(VERSION) -framework OpenGL -framework OpenAL -framework IOKit -framework CoreVideo -framework Cocoa - install_name_tool -id "libraylib.$(VERSION).dylib" $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).dylib - @echo "raylib shared library generated (libraylib.$(VERSION).dylib)!" - cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).dylib libraylib.$(API_VERSION).dylib - cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).dylib libraylib.dylib + $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).dylib $(OBJS) -compatibility_version $(RAYLIB_API_VERSION) -current_version $(RAYLIB_VERSION) -framework OpenGL -framework OpenAL -framework IOKit -framework CoreVideo -framework Cocoa + install_name_tool -id "libraylib.$(VERSION).dylib" $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).dylib + @echo "raylib shared library generated (libraylib.$(RAYLIB_VERSION).dylib)!" + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).dylib libraylib.$(RAYLIB_API_VERSION).dylib + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).dylib libraylib.dylib endif ifeq ($(PLATFORM_OS),FREEBSD) # WARNING: you should type "gmake clean" before doing this target - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so $(OBJS) -Wl,-soname,libraylib.$(API_VERSION).so -lGL -lpthread - @echo "raylib shared library generated (libraylib.$(VERSION).so)!" - cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.$(API_VERSION).so - cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.so + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).so $(OBJS) -Wl,-soname,libraylib.$(RAYLIB_API_VERSION).so -lGL -lpthread + @echo "raylib shared library generated (libraylib.$(RAYLIB_VERSION).so)!" + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).so libraylib.$(RAYLIB_API_VERSION).so + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).so libraylib.so endif ifeq ($(PLATFORM),PLATFORM_ANDROID) - $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS) - @echo "raylib shared library generated (libraylib.$(VERSION).so)!" - cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.$(API_VERSION).so - cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(VERSION).so libraylib.so + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS) + @echo "raylib shared library generated (libraylib.$(RAYLIB_VERSION).so)!" + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).so libraylib.$(RAYLIB_API_VERSION).so + cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).so libraylib.so endif else # Compile raylib static library @@ -495,8 +494,8 @@ ifeq ($(ROOT),root) # /usr/local/include/) are for libraries that are installed # manually (without a package manager). ifeq ($(RAYLIB_LIBTYPE),SHARED) - cp --update $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so /usr/local/lib/libraylib.$(VERSION).so - cp --update $(RAYLIB_RELEASE_PATH)/libraylib.$(API_VERSION).so /usr/local/lib/libraylib.$(API_VERSION).so + cp --update $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).so /usr/local/lib/libraylib.$(RAYLIB_VERSION).so + cp --update $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_API_VERSION).so /usr/local/lib/libraylib.$(RAYLIB_API_VERSION).so cp --update $(RAYLIB_RELEASE_PATH)/libraylib.so /usr/local/lib/libraylib.so else cp --update raylib.h /usr/local/include/raylib.h @@ -518,8 +517,8 @@ ifeq ($(ROOT),root) rm --force /usr/local/include/raylib.h ifeq ($(RAYLIB_LIBTYPE),SHARED) rm --force /usr/local/lib/libraylib.so - rm --force /usr/local/lib/libraylib.$(API_VERSION).so - rm --force /usr/local/lib/libraylib.$(VERSION).so + rm --force /usr/local/lib/libraylib.$(RAYLIB_API_VERSION).so + rm --force /usr/local/lib/libraylib.$(RAYLIB_VERSION).so else rm --force /usr/local/lib/libraylib.a endif @@ -536,7 +535,7 @@ clean: ifeq ($(PLATFORM_OS),WINDOWS) del *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so external/stb_vorbis.o else - rm -f *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so $(RAYLIB_RELEASE_PATH)/libraylib.$(API_VERSION).so $(RAYLIB_RELEASE_PATH)/libraylib.$(VERSION).so external/stb_vorbis.o + rm -f *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_API_VERSION).so $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).so external/stb_vorbis.o endif ifeq ($(PLATFORM),PLATFORM_ANDROID) rm -rf $(ANDROID_TOOLCHAIN) -- cgit v1.2.3 From 30ef3f3122dc05e8a950d21c4b098208d73e456b Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Thu, 18 Jan 2018 13:22:41 +0100 Subject: GCC/Clang: Treat void pointer arithmetic as error As an extension, GNU C treats sizeof(void) as 1. MSVC doesn't. Make it an error on GCC/Clang to avoid accidental MSVC breakage. --- src/Makefile | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index fbab6725..f27ec575 100644 --- a/src/Makefile +++ b/src/Makefile @@ -250,16 +250,17 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) endif # Define compiler flags: -# -O1 defines optimization level -# -g 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 and PLATFORM_WEB, required for timespec -CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces +# -O1 defines optimization level +# -g 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 and PLATFORM_WEB, required for timespec +# -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers +CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -Werror=pointer-arith # Additional flags for compiler (if desired) #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes -- cgit v1.2.3 From c2ec88f93015f688905a0a35b64cc7c29daef223 Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 25 Jan 2018 10:07:51 +0100 Subject: Support DEBUG library building --- src/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index f27ec575..c88aa6dd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -48,6 +48,8 @@ RAYLIB_VERSION = 1.9.2 RAYLIB_API_VERSION = 1 # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) RAYLIB_LIBTYPE ?= STATIC +# Build mode for library: DEBUG or RELEASE +RAYLIB_BUILD_MODE ?= RELEASE # Included raylib audio module on compilation # NOTE: Some programs like tools could not require audio support @@ -262,6 +264,10 @@ endif # -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -Werror=pointer-arith +ifeq ($(RAYLIB_BUILD_MODE), DEBUG) + CFLAGS += -g +endif + # Additional flags for compiler (if desired) #CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes ifeq ($(PLATFORM),PLATFORM_WEB) -- cgit v1.2.3 From 8be93762d9a94a56bf430e0e177bdefb5b1fa0dd Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Thu, 25 Jan 2018 22:34:29 +0100 Subject: Make function calls without prior declaration an error which is the default behavior on C99 and up. --- src/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index c88aa6dd..fc85ea0a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -262,7 +262,8 @@ endif # -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers -CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -Werror=pointer-arith +# -Werror=implicit-function-declaration catch function calls without prior declaration +CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -Werror=pointer-arith -Werror=implicit-function-declaration ifeq ($(RAYLIB_BUILD_MODE), DEBUG) CFLAGS += -g -- cgit v1.2.3 From 19f280f4b793963eeadad9c2b2cab38d07715992 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Sun, 4 Feb 2018 13:23:08 +0100 Subject: Bump version to 1.9.4 --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index fc85ea0a..e41a88a3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -44,7 +44,7 @@ # Define required raylib variables PLATFORM ?= PLATFORM_DESKTOP RAYLIB_PATH = .. -RAYLIB_VERSION = 1.9.2 +RAYLIB_VERSION = 1.9.4 RAYLIB_API_VERSION = 1 # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) RAYLIB_LIBTYPE ?= STATIC -- cgit v1.2.3 From d90a33b850d825c3047fd570478fc8a66f22414f Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 11 Feb 2018 01:48:53 +0100 Subject: Some reviews for Android compilation --- src/Makefile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index e41a88a3..6752d9e7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -262,15 +262,20 @@ endif # -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers -# -Werror=implicit-function-declaration catch function calls without prior declaration -CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -Werror=pointer-arith -Werror=implicit-function-declaration +CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -Werror=pointer-arith ifeq ($(RAYLIB_BUILD_MODE), DEBUG) CFLAGS += -g endif # Additional flags for compiler (if desired) -#CFLAGS += -Wextra -Wmissing-prototypes -Wstrict-prototypes +# -Wextra enables some extra warning flags that are not enabled by -Wall +# -Wmissing-prototypes warn if a global function is defined without a previous prototype declaration +# -Wstrict-prototypes warn if a function is declared or defined without specifying the argument types +# -Werror=implicit-function-declaration catch function calls without prior declaration +ifeq ($(PLATFORM),PLATFORM_DESKTOP) + CFLAGS += -Werror=implicit-function-declaration +endif ifeq ($(PLATFORM),PLATFORM_WEB) # -O2 # if used, also set --memory-init-file 0 # --memory-init-file 0 # to avoid an external memory initialization code file (.mem) @@ -285,7 +290,8 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) # Compilation functions attributes options CFLAGS += -ffunction-sections -funwind-tables -fstack-protector-strong -fPIC # Compiler options for the linker - CFLAGS += -Wa,--noexecstack -Wformat -Werror=format-security -no-canonical-prefixes + # -Werror=format-security + CFLAGS += -Wa,--noexecstack -Wformat -no-canonical-prefixes # Preprocessor macro definitions CFLAGS += -DANDROID -DPLATFORM_ANDROID -D__ANDROID_API__=16 endif -- cgit v1.2.3 From e86b4d4e03a91bfe37cb525b155af48724664e97 Mon Sep 17 00:00:00 2001 From: RDR8 Date: Sun, 11 Feb 2018 22:58:15 +0000 Subject: Update Makefiles for Linux installation. --- src/Makefile | 136 ++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 87 insertions(+), 49 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 6752d9e7..b44ff462 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,7 +2,7 @@ # # raylib makefile # -# Platforms supported: +# Platforms supported: # PLATFORM_DESKTOP: Windows (Win32, Win64) # PLATFORM_DESKTOP: Linux (32 and 64 bit) # PLATFORM_DESKTOP: OSX/macOS @@ -42,38 +42,52 @@ .PHONY: all clean install uninstall # Define required raylib variables -PLATFORM ?= PLATFORM_DESKTOP -RAYLIB_PATH = .. RAYLIB_VERSION = 1.9.4 RAYLIB_API_VERSION = 1 +RAYLIB_PATH = .. + +# Define default options + +# RAYLIB_RELEASE_PATH points to provided binaries and your immediate build of raylib. +# It is further modified below by PLATFORM below. +RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/release/libs + +# See install target for *_INSTALL_PATH locations. + +# One of PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB +PLATFORM ?= PLATFORM_DESKTOP + # Library type used for raylib: STATIC (.a) or SHARED (.so/.dll) -RAYLIB_LIBTYPE ?= STATIC +RAYLIB_LIBTYPE ?= STATIC + # Build mode for library: DEBUG or RELEASE -RAYLIB_BUILD_MODE ?= RELEASE +RAYLIB_BUILD_MODE ?= RELEASE # Included raylib audio module on compilation # NOTE: Some programs like tools could not require audio support INCLUDE_AUDIO_MODULE ?= TRUE # Use OpenAL Soft backend for audio -USE_OPENAL_BACKEND ?= FALSE +USE_OPENAL_BACKEND ?= FALSE + +# OpenAL Soft audio backend forced on HTML5 and OSX (see below) +ifeq ($(PLATFORM),PLATFORM_WEB) + USE_OPENAL_BACKEND = TRUE +endif # Use external GLFW library instead of rglfw module -USE_EXTERNAL_GLFW ?= FALSE +USE_EXTERNAL_GLFW ?= FALSE # Use Wayland display server protocol on Linux desktop # by default it uses X11 windowing system -USE_WAYLAND_DISPLAY ?= FALSE +USE_WAYLAND_DISPLAY ?= FALSE -# OpenAL Soft audio backend forced on HTML5 and OSX (see below) -ifeq ($(PLATFORM),PLATFORM_WEB) - USE_OPENAL_BACKEND = TRUE -endif +# See below for more GRAPHICS options. # Use cross-compiler for PLATFORM_RPI ifeq ($(PLATFORM),PLATFORM_RPI) USE_RPI_CROSS_COMPILER ?= FALSE - + ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot @@ -138,8 +152,6 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) ANDROID_ARCH ?= ARM endif -RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/release/libs - # Define output directory for compiled library ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) @@ -299,7 +311,7 @@ endif # Define required compilation flags for raylib SHARED lib ifeq ($(RAYLIB_LIBTYPE),SHARED) # make sure code is compiled as position independent - # BE CAREFUL: It seems that for gcc -fpic si not the same as -fPIC + # BE CAREFUL: It seems that for gcc -fpic is not the same as -fPIC # MinGW32 just doesn't need -fPIC, it shows warnings CFLAGS += -fPIC -DBUILD_LIBTYPE_SHARED endif @@ -350,8 +362,8 @@ endif # Define linker options ifeq ($(PLATFORM),PLATFORM_ANDROID) - LDFLAGS = -Wl,-soname,libraylib.$(API_VERSION).so -Wl,--exclude-libs,libatomic.a - LDFLAGS += -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings + LDFLAGS = -Wl,-soname,libraylib.$(API_VERSION).so -Wl,--exclude-libs,libatomic.a + LDFLAGS += -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings # Force linking of library module to define symbol LDFLAGS += -u ANativeActivity_onCreate # Library paths containing required libs @@ -374,7 +386,7 @@ OBJS = core.o \ text.o \ models.o \ utils.o - + ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(USE_EXTERNAL_GLFW),FALSE) OBJS += rglfw.o @@ -419,10 +431,10 @@ else 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 $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).so $(OBJS) -Wl,-soname,libraylib.$(RAYLIB_API_VERSION).so -lGL -lm -lpthread -ldl -lrt - @echo "raylib shared library generated (libraylib.$(RAYLIB_VERSION).so)!" - cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).so libraylib.$(RAYLIB_API_VERSION).so - cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).so libraylib.so + $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so.$(RAYLIB_VERSION) $(OBJS) -shared -Wl,-soname,libraylib.so.$(RAYLIB_API_VERSION) -lGL -lc -lm -lpthread -ldl -lrt + @echo "raylib shared library generated (libraylib.so.$(RAYLIB_VERSION))!" + cd $(RAYLIB_RELEASE_PATH) && ln -fsv libraylib.so.$(RAYLIB_VERSION) libraylib.so.$(RAYLIB_API_VERSION) + cd $(RAYLIB_RELEASE_PATH) && ln -fsv libraylib.so.$(RAYLIB_API_VERSION) libraylib.so endif ifeq ($(PLATFORM_OS),OSX) $(CC) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).dylib $(OBJS) -compatibility_version $(RAYLIB_API_VERSION) -current_version $(RAYLIB_VERSION) -framework OpenGL -framework OpenAL -framework IOKit -framework CoreVideo -framework Cocoa @@ -457,7 +469,7 @@ endif # Compile core module core.o : core.c raylib.h rlgl.h utils.h raymath.h gestures.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) - + # Compile rglfw module rglfw.o : rglfw.c $(CC) $(GLFW_CFLAGS) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -D$(GRAPHICS) @@ -485,10 +497,10 @@ models.o : models.c raylib.h rlgl.h raymath.h # Compile audio module audio.o : audio.c raylib.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) - + # Compile mini_al audio library mini_al.o : external/mini_al.c external/mini_al.h - $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) + $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) # Compile stb_vorbis library stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h @@ -499,49 +511,75 @@ utils.o : utils.c utils.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) # Install generated and needed files to required directories -# TODO: add other platforms. +# TODO: Add other platforms. Remove sudo requirement, i.e. add USER mode. +# On GNU/Linux and BSDs, there are some standard directories that contain extra +# libraries and header files. These directories (often /usr/local/lib and +# /usr/local/include) are for libraries that are installed manually +# (without a package manager). We'll use /usr/local/lib/raysan5 and /usr/local/include/raysan5 +# for our -L and -I specification to simplify management of the raylib source package. +# Customize these locations if you like but don't forget to pass them to make +# for compilation and enable runtime linking with -rpath, LD_LIBRARY_PATH, or ldconfig,. +# Hint: add -L$(RAYLIB_INSTALL_PATH) -I$(RAYLIB_H_INSTALL_PATH) to your own makefiles. +# See below and ../examples/Makefile for more information. + +# RAYLIB_INSTALL_PATH should be the desired full path to libraylib. No relative paths. +RAYLIB_INSTALL_PATH ?= /usr/local/lib/raysan5 +# RAYLIB_H_INSTALL_PATH locates the installed raylib header and associated source files. +RAYLIB_H_INSTALL_PATH ?= /usr/local/include/raysan5 + install : ifeq ($(ROOT),root) + # Attention! You are root. Consult this Makefile for more information." 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 - # manually (without a package manager). - ifeq ($(RAYLIB_LIBTYPE),SHARED) - cp --update $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).so /usr/local/lib/libraylib.$(RAYLIB_VERSION).so - cp --update $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_API_VERSION).so /usr/local/lib/libraylib.$(RAYLIB_API_VERSION).so - cp --update $(RAYLIB_RELEASE_PATH)/libraylib.so /usr/local/lib/libraylib.so - else - cp --update raylib.h /usr/local/include/raylib.h - cp --update $(RAYLIB_RELEASE_PATH)/libraylib.a /usr/local/lib/libraylib.a - endif + # Prepare the environment as needed. + mkdir --parents --verbose $(RAYLIB_INSTALL_PATH) + mkdir --parents --verbose $(RAYLIB_H_INSTALL_PATH) + ifeq ($(RAYLIB_LIBTYPE),SHARED) + # Installing the shared library. + cp --update --verbose $(RAYLIB_RELEASE_PATH)/libraylib.so.$(RAYLIB_VERSION) $(RAYLIB_INSTALL_PATH)/libraylib.so.$(RAYLIB_VERSION) + cd $(RAYLIB_INSTALL_PATH); ln -fsv libraylib.so.$(RAYLIB_VERSION) libraylib.so.$(RAYLIB_API_VERSION) + cd $(RAYLIB_INSTALL_PATH); ln -fsv libraylib.so.$(RAYLIB_API_VERSION) libraylib.so + # Uncomment to update the runtime linker cache with RAYLIB_INSTALL_PATH. + # Not necessary if later embedding RPATH in your executable. See examples/Makefile. + ldconfig $(RAYLIB_INSTALL_PATH) + else + # Installing the static library. + cp --update --verbose $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_INSTALL_PATH)/libraylib.a + endif + # Let's have all the source. + cp --update --recursive $(RAYLIB_PATH)/src/*.h $(RAYLIB_H_INSTALL_PATH)/ + cp --update --recursive $(RAYLIB_PATH)/src/*.c $(RAYLIB_H_INSTALL_PATH)/ + cp --update --recursive $(RAYLIB_PATH)/src/external $(RAYLIB_H_INSTALL_PATH)/ + cp --update --recursive $(RAYLIB_PATH)/release/include/AL $(RAYLIB_H_INSTALL_PATH)/external @echo "raylib dev files installed/updated!" else - @echo "This function works only on GNU/Linux systems" + @echo "This function currently works on GNU/Linux systems. Add yours today (^;" endif else - @echo "Error: no root permissions" + @echo "Error: Root permissions needed for installation. Try sudo make install" endif # Remove raylib dev files installed on the system # TODO: see 'install' target. uninstall : ifeq ($(ROOT),root) + # Warning! You are root. Please confirm that there is nothing here to keep. + # Proceeding will remove everything under the specified locations! ifeq ($(PLATFORM_OS),LINUX) - rm --force /usr/local/include/raylib.h ifeq ($(RAYLIB_LIBTYPE),SHARED) - rm --force /usr/local/lib/libraylib.so - rm --force /usr/local/lib/libraylib.$(RAYLIB_API_VERSION).so - rm --force /usr/local/lib/libraylib.$(RAYLIB_VERSION).so + rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so* + # Uncomment to clean up the runtime linker cache. See install target. + ldconfig else - rm --force /usr/local/lib/libraylib.a + rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.a endif - @echo "raylib development files removed!" + rm --force --interactive=once --recursive $(RAYLIB_H_INSTALL_PATH)/* + @echo "raylib development files removed!" else @echo "This function works only on GNU/Linux systems" endif else - @echo "Error: no root permissions" + @echo "Error: Root permissions needed for uninstallation. Try sudo make uninstall" endif # Clean everything @@ -549,7 +587,7 @@ clean: ifeq ($(PLATFORM_OS),WINDOWS) del *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so external/stb_vorbis.o else - rm -f *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_API_VERSION).so $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).so external/stb_vorbis.o + rm -fv *.o $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_RELEASE_PATH)/libraylib.bc $(RAYLIB_RELEASE_PATH)/libraylib.so* external/stb_vorbis.o endif ifeq ($(PLATFORM),PLATFORM_ANDROID) rm -rf $(ANDROID_TOOLCHAIN) -- cgit v1.2.3 From 4c4b5643925f442ff7d5bcbd8e6670b993d00b10 Mon Sep 17 00:00:00 2001 From: RDR8 Date: Sun, 11 Feb 2018 23:42:22 +0000 Subject: Update Makefiles for Linux installation. See prior commit. These changes are intended to provide context and control over the Linux make install process. make install RAYLIB_LIBTYPE=SHARED now works as expected. libraylib.so is properly installed with attendant runtime links. The examples will be running against the newly installed libraylib.so unless otherwise specified with RAYLIB_RUNTIME_PATH. See raylib/src/Makefile and raylib/examples/Makefile for usage of RAYLIB_INSTALL_PATH, RAYLIB_H_INSTALL_PATH, and RAYLIB_RUNTIME_PATH variables. RAYLIB_RUNTIME_PATH in particular is interesting for portability since sudo isn't needed. The default configuration and workflow is essentially unchanged and unaffected. --- src/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index b44ff462..79bdf97f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -518,7 +518,7 @@ utils.o : utils.c utils.h # (without a package manager). We'll use /usr/local/lib/raysan5 and /usr/local/include/raysan5 # for our -L and -I specification to simplify management of the raylib source package. # Customize these locations if you like but don't forget to pass them to make -# for compilation and enable runtime linking with -rpath, LD_LIBRARY_PATH, or ldconfig,. +# for compilation and enable runtime linking with -rpath, LD_LIBRARY_PATH, or ldconfig. # Hint: add -L$(RAYLIB_INSTALL_PATH) -I$(RAYLIB_H_INSTALL_PATH) to your own makefiles. # See below and ../examples/Makefile for more information. @@ -568,6 +568,8 @@ ifeq ($(ROOT),root) ifeq ($(PLATFORM_OS),LINUX) ifeq ($(RAYLIB_LIBTYPE),SHARED) rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so* + rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so.$(RAYLIB_API_VERSION) + rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so.$(RAYLIB_VERSION) # Uncomment to clean up the runtime linker cache. See install target. ldconfig else -- cgit v1.2.3 From 5616314069829877301312add7c3b55ba4042eac Mon Sep 17 00:00:00 2001 From: RDR8 Date: Mon, 12 Feb 2018 00:15:58 +0000 Subject: Update Makefile --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 79bdf97f..61206a3d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -567,7 +567,7 @@ ifeq ($(ROOT),root) # Proceeding will remove everything under the specified locations! ifeq ($(PLATFORM_OS),LINUX) ifeq ($(RAYLIB_LIBTYPE),SHARED) - rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so* + rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so.$(RAYLIB_API_VERSION) rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so.$(RAYLIB_VERSION) # Uncomment to clean up the runtime linker cache. See install target. -- cgit v1.2.3 From f742f1289d9e00c8d09a5a6dc4c36efaa0e10d67 Mon Sep 17 00:00:00 2001 From: RDR8 Date: Mon, 12 Feb 2018 05:17:02 +0000 Subject: Update Makefile --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 61206a3d..f8f9635b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -529,7 +529,7 @@ RAYLIB_H_INSTALL_PATH ?= /usr/local/include/raysan5 install : ifeq ($(ROOT),root) - # Attention! You are root. Consult this Makefile for more information." + # Attention! You are root. Consult this Makefile for more information. ifeq ($(PLATFORM_OS),LINUX) # Prepare the environment as needed. mkdir --parents --verbose $(RAYLIB_INSTALL_PATH) -- cgit v1.2.3 From 97bf2706c497f90ea4e3ead4e69819bc7a1f6083 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 21 Feb 2018 23:28:34 +0100 Subject: Removed flag -fgnu89-inline --- src/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index f8f9635b..f7494912 100644 --- a/src/Makefile +++ b/src/Makefile @@ -270,11 +270,10 @@ endif # -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 and PLATFORM_WEB, required for timespec # -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers -CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -fgnu89-inline -Wno-missing-braces -Werror=pointer-arith +CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Werror=pointer-arith ifeq ($(RAYLIB_BUILD_MODE), DEBUG) CFLAGS += -g -- cgit v1.2.3 From 2b5fc120360baae6903c4d4c8b411b726927cbce Mon Sep 17 00:00:00 2001 From: RDR8 Date: Wed, 21 Feb 2018 19:34:08 -0600 Subject: Update Makefiles. Enable example usage of staged libraylib.so. --- src/Makefile | 108 +++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 68 insertions(+), 40 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index f7494912..e001b4ef 100644 --- a/src/Makefile +++ b/src/Makefile @@ -44,16 +44,12 @@ # Define required raylib variables RAYLIB_VERSION = 1.9.4 RAYLIB_API_VERSION = 1 + +# See below for alternatives. RAYLIB_PATH = .. # Define default options -# RAYLIB_RELEASE_PATH points to provided binaries and your immediate build of raylib. -# It is further modified below by PLATFORM below. -RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/release/libs - -# See install target for *_INSTALL_PATH locations. - # One of PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB PLATFORM ?= PLATFORM_DESKTOP @@ -76,6 +72,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB) endif # Use external GLFW library instead of rglfw module +# TODO: Review usage of examples on Linux. USE_EXTERNAL_GLFW ?= FALSE # Use Wayland display server protocol on Linux desktop @@ -84,10 +81,13 @@ USE_WAYLAND_DISPLAY ?= FALSE # See below for more GRAPHICS options. +# See below for RAYLIB_RELEASE_PATH. + +# See install target for *_INSTALL_PATH locations. + # Use cross-compiler for PLATFORM_RPI ifeq ($(PLATFORM),PLATFORM_RPI) USE_RPI_CROSS_COMPILER ?= FALSE - ifeq ($(USE_RPI_CROSS_COMPILER),TRUE) RPI_TOOLCHAIN ?= C:/SysGCC/Raspberry RPI_TOOLCHAIN_SYSROOT ?= $(RPI_TOOLCHAIN)/arm-linux-gnueabihf/sysroot @@ -125,6 +125,23 @@ ifeq ($(PLATFORM),PLATFORM_RPI) endif endif +# RAYLIB_PATH adjustment for different platforms. +# If using GNU make, we can get the full path to the top of the tree. Windows? BSD? +# Required for ldconfig or other tools that do not perform path expansion. +ifeq ($(PLATFORM),PLATFORM_DESKTOP) + ifeq ($(PLATFORM_OS),LINUX) + RAYLIB_PREFIX ?= .. + RAYLIB_PATH = $(realpath $(RAYLIB_PREFIX)) + endif +endif +# Default path for raylib on Raspberry Pi, if installed in different path, update it! +# TODO: update install: target in src/Makefile for RPI, consider relation to LINUX. +# WARNING: The following is copied from examples/Makefile and is here only for reference. +# Consequences of enabling this are UNKNOWN. Please test and report. +#ifeq ($(PLATFORM),PLATFORM_RPI) +# RAYLIB_PATH ?= /home/pi/raylib +#endif + # Force OpenAL Soft audio backend for OSX platform # NOTE 1: mini_al library does not support CoreAudio yet # NOTE 2: Required OpenAL libraries should be available on OSX @@ -152,6 +169,10 @@ ifeq ($(PLATFORM),PLATFORM_ANDROID) ANDROID_ARCH ?= ARM endif +# RAYLIB_RELEASE_PATH points to provided binaries or your immediate build of raylib. +# It is further modified below by PLATFORM below. +RAYLIB_RELEASE_PATH ?= $(RAYLIB_PATH)/release/libs + # Define output directory for compiled library ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),WINDOWS) @@ -189,17 +210,14 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) #GRAPHICS = GRAPHICS_API_OPENGL_11 # Uncomment to use OpenGL 1.1 #GRAPHICS = GRAPHICS_API_OPENGL_21 # Uncomment to use OpenGL 2.1 endif - ifeq ($(PLATFORM),PLATFORM_RPI) # On RPI OpenGL ES 2.0 must be used GRAPHICS = GRAPHICS_API_OPENGL_ES2 endif - ifeq ($(PLATFORM),PLATFORM_WEB) # On HTML5 OpenGL ES 2.0 is used, emscripten translates it to WebGL 1.0 GRAPHICS = GRAPHICS_API_OPENGL_ES2 endif - ifeq ($(PLATFORM),PLATFORM_ANDROID) # By default use OpenGL ES 2.0 on Android GRAPHICS = GRAPHICS_API_OPENGL_ES2 @@ -277,6 +295,7 @@ CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Werror=point ifeq ($(RAYLIB_BUILD_MODE), DEBUG) CFLAGS += -g + #CC = clang endif # Additional flags for compiler (if desired) @@ -339,13 +358,15 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) LDFLAGS += -L. -Lsrc -L/usr/local/lib -L$(RAYLIB_RELEASE_PATH) endif ifeq ($(USE_EXTERNAL_GLFW),TRUE) + # Check the version name. If GLFW3 was built manually, it may have produced + # a static library known as libglfw3.a. In that case, the name should be -lglfw3 LDFLAGS += -lglfw endif endif # Define additional directories containing required header files ifeq ($(PLATFORM),PLATFORM_RPI) - # RPI requried libraries + # RPI required libraries INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vmcs_host/linux INCLUDE_PATHS += -I$(RPI_TOOLCHAIN_SYSROOT)/opt/vc/include/interface/vcos/pthreads @@ -428,10 +449,10 @@ else @echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!" endif ifeq ($(PLATFORM_OS),LINUX) - # Compile raylib to shared library version for GNU/Linux. - # WARNING: you should type "make clean" before doing this target + # Compile raylib shared library version $(RAYLIB_VERSION). + # WARNING: you should type "make clean" before doing this target $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so.$(RAYLIB_VERSION) $(OBJS) -shared -Wl,-soname,libraylib.so.$(RAYLIB_API_VERSION) -lGL -lc -lm -lpthread -ldl -lrt - @echo "raylib shared library generated (libraylib.so.$(RAYLIB_VERSION))!" + @echo "raylib shared library generated (libraylib.so.$(RAYLIB_VERSION)) in $(RAYLIB_RELEASE_PATH)!" cd $(RAYLIB_RELEASE_PATH) && ln -fsv libraylib.so.$(RAYLIB_VERSION) libraylib.so.$(RAYLIB_API_VERSION) cd $(RAYLIB_RELEASE_PATH) && ln -fsv libraylib.so.$(RAYLIB_API_VERSION) libraylib.so endif @@ -443,7 +464,7 @@ else cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).dylib libraylib.dylib endif ifeq ($(PLATFORM_OS),FREEBSD) - # WARNING: you should type "gmake clean" before doing this target + # WARNING: you should type "gmake clean" before doing this target $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).so $(OBJS) -Wl,-soname,libraylib.$(RAYLIB_API_VERSION).so -lGL -lpthread @echo "raylib shared library generated (libraylib.$(RAYLIB_VERSION).so)!" cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).so libraylib.$(RAYLIB_API_VERSION).so @@ -456,10 +477,10 @@ else cd $(RAYLIB_RELEASE_PATH) && ln -fs libraylib.$(RAYLIB_VERSION).so libraylib.so endif else - # Compile raylib static library - @echo raylib library release path is $(RAYLIB_RELEASE_PATH) + # Compile raylib static library version $(RAYLIB_VERSION) + # WARNING: You should type "make clean" before doing this target. $(AR) rcs $(RAYLIB_RELEASE_PATH)/libraylib.a $(OBJS) - @echo "raylib static library generated (libraylib.a)!" + @echo "raylib static library generated (libraylib.a) in $(RAYLIB_RELEASE_PATH)!" endif endif @@ -509,8 +530,7 @@ stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h utils.o : utils.c utils.h $(CC) -c $< $(CFLAGS) $(INCLUDE_PATHS) -D$(PLATFORM) -# Install generated and needed files to required directories -# TODO: Add other platforms. Remove sudo requirement, i.e. add USER mode. +# Install generated and needed files to desired directories. # On GNU/Linux and BSDs, there are some standard directories that contain extra # libraries and header files. These directories (often /usr/local/lib and # /usr/local/include) are for libraries that are installed manually @@ -520,37 +540,41 @@ utils.o : utils.c utils.h # for compilation and enable runtime linking with -rpath, LD_LIBRARY_PATH, or ldconfig. # Hint: add -L$(RAYLIB_INSTALL_PATH) -I$(RAYLIB_H_INSTALL_PATH) to your own makefiles. # See below and ../examples/Makefile for more information. +# TODO: Add other platforms. Remove sudo requirement, i.e. add USER mode. # RAYLIB_INSTALL_PATH should be the desired full path to libraylib. No relative paths. -RAYLIB_INSTALL_PATH ?= /usr/local/lib/raysan5 +DESTDIR ?= /usr/local +RAYLIB_INSTALL_PATH ?= $(DESTDIR)/lib # RAYLIB_H_INSTALL_PATH locates the installed raylib header and associated source files. -RAYLIB_H_INSTALL_PATH ?= /usr/local/include/raysan5 +RAYLIB_H_INSTALL_PATH ?= $(DESTDIR)/include install : ifeq ($(ROOT),root) - # Attention! You are root. Consult this Makefile for more information. ifeq ($(PLATFORM_OS),LINUX) + # Attention! You are root, writing files to $(RAYLIB_INSTALL_PATH) + # and $(RAYLIB_H_INSTALL_PATH). Consult this Makefile for more information. # Prepare the environment as needed. mkdir --parents --verbose $(RAYLIB_INSTALL_PATH) mkdir --parents --verbose $(RAYLIB_H_INSTALL_PATH) ifeq ($(RAYLIB_LIBTYPE),SHARED) - # Installing the shared library. + # Installing raylib to $(RAYLIB_INSTALL_PATH). cp --update --verbose $(RAYLIB_RELEASE_PATH)/libraylib.so.$(RAYLIB_VERSION) $(RAYLIB_INSTALL_PATH)/libraylib.so.$(RAYLIB_VERSION) cd $(RAYLIB_INSTALL_PATH); ln -fsv libraylib.so.$(RAYLIB_VERSION) libraylib.so.$(RAYLIB_API_VERSION) cd $(RAYLIB_INSTALL_PATH); ln -fsv libraylib.so.$(RAYLIB_API_VERSION) libraylib.so - # Uncomment to update the runtime linker cache with RAYLIB_INSTALL_PATH. - # Not necessary if later embedding RPATH in your executable. See examples/Makefile. + # Uncomment to update the runtime linker cache with RAYLIB_INSTALL_PATH. + # Not necessary if later embedding RPATH in your executable. See examples/Makefile. ldconfig $(RAYLIB_INSTALL_PATH) else - # Installing the static library. + # Installing raylib to $(RAYLIB_INSTALL_PATH). cp --update --verbose $(RAYLIB_RELEASE_PATH)/libraylib.a $(RAYLIB_INSTALL_PATH)/libraylib.a endif - # Let's have all the source. - cp --update --recursive $(RAYLIB_PATH)/src/*.h $(RAYLIB_H_INSTALL_PATH)/ - cp --update --recursive $(RAYLIB_PATH)/src/*.c $(RAYLIB_H_INSTALL_PATH)/ - cp --update --recursive $(RAYLIB_PATH)/src/external $(RAYLIB_H_INSTALL_PATH)/ - cp --update --recursive $(RAYLIB_PATH)/release/include/AL $(RAYLIB_H_INSTALL_PATH)/external - @echo "raylib dev files installed/updated!" + # Copying raylib development files to $(RAYLIB_H_INSTALL_PATH). + cp --update raylib.h $(RAYLIB_H_INSTALL_PATH)/raylib.h + cp --update raymath.h $(RAYLIB_H_INSTALL_PATH)/raymath.h + cp --update rlgl.h $(RAYLIB_H_INSTALL_PATH)/rlgl.h + cp --update rlgl.c $(RAYLIB_H_INSTALL_PATH)/rlgl.c + cp --update physac.h $(RAYLIB_H_INSTALL_PATH)/physac.h + @echo "raylib development files installed/updated!" else @echo "This function currently works on GNU/Linux systems. Add yours today (^;" endif @@ -562,22 +586,26 @@ endif # TODO: see 'install' target. uninstall : ifeq ($(ROOT),root) - # Warning! You are root. Please confirm that there is nothing here to keep. - # Proceeding will remove everything under the specified locations! + # WARNING: You are root, about to delete items from $(RAYLIB_INSTALL_PATH). + # and $(RAYLIB_H_INSTALL_PATH). Please confirm each item. ifeq ($(PLATFORM_OS),LINUX) ifeq ($(RAYLIB_LIBTYPE),SHARED) rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so.$(RAYLIB_API_VERSION) rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.so.$(RAYLIB_VERSION) - # Uncomment to clean up the runtime linker cache. See install target. + # Uncomment to clean up the runtime linker cache. See install target. ldconfig else rm --force --interactive --verbose $(RAYLIB_INSTALL_PATH)/libraylib.a endif - rm --force --interactive=once --recursive $(RAYLIB_H_INSTALL_PATH)/* - @echo "raylib development files removed!" - else - @echo "This function works only on GNU/Linux systems" + rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/raylib.h + rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/raymath.h + rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/rlgl.h + rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/rlgl.c + rm --force --interactive --verbose $(RAYLIB_H_INSTALL_PATH)/physac.h + @echo "raylib development files removed!" + else + @echo "This function currently works on GNU/Linux systems. Add yours today (^;" endif else @echo "Error: Root permissions needed for uninstallation. Try sudo make uninstall" -- cgit v1.2.3 From 1430d0190684c6f78e1bce759eae240c94fba61c Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Sat, 24 Feb 2018 23:46:27 +0100 Subject: jar_xm: Workaround for unaligned pointer accesses jar_xm.h does some shady pointer casts leading to unaligned accesses and breaking strict aliasing. x86 has special circuitry for doing unaligned accesses, but on other architectures, it may trap and require kernel fix-up or crash outright. With this patch, one obstacle in porting raylib to the GameBoy Advance has been removed. Go for it ;-) To avoid having to rewrite that `mempool' code, insert padding before structs and instruct the compiler (GCC, most importantly), to be gentle when optimizing. This fixes #490 (Unless we got ourselves 256-bit pointers, if so, hello future!) --- src/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index e001b4ef..53551174 100644 --- a/src/Makefile +++ b/src/Makefile @@ -291,7 +291,9 @@ endif # -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers -CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Werror=pointer-arith +# -fno-strict-aliasing jar_xm.h does shady stuff (breaks strict aliasing) +CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Werror=pointer-arith +-fno-strict-aliasing ifeq ($(RAYLIB_BUILD_MODE), DEBUG) CFLAGS += -g -- cgit v1.2.3 From 18f61948ce5154b01f2b3f1532fec0451184f485 Mon Sep 17 00:00:00 2001 From: RDR8 Date: Sun, 25 Feb 2018 15:21:54 -0600 Subject: Update Makefile $ make clean Makefile:296: *** missing separator. Stop. --- src/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 53551174..7837b614 100644 --- a/src/Makefile +++ b/src/Makefile @@ -292,8 +292,7 @@ endif # -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec # -Werror=pointer-arith catch unportable code that does direct arithmetic on void pointers # -fno-strict-aliasing jar_xm.h does shady stuff (breaks strict aliasing) -CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Werror=pointer-arith --fno-strict-aliasing +CFLAGS += -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing ifeq ($(RAYLIB_BUILD_MODE), DEBUG) CFLAGS += -g -- cgit v1.2.3