-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (33 loc) · 866 Bytes
/
Makefile
File metadata and controls
46 lines (33 loc) · 866 Bytes
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
CXXFLAGS := --std=c++14 -Wall -Wno-sign-compare -O2 -g -DNDEBUG
CPPFLAGS := -I libs -I libs/emilib
LDLIBS := -lstdc++ -lpthread -ldl
BIN = wfc
DISTDIR = build
OUTPUTDIR = output
SRCDIR = src
SRCFILES = $(wildcard $(SRCDIR)/*.cpp)
INCDIR = inc
INCFILES = $(wildcard $(INCDIR)/*h)
OBJFILES = $(patsubst $(SRCDIR)/%.cpp, $(DISTDIR)/%.o, $(SRCFILES))
RM = rm -rf
MKDIR = mkdir -p
CXXFLAGS += -I./$(INCDIR)
all: setup $(BIN)
$(BIN): $(OBJFILES)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $^ $(LDLIBS) -o $(BIN)
$(DISTDIR)/%.o: $(SRCDIR)/%.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
.PHONY: run clean distclean fclean re
setup: $(DISTDIR) $(OUTPUTDIR)
git submodule update --init --recursive
$(DISTDIR):
$(MKDIR) $(DISTDIR)
$(OUTPUTDIR):
$(MKDIR) $(OUTPUTDIR)
run: all
./$(BIN)
clean:
$(RM) $(OBJFILES) $(DISTDIR)
fclean: clean
$(RM) $(BIN)
re: fclean all