mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-25 16:49:18 -05:00
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.
This commit is contained in:
52
src/Makefile
52
src/Makefile
@ -24,12 +24,15 @@
|
|||||||
#
|
#
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean install unistall
|
||||||
|
|
||||||
# define raylib platform to compile for
|
# define raylib platform to compile for
|
||||||
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
|
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
|
||||||
PLATFORM ?= PLATFORM_DESKTOP
|
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
|
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
# No uname.exe on MinGW!, but OS=Windows_NT on Windows!
|
# 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
|
camera.o gestures.o stb_vorbis.o
|
||||||
|
|
||||||
# typing 'make', it will invoke the first target on the file.
|
# typing 'make', it will invoke the first target on the file.
|
||||||
# 'all' target compile raylib into static, web and dynamic library versions.
|
# The target 'all' compile raylib into static, web and dynamic library.
|
||||||
# WIP: allow compiling of other versions.
|
# TODO: add possibility to compile web and dynamic version of raylib.
|
||||||
all: libraylib.a
|
all: libraylib.a
|
||||||
|
|
||||||
# compile raylib static library for desktop platforms
|
# compile raylib static library for desktop platforms
|
||||||
libraylib.a : $(OBJS)
|
libraylib.a : $(OBJS)
|
||||||
ar rcs libraylib.a $(OBJS)
|
ar rcs libraylib.a $(OBJS)
|
||||||
@echo "\t**libraylib.a generated!**"
|
@echo "libraylib.a generated (static library)!"
|
||||||
|
|
||||||
libraylib.bc : $(OBJS)
|
libraylib.bc : $(OBJS)
|
||||||
emcc -O1 $(OBJS) -o libraylib.bc
|
emcc -O1 $(OBJS) -o libraylib.bc
|
||||||
|
@echo "libraylib.bc generated (web version)!"
|
||||||
# compile raylib library
|
|
||||||
# raylib: $(OBJS)
|
|
||||||
# ifeq ($(PLATFORM),PLATFORM_WEB)
|
|
||||||
# emcc -O1 $(OBJS) -o libraylib.bc
|
|
||||||
#else
|
|
||||||
# ar rcs libraylib.a $(OBJS)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# compile core module
|
# compile core module
|
||||||
# emcc core.c -o core.bc -DPLATFORM_DESKTOP
|
# emcc core.c -o core.bc -DPLATFORM_DESKTOP
|
||||||
@ -168,6 +163,37 @@ gestures.o: gestures.c
|
|||||||
stb_vorbis.o: external/stb_vorbis.c
|
stb_vorbis.o: external/stb_vorbis.c
|
||||||
$(CC) -c external/stb_vorbis.c -O1 $(INCLUDES) -D$(PLATFORM)
|
$(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 everything
|
||||||
clean:
|
clean:
|
||||||
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
|||||||
Reference in New Issue
Block a user