-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
45 lines (34 loc) · 817 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
39
40
41
42
43
44
45
CFLAGS = -Wall -Wextra -std=c17 -pedantic #-fsanitize=address -Og -g
botfile = test.c
srcdir = src
builddir = build
mlxdir = mlx
bin = cluster
mlx = $(mlxdir)/libmlx42.a
src = $(wildcard $(srcdir)/*.c)
obj = $(patsubst $(srcdir)/%.c,$(builddir)/%.o,$(src))
dep = $(patsubst $(srcdir)/%.c,$(builddir)/%.d,$(src))
inc = -I include -I mlx/include
CC = gcc
all: $(bin)
$(bin): $(obj) $(mlx)
@mkdir -p $(builddir)
$(CC) $(CFLAGS) $^ -o $@ -lglfw -L /Users/$(USER)/.brew/opt/glfw/lib -lm -ldl
$(builddir)/%.o: $(srcdir)/%.c
@mkdir -p $(builddir)
$(CC) $(CFLAGS) $< -o $@ -c -MMD $(inc)
$(mlx):
make -C $(mlxdir)
clean:
rm -rf $(builddir)
rm -f $(bin)
test: all
./cluster
bot_test: all bot
./cluster ./bot ./bot
bot: $(botfile)
$(CC) $(botfile) -o $@
re: clean
make re -C mlx
make all
-include $(dep)