-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
56 lines (40 loc) · 1.16 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
# Compiler
CXX = g++
# Warnings
WARN = -Wall
# Link
LINK = -lpmem -fopenmp
# Include Directory
IDIR = -Iinclude
# Optimizing Flags
OPT = -O3 -march=native -flto
debug: OPT = -O0 -march=native
assembly: OPT = -O3 -march=native
# Flags
CXXFLAGS = $(WARN) -std=c++14
debug: CXXFLAGS += -g
# Source
srcCPP = $(wildcard ./src/*.cpp) $(wildcard ./src/*/*.cpp)
_objCPP = $(srcCPP:.cpp=.o)
_asmCPP = $(srcCPP:.cpp=.s)
objCPP = $(subst src,obj,$(_objCPP))
asmCPP = $(subst src,asm,$(_asmCPP))
obj = $(objCPP)
asm = $(asmCPP)
out_name=pmem_benchmark
# Compile
main: $(obj)
$(CXX) $(CXXFLAGS) $(OPT) $(IDIR) -o $(out_name) $^ $(LINK)
debug: $(obj)
$(CXX) $(CXXFLAGS) $(OPT) $(IDIR) -o $(out_name) $^ $(LINK)
assembly: $(asm)
obj/%.o: src/%.cpp | dir_make
$(CXX) $(CXXFLAGS) $(OPT) $(IDIR) -c -o $@ $^ $(LINK)
asm/%.s: src/%.cpp | dir_make
$(CXX) $(CXXFLAGS) $(OPT) $(IDIR) -S -o $@ $^ $(LINK)
dir_make:
@mkdir -p obj asm obj/PMEM asm/PMEM obj/GNUPlot asm/GNUPlot tmp output
.PHONY: clean
# Clean
clean:
rm -rf obj/*.o asm/*.s obj/PMEM/*.o asm/PMEM/*.s obj/GNUPlot/*.o asm/GNUPlot/*.s $(out_name) tmp/* output/debug/*