aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2017-10-28 22:22:04 +0200
committerGitHub <noreply@github.com>2017-10-28 22:22:04 +0200
commit52cd0395b405b3b4f4d61adfd5a3aa3c43eda53c (patch)
tree6a68626bb129fe45f753f032e4a0a202c06f00e3
parentab01cd45bcea6942e3ba62fd32996b374de7e1c9 (diff)
parentf8971691603aa1d5379ed623d22e2138f6b353cd (diff)
downloadraylib-52cd0395b405b3b4f4d61adfd5a3aa3c43eda53c.tar.gz
raylib-52cd0395b405b3b4f4d61adfd5a3aa3c43eda53c.zip
Merge pull request #373 from Martinfx/master
Added support FreeBSD
-rw-r--r--examples/Makefile30
-rw-r--r--src/Makefile26
2 files changed, 52 insertions, 4 deletions
diff --git a/examples/Makefile b/examples/Makefile
index edcff807..1557da92 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -54,12 +54,16 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX
LIBPATH=linux
- else
+ endif
+ UNAMEOS=$(shell uname)
+ ifeq ($(UNAMEOS),FreeBSD)
+ PLATFORM_OS=FREEBSD
+ LIBPATH=linux
+ endif
ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS=OSX
LIBPATH=osx
endif
- endif
endif
endif
@@ -90,6 +94,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/osx
endif
+ ifeq ($(PLATFORM_OS),FREEBSD)
+ RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/freebsd
+ endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/libs/html5
@@ -106,6 +113,10 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# OSX default compiler
CC = clang
endif
+ ifeq ($(PLATFORM_OS),FREEBSD)
+ # FreeBSD default compiler
+ CC = clang
+ endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
ifeq ($(RPI_CROSS_COMPILE),YES)
@@ -178,6 +189,13 @@ endif
# Define library paths containing required libs
LDFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src
+ifeq ($(PLATFORM),PLATFORM_DESKTOP)
+ ifeq ($(PLATFORM_OS),FREEBSD)
+ INCLUDE_PATHS += -I/usr/local/include
+ LDFLAGS += -L. -Lsrc -L/usr/local/lib
+ endif
+endif
+
ifeq ($(PLATFORM),PLATFORM_RPI)
LDFLAGS += -L/opt/vc/lib
endif
@@ -215,6 +233,14 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# NOTE: Required packages: libglfw3-dev libopenal-dev libegl1-mesa-dev
LDLIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa
endif
+ ifeq ($(PLATFORM_OS),FREEBSD)
+ # Libraries for FreeBSD desktop compiling
+ # NOTE: Required packages: glfw openal-soft mesa-libs
+ LDLIBS = -lraylib -lglfw -lGL -lopenal -lpthread -lm
+
+ # On XWindow requires also below libraries
+ LDLIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
+ endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
# Libraries for Raspberry Pi compiling
diff --git a/src/Makefile b/src/Makefile
index 13be7844..176991bb 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)
+ # 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,11 @@ else
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
+ @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)!"