From b3110c14feee4036e5504b2a16b2b8e506fc9b7a Mon Sep 17 00:00:00 2001 From: Martinfx Date: Sat, 28 Oct 2017 17:30:02 +0200 Subject: [PATCH] Added support FreeBSD --- src/Makefile | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) 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)!"