-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
36 lines (26 loc) · 909 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
CC=g++
TEST_INCLUDES=-I ./third_party/yaml-cpp/include -I ./third_party/googletest/googletest/include
LD_TEST=-lgtest -L ./third_party/googletest/build/lib/
TEST_LIB_STATIC=./third_party/yaml-cpp/build/*.a ./third_party/googletest/build/lib/*.a ./db_impl/leveldb/build/libleveldb.a
TEST_SRCS=$(wildcard tests/*.cc)
TEST_BIN =$(TEST_SRCS:.cc=)
CFLAGS=-std=c++11 -g -Wall -pthread -fgnu-tm
INCLUDES=-I ./
LDFLAGS= -lpthread
SUBDIRS=db core
SUBSRCS=$(wildcard db/*.cc) $(wildcard core/*.cc)
OBJECTS=$(SUBSRCS:.cc=.o)
EXEC=ycsbc
all: $(OBJECTS) $(EXEC)
.cc.o:
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
$(EXEC): $(wildcard *.cc) $(OBJECTS)
$(CC) $(CFLAGS) $(INCLUDES) $^ $(LDFLAGS) -o $@
test: $(TEST_BIN)
$(TEST_BIN): $(TEST_SRCS)
$(CC) $(CFLAGS) $(TEST_INCLUDES) $^ $(TEST_LIB_STATIC) $(LDFLAGS) $(LD_TEST) -o $@
clean:
$(RM) $(OBJECTS)
$(RM) $(EXEC)
$(RM) $(TEST_BIN)
.PHONY: $(SUBDIRS) $(EXEC)