virtual-vxlan/Makefile

73 lines
1.7 KiB
Makefile
Raw Permalink Normal View History

2025-01-05 22:22:24 -06:00
VERSION ?= $(shell git describe --tags `git rev-list --tags --max-count=1`)
GITREV = $(shell git rev-parse --short HEAD)
BUILDTIME = $(shell date +'%FT%TZ%z')
PACKAGE_NAME := github.com/grmrgecko/virtual-vxlan
GO_BUILDER_VERSION ?= 1.23
.PHONY: default
default: build ;
.PHONY: build-sysroot
build-sysroot:
./sysroot/build.sh
.PHONY: build-docker-image
build-docker-image:
docker build -t goreleaser-cross --build-arg GO_BUILDER_VERSION=$(GO_BUILDER_VERSION) .
.PHONY: deps
deps:
2025-01-05 23:26:56 -06:00
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
go install golang.org/x/tools/cmd/goimports@latest
2025-01-05 22:22:24 -06:00
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
.PHONY: build
build:
go build
.PHONY: generate
generate:
go mod tidy
go get golang.org/x/tools/cmd/stringer@latest
go generate
.PHONY: clean
clean:
rm -rf virtual-vxlan* dist CHANGELOG.md
.PHONY: snapshot
snapshot:
2025-01-05 23:26:56 -06:00
mkdir -p .cache/go
2025-01-05 22:22:24 -06:00
docker run \
--rm --privileged \
2025-01-05 23:26:56 -06:00
--user 1000:1000 \
2025-01-05 22:22:24 -06:00
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(CURDIR):/go/src/$(PACKAGE_NAME) \
-v $(CURDIR)/sysroot:/sysroot \
2025-01-05 23:26:56 -06:00
-v $(CURDIR)/.cache:/.cache \
-v $(CURDIR)/.cache/go:/go \
2025-01-05 22:22:24 -06:00
-w /go/src/$(PACKAGE_NAME) \
goreleaser-cross:latest \
--clean --skip=publish --snapshot --verbose
.PHONY: release
2025-01-05 23:26:56 -06:00
release:
mkdir -p .cache/go
2025-01-05 22:22:24 -06:00
docker run \
--rm --privileged \
2025-01-05 23:26:56 -06:00
--user 1000:1000 \
2025-01-05 22:22:24 -06:00
--env-file .release-env \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(CURDIR):/go/src/$(PACKAGE_NAME) \
-v $(CURDIR)/sysroot:/sysroot \
2025-01-05 23:26:56 -06:00
-v $(CURDIR)/.cache:/.cache \
-v $(CURDIR)/.cache/go:/go \
2025-01-05 22:22:24 -06:00
-w /go/src/$(PACKAGE_NAME) \
goreleaser-cross:latest \
2025-01-05 23:26:56 -06:00
--clean --skip=validate
2025-01-05 22:22:24 -06:00
.PHONY: lint
lint:
golangci-lint run --fix