-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
71 lines (48 loc) · 1.07 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
CFLAGS = -Wall -std=c++11 -Wno-sign-compare -Wno-unused-variable -Wno-unused-function -Wfatal-errors -Wno-shift-count-overflow -Wno-tautological-constant-out-of-range-compare
#CLANG = true
OPT=true
DBG=true
ifdef CLANG
CC = clang++
LD = clang++
CFLAGS += -Werror -DCLANG -ftemplate-depth=512
else
CC = g++
LD = g++
endif
RMDIR=rmdir
MKDIR=mkdir
ifdef SANITIZE_ADDRESS
CFLAGS += -fsanitize=address
endif
ifdef DBG
CFLAGS += -g
endif
ifdef OPT
CFLAGS += -O3
endif
ifdef PROF
CFLAGS += -pg
endif
OBJDIR = obj
NAME = sokoban
IPATH = -I.
CFLAGS += $(IPATH)
SRCS = $(shell ls -t src/*.cpp)
LIBS = -lpthread
OBJS = $(addprefix $(OBJDIR)/,$(SRCS:.cpp=.o))
DEPS = $(addprefix $(OBJDIR)/,$(SRCS:.cpp=.d))
##############################################################################
all: $(NAME)
$(OBJDIR)/%.o: %.cpp ${PCH}
-$(MKDIR) -p $(dir $@)
$(CC) -MMD $(CFLAGS) $(PCHINC) -c $< -o $@
$(NAME): $(OBJS)
$(LD) $(CFLAGS) -o $@ $^ $(LIBS)
clean:
$(RM) $(OBJDIR)/src/*.o
$(RM) $(OBJDIR)/src/*.d
$(RMDIR) $(OBJDIR)/src/
$(RMDIR) $(OBJDIR)/
$(RM) $(NAME)
-include $(DEPS)