2024-01-01 09:55:49 +00:00
|
|
|
.PHONY: build run ci get-alpine-rootfs
|
|
|
|
.EXPORT_ALL_VARIABLES:
|
2023-12-29 23:37:59 +00:00
|
|
|
|
2024-01-01 09:55:49 +00:00
|
|
|
GOARCH=amd64
|
|
|
|
#GOARCH=arm
|
|
|
|
#GOOS=darwin
|
|
|
|
GOOS=linux
|
2023-12-29 23:37:59 +00:00
|
|
|
|
2024-01-01 09:55:49 +00:00
|
|
|
LDFLAGS=-w -s -X antoine-roux.tk/projects/go/firecracker-netns/internal/version.Version=$$(git rev-list -1 HEAD)
|
|
|
|
GOBUILDFLAGS=-tags dev
|
|
|
|
|
|
|
|
EXEC=out/main
|
|
|
|
|
|
|
|
build: out/alpine-minirootfs-3.19.0-x86_64.tar.gz $(EXEC)
|
|
|
|
|
|
|
|
run: $(EXEC)
|
|
|
|
@chmod +x $(EXEC)
|
|
|
|
$(EXEC)
|
2023-12-29 23:37:59 +00:00
|
|
|
|
|
|
|
ci:
|
|
|
|
golangci-lint run --fix
|
2024-01-01 09:55:49 +00:00
|
|
|
|
|
|
|
get-alpine-rootfs: out/alpine-minirootfs-3.19.0-x86_64.tar.gz
|
|
|
|
|
|
|
|
publish:
|
|
|
|
scp $(EXEC) sf314:~/firecracker/
|
|
|
|
|
|
|
|
dependencies:
|
|
|
|
go mod download
|
|
|
|
go mod verify
|
|
|
|
|
|
|
|
$(EXEC): cmd/main.go dependencies
|
|
|
|
@echo "build for os $$GOOS and arch $$GOARCH"
|
|
|
|
go build -o $@ -ldflags="$(LDFLAGS)" $(GOBUILDFLAGS) $<
|
|
|
|
|
|
|
|
out/alpine-minirootfs-3.19.0-x86_64.tar.gz:
|
|
|
|
wget -O $@ https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/x86_64/alpine-minirootfs-3.19.0-x86_64.tar.gz
|