The Makefile build and prebaked-build targets now stamp Version=v$(VERSION)/masyunis via -ldflags. anubis.go keeps a link-time stamp instead of overwriting it with the VCS/module version from debug.ReadBuildInfo, and appends /masyunis when it does fall back to the module version. go run/go test still see 'devel'.
38 lines
941 B
Makefile
38 lines
941 B
Makefile
VERSION= $(shell cat ./VERSION)
|
|
VERSION_STRING= v$(VERSION)/masyunis
|
|
LDFLAGS_VERSION= -X 'github.com/TecharoHQ/anubis.Version=$(VERSION_STRING)'
|
|
GO?= go
|
|
NPM?= npm
|
|
|
|
.PHONY: build assets deps lint prebaked-build test
|
|
|
|
all: build
|
|
|
|
deps:
|
|
$(NPM) ci
|
|
$(GO) mod download
|
|
|
|
assets: PATH:=$(PWD)/node_modules/.bin:$(PATH)
|
|
assets: deps
|
|
$(GO) generate ./...
|
|
bash ./wasm/scripts/build_wasm.sh
|
|
bash ./wasm/scripts/build_wasm2js.sh
|
|
./web/build.sh
|
|
./xess/build.sh
|
|
|
|
build: assets
|
|
$(GO) build -o ./var/anubis -ldflags "$(LDFLAGS_VERSION)" ./cmd/anubis
|
|
$(GO) build -o ./var/robots2policy -ldflags "$(LDFLAGS_VERSION)" ./cmd/robots2policy
|
|
@echo "Anubis is now built to ./var/anubis"
|
|
|
|
lint: assets
|
|
$(GO) vet ./...
|
|
$(GO) tool staticcheck ./...
|
|
|
|
prebaked-build:
|
|
$(GO) build -o ./var/anubis -ldflags "$(LDFLAGS_VERSION)" ./cmd/anubis
|
|
$(GO) build -o ./var/robots2policy -ldflags "$(LDFLAGS_VERSION)" ./cmd/robots2policy
|
|
|
|
test: assets
|
|
$(GO) test ./...
|