restyle Makefile of 'src/' folder and fix targets

This commit is contained in:
LelixSuper 2016-07-16 17:31:54 +02:00
parent 4ef3acfa41
commit dbec22f2df

View File

@ -1,25 +1,28 @@
#************************************************************************************************** #******************************************************************************
# #
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten) # raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
# #
# Copyright (c) 2014 Ramon Santamaria (@raysan5) # Copyright (c) 2014 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # This software is provided "as-is", without any express or implied warranty.
# will the authors be held liable for any damages arising from the use of this software. # In no event will the authors be held liable for any damages arising from
# the use of this software.
# #
# Permission is granted to anyone to use this software for any purpose, including commercial # Permission is granted to anyone to use this software for any purpose,
# applications, and to alter it and redistribute it freely, subject to the following restrictions: # including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
# #
# 1. The origin of this software must not be misrepresented; you must not claim that you # 1. The origin of this software must not be misrepresented; you must not
# wrote the original software. If you use this software in a product, an acknowledgment # claim that you wrote the original software. If you use this software in a
# in the product documentation would be appreciated but is not required. # product, an acknowledgment in the product documentation would be
# appreciated but is not required.
# #
# 2. Altered source versions must be plainly marked as such, and must not be misrepresented # 2. Altered source versions must be plainly marked as such, and must not
# as being the original software. # be misrepresented as being the original software.
# #
# 3. This notice may not be removed or altered from any source distribution. # 3. This notice may not be removed or altered from any source distribution.
# #
#************************************************************************************************** #******************************************************************************
.PHONY: all clean .PHONY: all clean
@ -29,7 +32,8 @@ PLATFORM ?= PLATFORM_DESKTOP
# 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! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows!
# ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
PLATFORM_OS=WINDOWS PLATFORM_OS=WINDOWS
else else
@ -74,7 +78,7 @@ endif
# -Wall turns on most, but not all, compiler warnings # -Wall turns on most, but not all, compiler warnings
# -std=c99 defines C language mode (standard C from 1999 revision) # -std=c99 defines C language mode (standard C from 1999 revision)
# -std=gnu99 defines C language mode (GNU C from 1999 revision) # -std=gnu99 defines C language mode (GNU C from 1999 revision)
# -fgnu89-inline declaring inline functions support (GCC optimized, faster) # -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119) # -Wno-missing-braces ignore invalid warning (GCC bug 53119)
CFLAGS = -O1 -Wall -std=gnu99 -fgnu89-inline -Wno-missing-braces CFLAGS = -O1 -Wall -std=gnu99 -fgnu89-inline -Wno-missing-braces
@ -82,7 +86,9 @@ CFLAGS = -O1 -Wall -std=gnu99 -fgnu89-inline -Wno-missing-braces
# define any directories containing required header files # define any directories containing required header files
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES = -I. -Iexternal -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads INCLUDES = -I. -Iexternal -I/opt/vc/include \
-I/opt/vc/include/interface/vmcs_host/linux \
-I/opt/vc/include/interface/vcos/pthreads
else else
# STB libraries and others # STB libraries and others
INCLUDES = -I. -Iexternal INCLUDES = -I. -Iexternal
@ -93,19 +99,29 @@ else
endif endif
# define all object files required # define all object files required
OBJS = core.o rlgl.o shapes.o text.o textures.o models.o audio.o utils.o camera.o gestures.o stb_vorbis.o 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' will invoke the default target entry called 'all', # typing 'make', it will invoke the first target on the file.
# in this case, the 'default' target entry is raylib # 'all' target compile raylib into static, web and dynamic library versions.
all: raylib # WIP: allow compiling of other versions.
all: libraylib.a
# compile raylib static library for desktop platforms
libraylib.a : $(OBJS)
ar rcs libraylib.a $(OBJS)
@echo "\t**libraylib.a generated!**"
libraylib.bc : $(OBJS)
emcc -O1 $(OBJS) -o libraylib.bc
# compile raylib library # compile raylib library
raylib: $(OBJS) # raylib: $(OBJS)
ifeq ($(PLATFORM),PLATFORM_WEB) # ifeq ($(PLATFORM),PLATFORM_WEB)
emcc -O1 $(OBJS) -o libraylib.bc # emcc -O1 $(OBJS) -o libraylib.bc
else #else
ar rcs libraylib.a $(OBJS) # ar rcs libraylib.a $(OBJS)
endif #endif
# compile core module # compile core module
# emcc core.c -o core.bc -DPLATFORM_DESKTOP # emcc core.c -o core.bc -DPLATFORM_DESKTOP