This repository was archived by the owner on Apr 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
77 lines (58 loc) · 1.59 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
WARNINGS := -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align \
-Wwrite-strings -Wmissing-prototypes -Wmissing-declarations \
-Wredundant-decls -Wnested-externs -Winline -Wno-long-long \
-Wuninitialized -Wconversion -Wstrict-prototypes
CFLAGS ?= -std=gnu99 -g $(WARNINGS) -fpic
OBJDIR := Objects
OUTDIR := Outputs
SRCDIR := Sources
NAME := snake_$(shell uname -m)-$(shell uname -s)
ifeq ($(VERBOSE), 1)
SILENCER :=
else
SILENCER := @
endif
ifeq ($(DEBUG_BUILD), 1)
CFLAGS +=-DDEBUG_BUILD
endif
SRCF := chain/pile.c \
helpers/type.c \
helpers/print.c \
helpers/conversion.c \
helpers/string.c \
helpers/random.c \
memory/game.c \
memory/map.c \
memory/player.c \
memory/sdl.c \
initiator/file.c \
initiator/generate.c \
spawners.c \
draw.c \
interface.c \
game.c \
player.c \
main.c
SRCS := $(patsubst %, $(SRCDIR)/%, $(SRCF))
OBJS := $(patsubst %, $(OBJDIR)/%, $(SRCF:c=o))
CFLAGS += -MMD -MP
DEPS := $(patsubst %, $(OBJDIR)/%, $(SRCF:c=d))
all: clearprompt $(NAME)
clearprompt:
clear
objectdir:
$(SILENCER)mkdir -p $(OBJDIR)
outputdir:
$(SILENCER)mkdir -p $(OUTDIR)
$(NAME): $(OBJS) | outputdir
$(SILENCER)$(CC) $(CFLAGS) -o $(OUTDIR)/$(NAME) $^ -lSDL2_ttf `sdl2-config --cflags --libs`
$(OBJDIR)/%.o: $(SRCDIR)/%.c | objectdir
$(SILENCER)$(CC) $(CFLAGS) -c -o $@ $<
clean: clearprompt
$(SILENCER)find . -name "*.o" -type f -delete
$(SILENCER)find . -name "*.d" -type f -delete
fclean: clean
$(SILENCER)$(RM) -rf $(OUTDIR)
re: fclean all
.PHONY: re fclean clean all
-include $(DEPS)