-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
33 lines (20 loc) · 792 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
BIN_NAME=cubegame
OBJ_DIR=obj
C_SOURCE_FILES=$(wildcard src/*.c)
OBJECT_FILES=$(patsubst src/%.c, $(OBJ_DIR)/%.o, $(C_SOURCE_FILES))
INCLUDE_FILES=$(wildcard include/*.h) $(wildcard libs/stb/*.h)
# Include libs with -isystem to surpress our overzealous warnings
INCLUDE_PATHS=-I. -Iinclude -isystem libs/stb
CFLAGS=-g -std=c11 -fdiagnostics-color=always
LDFLAGS=-lGL -lglfw -lGLEW -lcglm -lm
WARN_FLAGS=-Wall -Wextra -Wpedantic -Werror -Wconversion
.PHONY: clean
all: $(BIN_NAME)
$(OBJ_DIR)/%.o: src/%.c $(INCLUDE_FILES)
@mkdir -p $(OBJ_DIR)
$(CC) $(CFLAGS) $(WARN_FLAGS) $(INCLUDE_PATHS) -c -o $@ $<
$(BIN_NAME): $(OBJECT_FILES) $(INCLUDE_FILES)
$(CC) $(CFLAGS) $(WARN_FLAGS) $(INCLUDE_PATHS) -o $@ $(OBJECT_FILES) $(LDFLAGS)
clean:
rm -f ./$(BIN_NAME)
rm -rf ./$(OBJ_DIR)