-
Notifications
You must be signed in to change notification settings - Fork 210
/
Makefile
47 lines (32 loc) · 1.14 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
SRCDIR := src
OBJDIR := obj
MAIN := $(SRCDIR)/Main.cpp
SRCS := $(filter-out $(MAIN) $(SRCDIR)/Gem5Wrapper.cpp, $(wildcard $(SRCDIR)/*.cpp))
OBJS := $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(SRCS))
# Ramulator currently supports g++ 5.1+ or clang++ 3.4+. It will NOT work with
# g++ 4.x due to an internal compiler error when processing lambda functions.
CXX := clang++
# CXX := g++-5
CXXFLAGS := -O3 -std=c++11 -g -Wall
.PHONY: all clean depend
all: depend ramulator
clean:
rm -f ramulator
rm -rf $(OBJDIR)
depend: $(OBJDIR)/.depend
$(OBJDIR)/.depend: $(SRCS)
@mkdir -p $(OBJDIR)
@rm -f $(OBJDIR)/.depend
@$(foreach SRC, $(SRCS), $(CXX) $(CXXFLAGS) -DRAMULATOR -MM -MT $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(SRC)) $(SRC) >> $(OBJDIR)/.depend ;)
ifneq ($(MAKECMDGOALS),clean)
-include $(OBJDIR)/.depend
endif
ramulator: $(MAIN) $(OBJS) $(SRCDIR)/*.h | depend
$(CXX) $(CXXFLAGS) -DRAMULATOR -o $@ $(MAIN) $(OBJS)
libramulator.a: $(OBJS) $(OBJDIR)/Gem5Wrapper.o
libtool -static -o $@ $(OBJS) $(OBJDIR)/Gem5Wrapper.o
$(OBJS): | $(OBJDIR)
$(OBJDIR):
@mkdir -p $@
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(CXX) $(CXXFLAGS) -DRAMULATOR -c -o $@ $<