-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (27 loc) · 936 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
34
35
36
37
38
CC = gcc
CFLAGS = -std=c11 -O3 -Wall -Wextra -Wpedantic -g -Wstrict-aliasing -Wpointer-arith
CFLAGS += -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result
LD = gcc
LDFLAGS = lib/glad/src/glad.o lib/cglm/build/libcglm.a lib/glfw/build/src/libglfw3.a -lm
SRC = $(shell find src -name "*.c")
OBJ = $(SRC:.c=.o)
INCLUDE = -Ilib/cglm/include -Ilib/glad/include -Ilib/glfw/include -Ilib/stb
BIN = bin
.PHONY: all clean clean-lib
all: dirs libs game
libs:
cd lib/cglm && cmake -B build -S . -DCGLM_STATIC=ON && cd build && make
cd lib/glad && $(CC) -Iinclude -c src/glad.c -o src/glad.o
cd lib/glfw && cmake -B build -S . && cd build && make
dirs:
mkdir -p ./$(BIN)
game: $(OBJ)
$(CC) -o $(BIN)/game $^ $(LDFLAGS)
%.o: %.c
$(CC) -o $@ -c $< $(CFLAGS) $(INCLUDE)
run: all
$(BIN)/game
clean-lib:
rm -rf lib/cglm/build lib/glfw/build
clean:
rm -rf $(OBJ) $(BIN) lib/glad/src/glad.o