From 6809380d3dea773ce3054402f91f105e75be0abf Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Mon, 29 May 2017 19:00:53 +0200 Subject: Accept external CFLAGS Some distributions build the programs with a specific set of CFLAGS. Lets allow that by adding raylibs flags. --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 1eac71f6..6579d424 100644 --- a/src/Makefile +++ b/src/Makefile @@ -198,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 -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 8f569e59b177e879fe350027a706c6f731f86c4a Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 17 Jul 2017 14:16:23 +0200 Subject: Review shared library generation --- src/Makefile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 6579d424..35949d89 100644 --- a/src/Makefile +++ b/src/Makefile @@ -215,7 +215,6 @@ endif ifeq ($(SHARED_RAYLIB),YES) CFLAGS += -fPIC SHAREDFLAG = BUILDING_DLL - SHAREDLIBS = -Lexternal/glfw3/lib/win32 -Lexternal/openal_soft/lib/win32 -lglfw3 -lgdi32 else SHAREDFLAG = BUILDING_STATIC endif @@ -317,15 +316,20 @@ ifeq ($(PLATFORM),PLATFORM_WEB) @echo "libraylib.bc generated (web version)!" else ifeq ($(SHARED_RAYLIB),YES) + # 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 + @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 - $(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS) - @echo "raylib shared library (libraylib.so) generated!" + $(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS) -lglfw3 -lGL -lopenal -lm -lpthread -ldl + @echo "raylib shared library generated (libraylib.so)!" endif - ifeq ($(PLATFORM_OS),WINDOWS) - $(CC) -shared -o $(OUTPUT_PATH)/raylib.dll $(OBJS) $(SHAREDLIBS) -Wl,--out-implib,$(OUTPUT_PATH)/libraylibdll.a - @echo "raylib dynamic library (raylib.dll) and import library (libraylibdll.a) generated!" + ifeq ($(PLATFORM_OS),OSX) + $(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS) -lglfw -framework OpenGL -framework OpenAL -framework Cocoa + @echo "raylib shared library generated (libraylib.so)!" endif ifeq ($(PLATFORM),PLATFORM_ANDROID) $(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS) -- cgit v1.2.3 From ba32d6a753877da5c22d223e794701f087cd7654 Mon Sep 17 00:00:00 2001 From: "Benjamin N. Summerton" Date: Tue, 18 Jul 2017 22:23:43 -0400 Subject: Able to make a .dylib for OS X --- src/Makefile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index 35949d89..6d0318c1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -145,6 +145,14 @@ endif # default gcc compiler CC = gcc + +# For OS X +ifeq ($(PLATFORM),PLATFORM_DESKTOP) + ifeq ($(PLATFORM_OS),OSX) + CC = clang + endif +endif + # Android toolchain compiler ifeq ($(PLATFORM),PLATFORM_ANDROID) ifeq ($(ANDROID_ARCH),ARM) @@ -328,8 +336,9 @@ else @echo "raylib shared library generated (libraylib.so)!" endif ifeq ($(PLATFORM_OS),OSX) - $(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS) -lglfw -framework OpenGL -framework OpenAL -framework Cocoa - @echo "raylib shared library generated (libraylib.so)!" + $(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 + @echo "raylib shared library generated (libraylib.dylib)!" endif ifeq ($(PLATFORM),PLATFORM_ANDROID) $(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS) -- cgit v1.2.3