forked from umd-memsys/DRAMSim2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
74 lines (56 loc) · 2.09 KB
/
Makefile.in
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
62
63
64
65
66
67
68
69
70
71
72
73
74
# Configure
binDir := @prefix@/bin
libDir := @prefix@/lib
includeDir := @prefix@/include
srcDir := @top_srcdir@
# common prefix variables
libtool := /usr/bin/libtool
installBins := $(libtool) --mode=install /usr/bin/install -s -p -m 755
installDynLibs := $(libtool) --mode=install /usr/bin/install -p -m 755
installDirs := /usr/bin/install -d
installFiles := /usr/bin/install -p -m 644
COMPILE.cc = $(libtool) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
LINK.cc = $(libtool) --mode=link $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
vpath %.cpp $(srcDir)
# specific to the project
CPPFLAGS := -MMD -DNO_STORAGE -DDEBUG_BUILD -DLOG_OUTPUT
CXXFLAGS := -Wall
OPTFLAGS := -O3
ifdef DEBUG
ifeq ($(DEBUG), 1)
OPTFLAGS= -O0 -g
endif
endif
CXXFLAGS+=$(OPTFLAGS)
EXE_NAME:= DRAMSim
LIB_NAME:= libdramsim.la
includes:= $(wildcard $(srcDir)/*.h)
SRC := $(filter-out TraceBasedSim.cpp,$(notdir $(wildcard $(srcDir)/*.cpp)))
OBJ := $(patsubst %.cpp, %.o, $(SRC))
all: $(EXE_NAME) $(LIB_NAME)
install:: $(EXE_NAME)
$(if $^,$(installDirs) $(DESTDIR)$(binDir))
$(if $^,$(installBins) $^ $(DESTDIR)$(binDir))
# We have to install dynamically shared libraries as executables
# otherwise rpmbuild find-provides will not detect the library
# and automatically add it to the Provides: field.
install:: $(LIB_NAME)
$(if $^,$(installDirs) $(DESTDIR)$(libDir))
$(if $^,$(installDynLibs) $^ $(DESTDIR)$(libDir))
install:: $(includes)
$(if $^,$(installDirs) $(DESTDIR)$(includeDir))
$(if $^, $(installFiles) $^ $(DESTDIR)$(includeDir))
# $@ target name, $^ target deps, $< matched pattern
$(EXE_NAME): TraceBasedSim.o $(LIB_NAME)
$(LINK.cc) $(^:.o=.lo) $(LOADLIBES) $(LDLIBS) -o $@
@echo "Built $@ successfully"
$(LIB_NAME): LDFLAGS += -rpath $(libDir)
$(LIB_NAME): $(OBJ)
clean:
-rm -f $(EXE_NAME) $(LIB_NAME) *.o *.lo *.d .libs/*
%.la:
$(LINK.cc) $(^:.o=.lo) $(LOADLIBES) $(LDLIBS) -o $@
@echo "Built $@ successfully"
#include the autogenerated dependency files for each .o file
deps := $(OBJ:.o=.d) $(patsubst %.o, .libs/%.d,$(OBJ))
-include $(deps)