-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (38 loc) · 904 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
PNAME = PeaceableQueens
# Directory structure
SDIR = src
ODIR = obj
BDIR = bin
# Compiler option
INC = $(SDIR)
INC_PARAMS = $(foreach d, $(INC), -I$d)
#CPPFLAGS = -std=c++17 -g
CPPFLAGS = -std=c++17 -O3
LINKFLAGS =
# Compilation commands
CPPC = g++ $(CPPFLAGS) $(INC_PARAMS) $(LINKFLAGS)
CPPL = g++ $(CPPFLAGS) $(LINKFLAGS)
#Default make target: setup the environment, then build the program
.PHONY: all
all: | toolchain $(PNAME)
SRCS = main.cpp threaded.cpp fileSystem.cpp
SOBJ = $(patsubst %.cpp, $(ODIR)/%.o, $(SRCS))
$(BDIR)/$(PNAME): $(SOBJ)
$(CPPL) -o $@ $^
$(ODIR)/%.o: $(SDIR)/%.cpp
$(CPPC) -c -o $@ $^
%.o: %.cpp
$(CPPC) -c -o $@ $<
#main.o: func.hpp
#func.o: func.hpp
.PHONY: clean
clean:
rm -rf $(ODIR) $(BDIR)
.PHONY: toolchain pmain $(PNAME)
toolchain: | $(BDIR) $(ODIR)
pmain: $(BDIR)/$(PNAME)
$(PNAME): | toolchain pmain
$(ODIR):
@mkdir $(ODIR)
$(BDIR):
@mkdir $(BDIR)