-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
56 lines (41 loc) · 1009 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
46
47
48
49
50
51
52
53
54
55
56
UNAME = $(shell uname -s)
CC = gcc
CFLAGS = -Wall
LD = $(CC)
LDLIBS = -lglut -lGL -lGLU -lm
LDFLAGS = -I /usr/include/GL/ -L /usr/include/GL
RM = rm
ifdef CONFIG_DEBUG
CFLAGS := -g
LDFLAGS := -g
endif
DOC_CFG = doxygen.config
DOCSDIR = docs
BINDIR = bin
DEPSDIR = deps
MKDIRS = $(CURDIR)/{$(BINDIR),$(DEPSDIR)}
TARGET = Asteroids
SRCS = main.c ship.c asteroid.c game.c
OBJS = $(addprefix $(BINDIR)/,${SRCS:.c=.o})
DEPS = $(addprefix $(DEPSDIR)/,${SRCS:.c=.d})
.SUFFIXES:
.SUFFIXES: .o .c
$(shell `mkdir -p $(MKDIRS)`)
all : $(TARGET)
$(BINDIR)/%.o : %.c
$(CC) $(CFLAGS) -o $@ -c $<
$(DEPSDIR)/%.d : %.c
@$(CC) $(CFLAGS) -M $< > $@.$$$$; \
sed -e '1s#^#$(BINDIR)/#' \
-e 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
$(TARGET) : $(OBJS)
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
TAGS :
find . -regex ".*\.[cChH]\(pp\)?" -print | etags -
docs:
doxygen $(DOC_CFG)
clean :
-$(RM) -r $(BINDIR) $(DEPSDIR) $(TARGET) $(DOCSDIR)
-include $(DEPS)
.PHONY : clean TAGS docs