@ -24,12 +24,15 @@
#
#******************************************************************************
.PHONY : all clean
.PHONY : all clean install unistall
# define raylib platform to compile for
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
PLATFORM ?= PLATFORM_DESKTOP
# determine if the file has root access (only for installing raylib)
ROOT = $( shell whoami)
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected
i f e q ( $( PLATFORM ) , P L A T F O R M _ D E S K T O P )
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
@ -103,25 +106,17 @@ OBJS = core.o rlgl.o shapes.o text.o textures.o models.o audio.o utils.o \
camera.o gestures.o stb_vorbis.o
# typing 'make', it will invoke the first target on the file.
# 'all' target compile raylib into static, web and dynamic library versions .
# WIP: allow compiling of other versions .
# The target 'all' compile raylib into static, web and dynamic library.
# TODO: add possibility to compile web and dynamic version of raylib .
all : libraylib .a
# compile raylib static library for desktop platforms
libraylib.a : $( OBJS )
ar rcs libraylib.a $( OBJS)
@echo "\t** libraylib.a generated!** "
@echo "libraylib.a generated (static library) !"
libraylib.bc : $( OBJS )
emcc -O1 $( OBJS) -o libraylib.bc
# compile raylib library
# raylib: $(OBJS)
# ifeq ($(PLATFORM),PLATFORM_WEB)
# emcc -O1 $(OBJS) -o libraylib.bc
#else
# ar rcs libraylib.a $(OBJS)
#endif
@echo "libraylib.bc generated (web version)!"
# compile core module
# emcc core.c -o core.bc -DPLATFORM_DESKTOP
@ -168,6 +163,37 @@ gestures.o: gestures.c
stb_vorbis.o : external /stb_vorbis .c
$( CC) -c external/stb_vorbis.c -O1 $( INCLUDES) -D$( PLATFORM)
# It installs (copy) raylib dev files (static library and header) to standard
# directories on GNU/Linux platform.
# TODO: add other platforms.
install :
i f e q ( $( ROOT ) , r o o t )
ifeq ( $( UNAMEOS) ,Linux)
cp --update libraylib.a /usr/local/lib/libraylib.a
cp --update raylib.h /usr/local/include/raylib.h
@echo "raylib dev files installed/updated!"
else
@echo "This function works only on GNU/Linux systems"
endif
e l s e
@echo "Error: no root permissions"
e n d i f
# it removes raylib dev files installed on the system.
# TODO: see 'install' target.
unistall :
i f e q ( $( ROOT ) , r o o t )
ifeq ( $( UNAMEOS) ,Linux)
rm --force /usr/local/lib/libraylib.a
rm --force /usr/local/include/raylib.h
@echo "raylib dev files removed!"
else
@echo "This function works only on GNU/Linux systems"
endif
e l s e
@echo "Error: no root permissions"
e n d i f
# clean everything
clean :
i f e q ( $( PLATFORM ) , P L A T F O R M _ D E S K T O P )