-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (47 loc) · 1.2 KB
/
Copy pathMakefile
File metadata and controls
61 lines (47 loc) · 1.2 KB
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
# compiler flags
CC=gcc
CFLAGS=-Iinc --std=c99 -O3
CLFLAGS=-lglfw -lGLEW -lpng
DEFINES=-DLOGGING
# directory settings
SRCDIR=src
INCDIR=inc
BINDIR=bin
OBJDIR=obj
DEPDIR=deps
DOCDIR=docs
RESDIR=res
# file lists
SOURCES_RAW=creep.c geometry.c main.c map.c texture.c tile.c tower.c towerdef.c window.c
SOURCES=$(addprefix $(SRCDIR)/, $(SOURCES_RAW))
DEPS=$(subst $(SRCDIR)/,$(DEPDIR)/,$(SOURCES:.c=.d))
OBJS=$(subst $(SRCDIR)/,$(OBJDIR)/,$(SOURCES:.c=.o))
HEADERS_RAW=creep.h geometry.h map.h texture.h tile.h tower.h towerdef.h window.h util.h
HEADERS=$(addprefix $(INCDIR)/, $(HEADERS_RAW))
# main targets
all: towerdef
clean:
rm -f $(DEPS)
rm -f $(OBJS)
rm -rf $(DOCDIR)
rm -rf $(BINDIR)/*
depend: $(DEPS)
docs: $(HEADERS)
doxygen doxygen.conf
resources:
rsync -r $(RESDIR) $(BINDIR)
run: towerdef
bin/towerdef
towerdef: $(OBJS) resources
$(CC) $(CFLAGS) -o $(BINDIR)/towerdef $(OBJS) $(CLFLAGS)
# dependency generation
$(DEPDIR)/%.d: $(SRCDIR)/%.c
@set -e rm -r $@; \
$(CC) -MM $(CFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,$(OBJDIR)/\1.o $@ : , g' < $@.$$$$ > $@; \
rm -f $@.$$$$
# obj compilation
$(OBJDIR)/%.o: $(SRCDIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
# dependency includes
-include $(DEPS)