-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (25 loc) · 712 Bytes
/
Makefile
File metadata and controls
36 lines (25 loc) · 712 Bytes
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
# Taken from: https://github.com/dropbox/goebpf/blob/master/examples/xdp/basic_firewall/Makefile
# Copyright (c) 2019 Dropbox, Inc.
# Full license can be found in the LICENSE file.
GOCMD := go
GOBUILD := $(GOCMD) build
GOCLEAN := $(GOCMD) clean
CLANG := clang
CLANG_INCLUDE := -I../../..
GO_SOURCE := main.go wall.go
GO_BINARY := thewall
EBPF_SOURCE := ebpf_prog/xdp_fw.c
EBPF_BINARY := ebpf_prog/xdp_fw.elf
all: build_bpf build_go
build_bpf: $(EBPF_BINARY)
build_go: $(GO_BINARY)
clean:
$(GOCLEAN)
rm -f $(GO_BINARY)
rm -f $(EBPF_BINARY)
test:
go test -v ./...
$(EBPF_BINARY): $(EBPF_SOURCE)
$(CLANG) $(CLANG_INCLUDE) -O2 -target bpf -c $^ -o $@
$(GO_BINARY): $(GO_SOURCE)
$(GOBUILD) -v -o $@