-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile.real
More file actions
61 lines (46 loc) · 1.85 KB
/
Makefile.real
File metadata and controls
61 lines (46 loc) · 1.85 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
##################### Configurations #####################
# list of all directories containing .cpp and .h code
# space separated, must start with ./ and no forwardslash in the end
#
SRC_DIRS := . ./StupidTrie ./Workloads ./third_party/libart
# additional g++ compiler flags
#
EXTRA_FLAGS := -mavx2
# header file base paths for includes, space separated
#
INCLUDE_DIRS := . ./Workloads ./third_party/hot ./third_party/sparsehash/include/ ./third_party/arraylayout
##########################################################
DBG=0
ifeq (${DBG},1)
FLAGS := -O0 -DBUILD_FLAVOR=DEBUG -DDEBUG_BUILD
else
FLAGS := -O3 -DNDEBUG -DBUILD_FLAVOR=RELEASE
endif
SRC_RELDIR = ../../
FLAGS += -std=c++14 -march=native -isystem $(SRC_RELDIR)./gtest/include -pthread -g
FLAGS += $(EXTRA_FLAGS)
INCLUDE_DIRS_FLAGS := $(addprefix -I$(SRC_RELDIR),$(INCLUDE_DIRS))
FLAGS += $(INCLUDE_DIRS_FLAGS)
SRCS := $(foreach dir,$(SRC_DIRS),$(wildcard $(SRC_RELDIR)$(dir)/*.cpp))
SRCS_AND_HEADERS := $(foreach dir,$(SRC_DIRS),$(wildcard $(SRC_RELDIR)$(dir)/*.cpp $(SRC_RELDIR)$(dir)/*.h))
OBJS := $(SRCS:$(SRC_RELDIR)./%=%)
OBJS := $(subst .cpp,.o,$(OBJS))
OBJS := $(subst /,.,$(OBJS))
main: $(OBJS) libgtest.a
g++ $(FLAGS) $(OBJS) libgtest.a -o main
generated.dependency: $(SRCS_AND_HEADERS) Makefile
rm -f ./generated.dependency
for srcname in $(SRCS) ; do \
objname=$${srcname#"$(SRC_RELDIR)./"}; \
objname=$$(echo $$objname | sed -e 's/\//./g'); \
objname=$${objname%".cpp"}.o; \
g++ $(FLAGS) -I$(SRC_RELDIR)./gtest -MM $$srcname -MT $$objname >> ./generated.dependency; \
printf "\tg++ \$$(FLAGS) $$srcname -c -o $$objname\n" >> ./generated.dependency; \
done
include ./generated.dependency
gtest-all.o:
g++ $(FLAGS) -I$(SRC_RELDIR)./gtest -c $(SRC_RELDIR)./gtest/src/gtest-all.cc
libgtest.a: gtest-all.o
ar -rv libgtest.a gtest-all.o
clean:
rm *.o libgtest.a main generated.dependency