1 CFLAGS ::= -g -std=c99 -Wall -Wextra -Wpedantic $(CFLAGS)
3 LDLIBS ::= -L/usr/local/lib -lGL -lGLEW -lglut -lassimp $(LDLIBS)
5 # Prefix all object file names with the compilation directory
6 objects ::= $(addprefix out/, \
7 main.o asset.o level.o logger.o \
8 performance.o player.o render.o tga.o ui.o)
10 # Set executable extension for the platform
11 ifeq ($(OS),Windows_NT)
16 binary ::= out/shadowclad$(binext)
18 # Default target: build executable
19 $(binary) : $(objects) | out
20 @echo "###### Linking executable..."
21 $(CC) $(LDFLAGS) -o $(binary) $(objects) $(LOADLIBES) $(LDLIBS)
23 # Alias for default target
24 shadowclad : $(binary)
30 LD_LIBRARY_PATH=/usr/local/lib $(binary)
33 # Create compilation directory
41 # Generate dependencies
42 out/%.make : %.c Makefile | out
43 $(CPP) -MM -MT out/$*.o -MF $@ $(CPPFLAGS) $<
45 # Include generated rules
46 -include $(addsuffix .make, $(basename $(objects)))
48 # Build compilation units
49 out/%.o : %.c out/%.make | out
50 $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
54 rm -f $(binary) out/*.o out/*.make