summary refs log tree commit diff
path: root/Makefile
blob: 11b7f9a8e9fb73f16bb2d9299f83e31a6f6a4367 (plain) (blame)
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
FC_VERSION?=0.24.3-x86_64
FC_BINARY?=hack/firecracker/firecracker-v$(FC_VERSION)

FCNET_CONFIG?=/etc/cni/conf.d/50-c2vm.conflist
CNI_BIN_ROOT?=/opt/cni/bin
CNI_TAP_PLUGIN?=$(CNI_BIN_ROOT)/tc-redirect-tap

.PHONY: build
build:
	@go build -o c2vm cmd/c2vm/main.go

$(FC_BINARY):
	@mkdir -p hack/firecracker
	@curl -L -o hack/firecracker/firecracker.tgz -s https://github.com/firecracker-microvm/firecracker/releases/download/v0.24.3/firecracker-v$(FC_VERSION).tgz
	@tar xvzf hack/firecracker/firecracker.tgz -C hack/firecracker

$(FCNET_CONFIG):
	@sudo mkdir -p $(dir $(FCNET_CONFIG))
	@sudo cp hack/cni/50-c2vm.conflist $(FCNET_CONFIG)

$(CNI_TAP_PLUGIN):
	@go install github.com/awslabs/tc-redirect-tap/cmd/tc-redirect-tap@latest
	@sudo cp ${GOPATH}/bin/tc-redirect-tap $(CNI_BIN_ROOT)

.PHONY: all
all: build $(FC_BINARY) $(FCNET_CONFIG) $(CNI_TAP_PLUGIN)