forked from ntop/libebpfflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
48 lines (35 loc) · 1.56 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
#
# (C) 2018-22 - ntop.org
#
###############################################################
HAS_JSON=$(shell pkg-config --exists json-c; echo $$?)
ifeq ($(HAS_JSON), 0)
JSON_INC = $(shell pkg-config --cflags json-c) -DHAVE_JSONC
JSON_LIB = $(shell pkg-config --libs json-c)
endif
###############################################################
HAS_LIBCURL=$(shell pkg-config --exists libcurl; echo $$?)
ifeq ($(HAS_LIBCURL), 0)
LIBCURL_INC = $(shell pkg-config --cflags libcurl) -DHAVE_LIBCURL
LIBCURL_LIB = $(shell pkg-config --libs libcurl)
endif
###############################################################
CFLAGS=-std=c++11 -g -Wall $(JSON_INC) $(LIBCURL_INC) -fPIC
LIBS=-lbcc -lzmq $(JSON_LIB) $(LIBCURL_LIB)
GOROOT=
all: ebpflowexport
container_info.o: container_info.cpp container_info.h
g++ -c $(CFLAGS) container_info.cpp -o container_info.o
libebpfflow.a: ebpf_flow.cpp ebpf_flow.h container_info.o ebpflow.ebpf.enc
g++ -c $(CFLAGS) ebpf_flow.cpp -o ebpf_flow.o
ar rvs $@ ebpf_flow.o container_info.o
ebpflowexport: ebpflowexport.cpp libebpfflow.a Makefile
g++ $(CFLAGS) ebpflowexport.cpp -o $@ libebpfflow.a $(LIBS)
ebpflow.ebpf.enc: ebpflow_header.ebpf ebpf_types.h ebpflow_code.ebpf Makefile
echo -n "const char * ebpf_code = R\"(" > ebpflow.ebpf.enc
cat ebpflow_header.ebpf ebpf_types.h ebpflow_code.ebpf | base64 -w 0 >> ebpflow.ebpf.enc
echo ")\";" >> ebpflow.ebpf.enc
go_ebpflowexport: ebpflowexport.go Makefile libebpfflow.a
go build -o go_ebpflowexport ebpflowexport.go
clean:
/bin/rm -f *~ container_info.a libebpfflow.a *.o ebpflow.ebpf.enc