forked from roh1th-s/chess-opengl
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
33 lines (23 loc) · 851 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
CC = gcc
CFLAGS = -Wall -g -DGLEW_STATIC -DGLFW_INCLUDE_NONE
LIB=-L./lib -lglew32 -lglfw3 -lcglm -lfreetype -lgdi32 -lopengl32
INC=-I./include -I./include/freetype
SRC_DIR = src
BUILD_DIR = build
RES_DIR = res
SOURCES = $(wildcard $(SRC_DIR)/*.c) $(wildcard $(SRC_DIR)/**/*.c) $(wildcard $(SRC_DIR)/**/**/*.c)
HEADERS = $(wildcard $(SRC_DIR)/*.h) $(wildcard $(SRC_DIR)/**/*.h) $(wildcard $(SRC_DIR)/**/**/*.h)
OBJECTS = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o, $(SOURCES))
TARGET_EXEC = $(BUILD_DIR)/chess.exe
dir_guard=@mkdir -p $(@D)
.phony: all clean
all: $(TARGET_EXEC)
$(TARGET_EXEC): $(OBJECTS)
$(dir_guard)
$(CC) $(CFLAGS) $(OBJECTS) -o $@ $(LIB)
#TODO: Improve recompilation strategy when headers change
$(BUILD_DIR)/%.o : $(SRC_DIR)/%.c $(HEADERS)
$(dir_guard)
$(CC) $(CFLAGS) $(INC) -c $< -o $@
clean:
rm -rf $(BUILD_DIR)