-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
89 lines (67 loc) · 1.99 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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
SHELL := /bin/bash
A ?= weaver_whitebox.c
T ?= pcap
C ?= stack_conf
bb := weaver_blackbox.c
wb := weaver_whitebox.template.c
sep = Weaver Auto-generated Blackbox Code
BUILD_DIR = ./build/
APP = procpkts
TARGET_FLAG = -DWV_TARGET_$(T)
export TARGET_FLAG
### GCC ###
GCC = gcc
GCC_OPT = -m64 # -Wall -DNEWEV -Werror
GCC_OPT += -g -DNETSTAT -DINFO -DDBGERR -DDBGCERR
# GCC_OPT += -O3 -DNDEBUG -DNETSTAT -DINFO -DDBGERR -DDBGCERR
GCC_OPT += $(DBG_OPT)
### LIBRARIES AND INCLUDES ###
INC_DIR = ./native
INC= -I$(INC_DIR) -I$(INC_DIR)/runtime -I$(INC_DIR)/runtime/tommyds
### SOURCE FILES ###
LIB_FLAGS += -lstdc++ -lpcre2-8
ifeq ($(T), pcap)
LIB_FLAGS += -lpcap
endif
ifeq ($(T), dpdk)
ifeq ($(RTE_SDK),)
$(error "Please define RTE_SDK environment variable")
endif
RTE_TARGET ?= x86_64-native-linuxapp-gcc
NIC ?= XL710
FWD ?= FWD
PERF ?= EVAL_PERF
SRC_DIR = $(PWD)
SRCS = $(bb) $(A) native/drivers/$(T).c $(SRC_DIR)/native/runtime/libwvrt.a
DPDK_INC = -I$(SRC_DIR)/native/ -I$(SRC_DIR)/native/runtime -I$(SRC_DIR)/native/runtime/tommyds
include $(RTE_SDK)/mk/rte.vars.mk
CFLAGS += $(DPDK_INC) -D$(NIC) -D$(PERF) $(GCC_OPT) -D$(FWD)
LDFLAGS += -lpcre2-8
SRCS-y := $(SRCS)
include $(RTE_SDK)/mk/rte.extapp.mk
$(SRC_DIR)/native/runtime/libwvrt.a:
cd $(SRC_DIR)/native/runtime && $(MAKE) -C .
endif
ifeq ($(T), pcap)
### GOALS ###
SRCS = $(bb) $(A) native/drivers/$(T).c native/runtime/libwvrt.a
all: $(APP)
$(APP): $(SRCS)
$(GCC) $(GCC_OPT) -o $@ $^ $(INC) $(LIBS) $(LIB_FLAGS) $(TARGET_FLAG)
native/runtime/libwvrt.a:
$(MAKE) -C native/runtime
clean:
-$(RM) procpkts $(wb) $(bb)
-$(RM) -rf build/
-$(RM) native/weaver.h.gch
-$(RM) test_seq
$(MAKE) -C native/runtime clean
.PHONY: all clean weaver_blackbox.c native/runtime/libwvrt.a
endif
gen:
# https://stackoverflow.com/a/7104422
python3 -m rubik $(C) | tee >(sed -e "/$(sep)/,\$$d" > $(wb)) | sed -n -e "/$(sep)/,\$$w $(bb)"
test: test_seq
./test_seq
test_seq: native/runtime/seq_test.c native/runtime/seq.h
$(GCC) -o test_seq native/runtime/seq_test.c