-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (35 loc) · 1 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
CC = gcc
SDLCFLAGS = `bash sdl-config --cflags`
SDLLDFLAGS = `bash sdl-config --libs`
CFLAGS = -Wall -O0 -g -std=c99 -Iinclude/ $(SDLCFLAGS)
LDFLAGS = $(SDLLDFLAGS) -lSDL_image
BINDIR = bin
BIN = bomberman
SRCDIR = src
SRC = $(wildcard $(SRCDIR)/*.c)
OBJDIR = .obj
OBJ = $(SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
DEPDIR = .dep
DEP = $(SRC:$(SRCDIR)/%.c=$(DEPDIR)/%.d)
.PHONY: all clean mrproper archive
all : $(BIN)
$(BIN) : $(OBJ)
$(CC) -o $(BINDIR)/$@ $(OBJ) $(LDFLAGS)
$(OBJDIR)/%.o : $(SRCDIR)/%.c $(DEPDIR)/%.d
$(CC) -c $(CFLAGS) $< -o $@
$(DEPDIR)/%.d : $(SRCDIR)/%.c
@$(CC) -Iinclude/ -MT"$(<:$(SRCDIR)/%.c=$(OBJDIR)/%.o)" -MM -o $@ $<
$(OBJ) : $(OBJDIR)
$(DEP) : $(DEPDIR)
$(BIN) : $(BINDIR)
$(DEPDIR) $(OBJDIR) $(BINDIR):
-mkdir $@
clean :
-rm -rf $(BINDIR) $(OBJDIR) $(DEPDIR)
mrproper : clean
-rm -rf .project .cproject .settings
archive:
-zip -9 -r bomberman-`date +'%y-%m-%d-%Hh%M'`.zip . -x "*/\.*" -x "\.*" -x "bin/*" -x "*.zip" -x "*~"
ifneq ($(wildcard .dep),)
-include $(DEP)
endif