improve the compilation of all modules

This commit is contained in:
LelixSuper
2016-07-16 21:01:43 +02:00
parent e62c30c8b1
commit 6efaa78058

View File

@ -101,14 +101,14 @@ else
INCLUDES += -Iexternal/openal_soft/include INCLUDES += -Iexternal/openal_soft/include
endif endif
# define all object files required # define all object files required with a wildcard
OBJS = core.o rlgl.o shapes.o text.o textures.o models.o audio.o utils.o \ OBJS = $(patsubst %.c, %.o, $(wildcard *.c))
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.
# The target 'all' compile raylib into static, web and dynamic library. # The target 'all' compile raylib into static, web and dynamic library.
# TODO: add possibility to compile web and dynamic version of raylib. # 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)
@ -118,57 +118,24 @@ libraylib.bc : $(OBJS)
emcc -O1 $(OBJS) -o libraylib.bc emcc -O1 $(OBJS) -o libraylib.bc
@echo "libraylib.bc generated (web version)!" @echo "libraylib.bc generated (web version)!"
# compile core module # compile all modules
# emcc core.c -o core.bc -DPLATFORM_DESKTOP %.o : %.c %.h
core.o: core.c ifneq ($(PLATFORM),PLATTFORM_WEB)
$(CC) -c core.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS) $(CC) -c -o $@ $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS)
else
# compile rlgl module emcc $< -o $@ -DPLATFORM_DEKSTOP
rlgl.o: rlgl.c endif
$(CC) -c rlgl.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS)
# compile shapes module
shapes.o: shapes.c
$(CC) -c shapes.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS)
# compile textures module
textures.o: textures.c
$(CC) -c textures.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS)
# compile text module
text.o: text.c
$(CC) -c text.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS)
# compile models module
models.o: models.c
$(CC) -c models.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS)
# compile audio module
audio.o: audio.c
$(CC) -c audio.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
# compile utils module
utils.o: utils.c
$(CC) -c utils.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
# compile camera module
camera.o: camera.c
$(CC) -c camera.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
# compile gestures module
gestures.o: gestures.c
$(CC) -c gestures.c $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
# compile stb_vorbis library # compile stb_vorbis library
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 # It installs (copy) raylib dev files (static library and header) to standard
# directories on GNU/Linux platform. # directories on GNU/Linux platform.
# TODO: add other platforms. # TODO: add other platforms.
install : install :
ifeq ($(ROOT),root) ifeq ($(ROOT),root)
ifeq ($(UNAMEOS),Linux) ifeq ($(PLATFORM_OS),LINUX)
cp --update libraylib.a /usr/local/lib/libraylib.a cp --update libraylib.a /usr/local/lib/libraylib.a
cp --update raylib.h /usr/local/include/raylib.h cp --update raylib.h /usr/local/include/raylib.h
@echo "raylib dev files installed/updated!" @echo "raylib dev files installed/updated!"
@ -183,7 +150,7 @@ endif
# TODO: see 'install' target. # TODO: see 'install' target.
unistall : unistall :
ifeq ($(ROOT),root) ifeq ($(ROOT),root)
ifeq ($(UNAMEOS),Linux) ifeq ($(PLATFORM_OS),LINUX)
rm --force /usr/local/lib/libraylib.a rm --force /usr/local/lib/libraylib.a
rm --force /usr/local/include/raylib.h rm --force /usr/local/include/raylib.h
@echo "raylib dev files removed!" @echo "raylib dev files removed!"