-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (47 loc) · 1.15 KB
/
Makefile
File metadata and controls
61 lines (47 loc) · 1.15 KB
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
# Non-volatile memory simulator
#target := tsvtest
target := destinyP
# define tool chain
CXX := g++
ifeq ($(OS),Windows_NT)
RM := del /Q /F 2>nul
MD := -mkdir
else
RM := rm -f
MD := mkdir -p
endif
# define build options
# compile options
CXXFLAGS := -Wall -fopenmp
# link options
LDFLAGS := -fopenmp
# link librarires
LDLIBS :=
OUTDIR := obj
# construct list of .cpp and their corresponding .o and .d files
SRC := $(wildcard *.cpp)
INC :=
DBG :=
OBJ := $(patsubst %.cpp,$(OUTDIR)/%.o,$(notdir $(SRC)))
DEP := Makefile.dep
# file disambiguity is achieved via the .PHONY directive
.PHONY : all clean dbg
all: CXXFLAGS += -O3 -mtune=native
all: dir $(target)
dbg: DBG += -ggdb -g #-DNVSIM3DDEBUG=1
dbg: dir $(target)
dir:
@$(MD) $(OUTDIR)
$(target): $(OBJ)
$(CXX) $(LDFLAGS) $^ $(LDLIBS) -o $@
clean:
$(RM) $(target) $(dep_file) $(OBJ)
$(OUTDIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) $(DBG) $(INC) -c $< -o $@
depend $(DEP):
@echo Makefile - creating dependencies for: $(SRC)
@$(RM) $(DEP)
@$(CXX) -E -MM $(INC) $(SRC) >> $(DEP)
ifeq (,$(findstring clean,$(MAKECMDGOALS)))
-include $(DEP)
endif