-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (35 loc) · 1.63 KB
/
Makefile
File metadata and controls
43 lines (35 loc) · 1.63 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
BUILD_PATH := build/
TEST_PATH := test/
LIB_PATH := dpdk_lib/
COMPONENT_PATH := dpdk_component/
CC := clang++
COMPILE_OPT := -std=c++17
INC = -I$(LIB_PATH)
TARGET = dpdkControllerTest
TEST_SRCS = dpdkControllerTest.cpp
# COMPONENT_SRCS = controller.cpp dpdkReader.cpp indexGenerator.cpp storage.cpp truncateChecker.cpp querier.cpp directStorage.cpp
# COMPONENT_SRCS = controller.cpp dpdkReader.cpp directStorage.cpp indexGenerator.cpp indexStorage.cpp
COMPONENT_SRCS = controller.cpp dpdkReader.cpp diskManager.cpp indexGenerator.cpp indexPersister.cpp memoryManager.cpp querier.cpp
SRCS = $(addprefix $(TEST_PATH), $(TEST_SRCS)) $(addprefix $(COMPONENT_PATH), $(COMPONENT_SRCS))
# TEST_OBJS = $(TEST_SRCS:.cpp=.o)
# COMPONENT_OBJS = $(COMPONENT_SRCS:.cpp=.o)
OBJS = $(addprefix $(BUILD_PATH), $(SRCS:.cpp=.o))
PKGCONF ?= pkg-config
ifneq ($(shell $(PKGCONF) --exists libdpdk && echo 0),0)
$(error "no installation of DPDK found")
endif
PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
COMPILE_OPT += -O3 $(shell $(PKGCONF) --cflags libdpdk)
COMPILE_OPT += -DALLOW_EXPERIMENTAL_API
LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
all: clean $(TARGET)
$(TARGET): $(OBJS)
$(CC) $(OBJS) -o $(BUILD_PATH)$(TARGET) $(LDFLAGS) -lpcap -luring -lnuma -pthread $(LDFLAGS_SHARED)
$(BUILD_PATH)$(TEST_PATH)%.o: $(TEST_PATH)%.cpp
mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(INC) -c $< -o $@ $(COMPILE_OPT)
$(BUILD_PATH)$(COMPONENT_PATH)%.o: $(COMPONENT_PATH)%.cpp
mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(INC) -c $< -o $@ $(COMPILE_OPT) $(LDFLAGS) $(LDFLAGS_SHARED)
clean:
rm -f $(BUILD_PATH)$(TARGET) $(BUILD_PATH)$(TEST_PATH)*.o $(BUILD_PATH)$(COMPONENT_PATH)*.o