|
@@ -58,6 +58,9 @@ RAYLIB_LIBTYPE ?= STATIC
|
|
|
# Build mode for library: DEBUG or RELEASE
|
|
|
RAYLIB_BUILD_MODE ?= RELEASE
|
|
|
|
|
|
+# Build architecture (x86: 32bit or x64: 64bit)
|
|
|
+RAYLIB_BUILD_ARCH ?= x86
|
|
|
+
|
|
|
# Define raylib platform
|
|
|
# Options: PLATFORM_DESKTOP, PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
|
|
PLATFORM ?= PLATFORM_DESKTOP
|
|
@@ -80,12 +83,6 @@ USE_EXTERNAL_GLFW ?= FALSE
|
|
|
# by default it uses X11 windowing system
|
|
|
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
|
|
@@ -213,6 +210,14 @@ endif
|
|
|
CC = gcc
|
|
|
AR = ar
|
|
|
|
|
|
+# GCC could support multilib building for x86 (-m32) and x64 (-m64)
|
|
|
+ifeq ($(CC), gcc)
|
|
|
+ ARCH = -m32
|
|
|
+ ifeq ($(RAYLIB_BUILD_ARCH),x64)
|
|
|
+ ARCH = -m64
|
|
|
+ endif
|
|
|
+endif
|
|
|
+
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|
|
ifeq ($(PLATFORM_OS),OSX)
|
|
|
# OSX default compiler
|
|
@@ -268,7 +273,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 += -Wall -D_DEFAULT_SOURCE -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing
|
|
|
+CFLAGS += $(ARCH) -Wall -D_DEFAULT_SOURCE -Wno-missing-braces -Werror=pointer-arith -fno-strict-aliasing
|
|
|
|
|
|
ifeq ($(PLATFORM), PLATFORM_WEB)
|
|
|
CFLAGS += -std=gnu99
|
|
@@ -276,8 +281,8 @@ else
|
|
|
CFLAGS += -std=c99
|
|
|
endif
|
|
|
|
|
|
-ifeq ($(PLATFORM_OS),LINUX)
|
|
|
- CFLAGS += -fPIC
|
|
|
+ifeq ($(PLATFORM_OS), LINUX)
|
|
|
+ CFLAGS += -fPIC
|
|
|
endif
|
|
|
|
|
|
ifeq ($(RAYLIB_BUILD_MODE),DEBUG)
|
|
@@ -458,19 +463,19 @@ else
|
|
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
|
|
# TODO: Compile resource file raylib.dll.rc for linkage on raylib.dll generation
|
|
|
- $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) $(RAYLIB_SRC_PATH)/raylib.dll.rc.data -L$(RAYLIB_RELEASE_PATH) -static-libgcc -lopengl32 -lgdi32 -lwinmm -Wl,--out-implib,$(RAYLIB_RELEASE_PATH)/libraylibdll.a
|
|
|
+ $(CC) $(ARCH) -shared -o $(RAYLIB_RELEASE_PATH)/raylib.dll $(OBJS) $(RAYLIB_SRC_PATH)/raylib.dll.rc.data -static-libgcc -lopengl32 -lgdi32 -lwinmm -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 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) -Wl,-soname,libraylib.so.$(RAYLIB_API_VERSION) -lGL -lc -lm -lpthread -ldl -lrt $(LDLIBS)
|
|
|
+ $(CC) $(ARCH) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so.$(RAYLIB_VERSION) $(OBJS) -Wl,-soname,libraylib.so.$(RAYLIB_API_VERSION) -lGL -lc -lm -lpthread -ldl -lrt $(LDLIBS)
|
|
|
@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
|
|
|
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 Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
|
|
|
+ $(CC) $(ARCH) -dynamiclib -o $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).dylib $(OBJS) -compatibility_version $(RAYLIB_API_VERSION) -current_version $(RAYLIB_VERSION) -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
|
|
|
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
|
|
@@ -478,7 +483,7 @@ else
|
|
|
endif
|
|
|
ifeq ($(PLATFORM_OS),BSD)
|
|
|
# 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
|
|
|
+ $(CC) $(ARCH) -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
|
|
@@ -487,13 +492,13 @@ else
|
|
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
|
|
# 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) -Wl,-soname,libraylib.so.$(RAYLIB_API_VERSION) -L/opt/vc/lib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
|
|
|
+ $(CC) $(ARCH) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.so.$(RAYLIB_VERSION) $(OBJS) -Wl,-soname,libraylib.so.$(RAYLIB_API_VERSION) -L/opt/vc/lib -lbrcmGLESv2 -lbrcmEGL -lpthread -lrt -lm -lbcm_host -ldl
|
|
|
@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
|
|
|
ifeq ($(PLATFORM),PLATFORM_ANDROID)
|
|
|
- $(CC) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS)
|
|
|
+ $(CC) $(ARCH) -shared -o $(RAYLIB_RELEASE_PATH)/libraylib.$(RAYLIB_VERSION).so $(OBJS) $(LDFLAGS) $(LDLIBS)
|
|
|
@echo "raylib shared library generated (libraylib.$(RAYLIB_VERSION).so)!"
|
|
|
# WARNING: symbolic links creation on Windows should be done using mklink command, no ln available
|
|
|
ifeq ($(HOST_PLATFORM_OS),LINUX)
|