From 47c7f3624f187db057cd5a05a46247f99730c7b2 Mon Sep 17 00:00:00 2001 From: Martinfx Date: Sat, 28 Oct 2017 18:41:29 +0200 Subject: [PATCH] Added support FreeBSD for example --- examples/Makefile | 33 +++++++++++++++++++++++++++++++-- src/Makefile | 5 ++--- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/examples/Makefile b/examples/Makefile index edcff8072..cc8e0e012 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) @@ -150,6 +161,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM_OS),LINUX) CFLAGS += -no-pie -D_DEFAULT_SOURCE endif + #ifeq ($(PLATFORM_OS),FREEBSD) + # CFLAGS += -D_DEFAULT_SOURCE + #endif endif ifeq ($(PLATFORM),PLATFORM_RPI) CFLAGS += -std=gnu99 @@ -178,6 +192,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 +236,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 14d9760db..176991bb6 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