-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathMakefile
49 lines (37 loc) · 867 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
# Non-volatile memory simulator
# Pre-release version, r131
target := nvsim
# define tool chain
CXX := g++
RM := rm -f
# define build options
# compile options
CXXFLAGS := -Wall
# link options
LDFLAGS :=
# link librarires
LDLIBS :=
# construct list of .cpp and their corresponding .o and .d files
SRC := $(wildcard *.cpp)
INC :=
DBG :=
OBJ := $(SRC:.cpp=.o)
DEP := Makefile.dep
# file disambiguity is achieved via the .PHONY directive
.PHONY : all clean dbg
all : $(target)
dbg: DBG += -ggdb -g
dbg: $(target)
$(target) : $(OBJ)
$(CXX) $(LDFLAGS) $^ $(LDLIBS) -o $@
clean :
$(RM) $(target) $(dep_file) $(OBJ)
.cpp.o :
$(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