diplomska_naloga/Makefile
2024-03-09 18:59:05 +01:00

76 lines
1.9 KiB
Makefile

RAYFLAGS= -D_GNU_SOURCE -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33
RAYINCLUDE= -Iraylib/src -Iraylib/src/external/glfw/include -Iraylib/src/external/glfw/deps/mingw
RAYOBJECTS= rl/rcore.o rl/rshapes.o rl/rtextures.o rl/rtext.o rl/utils.o rl/rglfw.o rl/rmodels.o rl/raudio.o
#RAYOPT= -O3
RAYOPT= -ggdb
all: clean setup main run
setup:
if [ ! -d "raylib" ]; then \
git clone --depth 1 --branch "5.0" git@github.com:raysan5/raylib.git; \
rm -rf raylib/.git; \
fi
if [ ! -d "obj" ]; then \
mkdir -p obj; \
fi
if [ ! -d "rl" ]; then \
mkdir -p rl; \
fi
rl/rcore.o: raylib/src/rcore.c
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
rl/rshapes.o: raylib/src/rshapes.c
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
rl/rtextures.o: raylib/src/rtextures.c
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
rl/rtext.o: raylib/src/rtext.c
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
rl/utils.o: raylib/src/utils.c
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
rl/rglfw.o: raylib/src/rglfw.c
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
rl/rmodels.o: raylib/src/rmodels.c
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
rl/raudio.o: raylib/src/raudio.c
gcc -c $< -o $@ $(RAYOPT) $(RAYFLAGS) $(RAYINCLUDE)
SRCDIR = src
OBJDIR = obj
INCLUDE = -Iinc
CFLAGS= -std=c++23 -Wall -Werror
SOURCES = $(wildcard $(SRCDIR)/*.cpp)
OBJECTS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SOURCES))
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
g++ -c $< -o $@ $(RAYOPT) $(RAYINCLUDE) $(INCLUDE) $(CFLAGS)
main: setup $(RAYOBJECTS) $(OBJECTS)
g++ $(RAYOBJECTS) $(OBJECTS) -o main $(RAYOPT) $(RAYINCLUDE) $(INCLUDE) $(CFLAGS)
example: example.cpp setup $(RAYOBJECTS) $(OBJECTS)
g++ example.cpp $(RAYOBJECTS) $(OBJECTS) -o example $(RAYOPT) $(RAYINCLUDE) $(INCLUDE) $(CFLAGS)
run: main
./main
clean:
rm -rf obj
rm -f main example
cleanAll: clean
rm -rf raylib
countLine:
cloc --exclude-dir=raylib --exclude-lang=JSON,make,Markdown .