mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-29 10:19:18 -05:00
Review outputs by platform
This commit is contained in:
121
src/Makefile
121
src/Makefile
@ -2,7 +2,9 @@
|
|||||||
#
|
#
|
||||||
# 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)
|
# Many Thanks to Emanuele Petriglia for his contribution on GNU/Linux pipeline.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
|
||||||
#
|
#
|
||||||
# This software is provided "as-is", without any express or implied warranty.
|
# This software is provided "as-is", without any express or implied warranty.
|
||||||
# In no event will the authors be held liable for any damages arising from
|
# In no event will the authors be held liable for any damages arising from
|
||||||
@ -77,9 +79,11 @@ endif
|
|||||||
|
|
||||||
# define compiler: gcc for C program, define as g++ for C++
|
# define compiler: gcc for C program, define as g++ for C++
|
||||||
ifeq ($(PLATFORM),PLATFORM_WEB)
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
CC = emcc # emscripten compiler
|
# emscripten compiler
|
||||||
|
CC = emcc
|
||||||
else
|
else
|
||||||
CC = gcc # default gcc compiler
|
# default gcc compiler
|
||||||
|
CC = gcc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# define compiler flags:
|
# define compiler flags:
|
||||||
@ -90,6 +94,7 @@ endif
|
|||||||
# -fgnu89-inline declaring inline functions support (GCC optimized)
|
# -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
|
||||||
|
|
||||||
ifeq ($(SHARED),YES)
|
ifeq ($(SHARED),YES)
|
||||||
CFLAGS += -fPIC
|
CFLAGS += -fPIC
|
||||||
endif
|
endif
|
||||||
@ -110,70 +115,102 @@ else
|
|||||||
INCLUDES += -Iexternal/openal_soft/include
|
INCLUDES += -Iexternal/openal_soft/include
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# define output directory for compiled library
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
||||||
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
|
OUTPUT_PATH = ../release/win32/mingw32
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
OUTPUT_PATH = ../release/linux
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM_OS),OSX)
|
||||||
|
OUTPUT_PATH = ../release/osx
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
|
OUTPUT_PATH = ../release/html5
|
||||||
|
endif
|
||||||
|
ifeq ($(PLATFORM),PLATFORM_RPI)
|
||||||
|
OUTPUT_PATH = ../release/rpi
|
||||||
|
endif
|
||||||
|
|
||||||
# define all object files required with a wildcard
|
# define all object files required with a wildcard
|
||||||
# The wildcard takes all files that finish with ".c", then it replaces the
|
# The wildcard takes all files that finish with ".c", then it replaces the
|
||||||
# extentions with ".o", that are the object files.
|
# extentions with ".o", that are the object files.
|
||||||
OBJS = $(patsubst %.c, %.o, $(wildcard *.c))
|
OBJS = $(patsubst %.c, %.o, $(wildcard *.c))
|
||||||
OBJS += external/stb_vorbis.o
|
OBJS += external/stb_vorbis.o
|
||||||
|
|
||||||
# compile raylib static library for desktop platforms.
|
# typing 'make' will invoke the default target entry called 'all',
|
||||||
# The automatic variable "$@" is the target name, while "$<" is the first
|
# in this case, the 'default' target entry is raylib
|
||||||
# prerequisite.
|
all: raylib
|
||||||
# WARNING: you must type "make clean" before doing this target if you have
|
|
||||||
# done "make libraylib.so".
|
|
||||||
libraylib.a : $(OBJS)
|
|
||||||
ar rcs $@ $(OBJS)
|
|
||||||
@echo "libraylib.a generated (static library)!"
|
|
||||||
|
|
||||||
# compile raylib to shared library version for GNU/Linux.
|
# compile raylib library
|
||||||
# WARNING: you must type "make clean" before doing this target if you have
|
raylib: $(OBJS)
|
||||||
# done "make libraylib.so".
|
ifeq ($(PLATFORM),PLATFORM_WEB)
|
||||||
libraylib.so : $(OBJS)
|
# compile raylib for web.
|
||||||
$(CC) -shared -o $@ $(OBJS)
|
emcc -O1 $(OBJS) -o $(OUTPUT_PATH)/libraylib.bc
|
||||||
@echo "libraylib.so generated (shared library)!"
|
|
||||||
|
|
||||||
# compile raylib for web.
|
|
||||||
# WARNING: you must type "make clean" before doing this target if you have
|
|
||||||
# done "make libraylib.a/.bc".
|
|
||||||
libraylib.bc : $(OBJS)
|
|
||||||
emcc -O1 $(OBJS) -o $@
|
|
||||||
@echo "libraylib.bc generated (web version)!"
|
@echo "libraylib.bc generated (web version)!"
|
||||||
|
else
|
||||||
|
ifeq ($(SHARED),YES)
|
||||||
|
ifeq ($(PLATFORM_OS),LINUX)
|
||||||
|
# compile raylib to shared library version for GNU/Linux.
|
||||||
|
# WARNING: you should type "make clean" before doing this target
|
||||||
|
$(CC) -shared -o $(OUTPUT_PATH)/libraylib.so $(OBJS)
|
||||||
|
@echo "libraylib.so generated (shared library)!"
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
# compile raylib static library for desktop platforms.
|
||||||
|
ar rcs $(OUTPUT_PATH)/libraylib.a $(OBJS)
|
||||||
|
@echo "libraylib.a generated (static library)!"
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# It compile all modules with their prerequisite.
|
# compile all modules with their prerequisites
|
||||||
camera.o : camera.c raylib.h
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDES)
|
|
||||||
|
|
||||||
|
# compile core module
|
||||||
core.o : core.c raylib.h rlgl.h utils.h raymath.h
|
core.o : core.c raylib.h rlgl.h utils.h raymath.h
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE) -D$(PLATFORM)
|
$(CC) -c $< $(CFLAGS) $(INCLUDE) -D$(PLATFORM)
|
||||||
|
|
||||||
gestures.o : gestures.c raylib.h
|
# compile rlgl module
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE)
|
rlgl.o : rlgl.c rlgl.h raymath.h
|
||||||
|
|
||||||
models.o : models.c raylib.h rlgl.h raymath.h
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE) -D$(PLATFORM)
|
|
||||||
|
|
||||||
rlgl.o : rlgl.c rlgl.h
|
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE) -D$(GRAPHICS)
|
$(CC) -c $< $(CFLAGS) $(INCLUDE) -D$(GRAPHICS)
|
||||||
|
|
||||||
|
# compile shapes module
|
||||||
shapes.o : shapes.c raylib.h rlgl.h
|
shapes.o : shapes.c raylib.h rlgl.h
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE)
|
$(CC) -c $< $(CFLAGS) $(INCLUDE)
|
||||||
|
|
||||||
text.o : text.c raylib.h utils.h
|
# compile textures module
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDE)
|
|
||||||
|
|
||||||
textures.o : textures.c rlgl.h utils.h
|
textures.o : textures.c rlgl.h utils.h
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS)
|
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM) -D$(GRAPHICS)
|
||||||
|
|
||||||
utils.o : utils.c utils.h
|
# compile text module
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
|
text.o : text.c raylib.h utils.h
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDE)
|
||||||
|
|
||||||
audio.o : audio.c audio.h
|
# compile models module
|
||||||
|
models.o : models.c raylib.h rlgl.h raymath.h
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDE) -D$(PLATFORM)
|
||||||
|
|
||||||
|
# compile audio module
|
||||||
|
audio.o : audio.c raylib.h
|
||||||
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
|
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
|
||||||
|
|
||||||
# compile stb_vorbis library
|
# compile stb_vorbis library
|
||||||
external/stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h
|
external/stb_vorbis.o: external/stb_vorbis.c external/stb_vorbis.h
|
||||||
$(CC) -c -o $@ $< -O1 $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
|
$(CC) -c -o $@ $< -O1 $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
|
||||||
|
|
||||||
|
# compile utils module
|
||||||
|
utils.o : utils.c utils.h
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
|
||||||
|
|
||||||
|
# compile camera module
|
||||||
|
camera.o : camera.c raylib.h
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDES)
|
||||||
|
|
||||||
|
#compile gestures module
|
||||||
|
gestures.o : gestures.c raylib.h
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDE)
|
||||||
|
|
||||||
# It installs generated and needed files to compile projects using raylib.
|
# It installs generated and needed files to compile projects using raylib.
|
||||||
# The installation works manually.
|
# The installation works manually.
|
||||||
# TODO: add other platforms.
|
# TODO: add other platforms.
|
||||||
@ -211,7 +248,7 @@ ifeq ($(ROOT),root)
|
|||||||
endif
|
endif
|
||||||
@echo "raylib dev files removed!"
|
@echo "raylib dev files removed!"
|
||||||
else
|
else
|
||||||
@echo "This function works only on GNU/Linux systems"
|
@echo "This function works only on GNU/Linux systems"
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
@echo "Error: no root permissions"
|
@echo "Error: no root permissions"
|
||||||
@ -220,8 +257,8 @@ endif
|
|||||||
# clean everything
|
# clean everything
|
||||||
clean:
|
clean:
|
||||||
ifeq ($(PLATFORM_OS),WINDOWS)
|
ifeq ($(PLATFORM_OS),WINDOWS)
|
||||||
del *.o libraylib.a libraylib.bc libraylib.so external/stb_vorbis.o
|
del *.o $(OUTPUT_PATH)/libraylib.a $(OUTPUT_PATH)/libraylib.bc $(OUTPUT_PATH)/libraylib.so external/stb_vorbis.o
|
||||||
else
|
else
|
||||||
rm -f *.o libraylib.a libraylib.bc libraylib.so external/stb_vorbis.o
|
rm -f *.o $(OUTPUT_PATH)/libraylib.a $(OUTPUT_PATH)/libraylib.bc $(OUTPUT_PATH)/libraylib.so external/stb_vorbis.o
|
||||||
endif
|
endif
|
||||||
@echo "removed all generated files!"
|
@echo "removed all generated files!"
|
||||||
|
|||||||
Reference in New Issue
Block a user