-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
60 lines (41 loc) · 1.35 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
CC := gcc# i686-w64-mingw32-gcc
LIBFOLDER := lib# libwin32
LD_FLAGS_WIN32 := $(LIBFOLDER)/libcommon.a $(LIBFOLDER)/libcore.a $(LIBFOLDER)/libglad.a -lglfw3 -pthread -lm -lgdi32 -lopengl32 -Wl,-subsystem,windows
LD_FLAGS := $(LIBFOLDER)/libcommon.a $(LIBFOLDER)/libcore.a $(LIBFOLDER)/libglad.a -lGL -lglfw3 -pthread -ldl -lGL -lrt -lXrandr -lXi -lXinerama -lX11 -lm
CC_FLAGS := -Wall -O1
SRC_GLAD := $(wildcard src/glad/*.c)
OBJ_GLAD := $(patsubst %.c, %.o, $(SRC_GLAD))
SRC_COMMON := $(wildcard src/common/*.c)
OBJ_COMMON := $(patsubst %.c, %.o, $(SRC_COMMON))
SRC_CORE := $(wildcard src/core/*.c)
OBJ_CORE := $(patsubst %.c, %.o, $(SRC_CORE))
SRC_APP := $(wildcard src/app/*.c)
.PHONY: shader
shader:
(cd shader; python3 convert.py)
%.o: %.c
$(CC) $(CC_FLAGS) -c $< -o $@ -Iinclude
glad: $(OBJ_GLAD)
mkdir -p $(LIBFOLDER)
ar -crs $(LIBFOLDER)/lib$@.a $^
(cd src/glad; rm *.o)
common: $(OBJ_COMMON)
mkdir -p $(LIBFOLDER)
ar -crs $(LIBFOLDER)/lib$@.a $^
(cd src/common; rm *.o)
core: $(OBJ_CORE)
mkdir -p $(LIBFOLDER)
ar -crs $(LIBFOLDER)/lib$@.a $^
(cd src/core; rm *.o)
application: $(SRC_APP)
$(CC) -Iinclude $(CC_FLAGS) -o $@ $^ $(LD_FLAGS)
.PHONY: run
run:
./application
all: common glad core application
mono2src:
mkdir -p ./bin
gcc -o ./bin/$@ ./tools/$@.c -lm
.PHONY: font
font:
./bin/mono2src assets/font.png src/app/fontsrc.h