-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
55 lines (41 loc) · 1006 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
52
53
54
55
# Non-volatile memory simulator
#target := tsvtest
target := destiny
# define tool chain
CXX := g++
RM := rm -f
# define build options
# compile options
CXXFLAGS := -Wall
# link options
LDFLAGS :=
# 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:
mkdir -p $(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