diff options
| author | LelixSuper <emanuele98@openmailbox.org> | 2016-07-16 18:38:17 +0200 |
|---|---|---|
| committer | LelixSuper <emanuele98@openmailbox.org> | 2016-07-16 18:38:17 +0200 |
| commit | 6f335d2c9ea346c44f4000424cc389fd8db6a035 (patch) | |
| tree | 1013cb02d823262086f7c14f686911c44b8aa6be /src | |
| parent | f685acd69ed1fa6cd8e4408037d513ad24e0c344 (diff) | |
| download | raylib-6f335d2c9ea346c44f4000424cc389fd8db6a035.tar.gz raylib-6f335d2c9ea346c44f4000424cc389fd8db6a035.zip | |
add 'install' and 'unistall' target
The first target allow makefile to install the dev files (static library and
header) to standard directories on GNU/Linux platforms; the second allow it to
unistall (remove) the dev files.
It needs lot of improvements.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/src/Makefile b/src/Makefile index b0ddadad..c294a813 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 ifeq ($(PLATFORM),PLATFORM_DESKTOP) # 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 : +ifeq ($(ROOT),root) + 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 +else + @echo "Error: no root permissions" +endif + +# it removes raylib dev files installed on the system. +# TODO: see 'install' target. +unistall : +ifeq ($(ROOT),root) + 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 +else + @echo "Error: no root permissions" +endif + # clean everything clean: ifeq ($(PLATFORM),PLATFORM_DESKTOP) |
