github.com/amnezia-vpn/amneziawg-go@v0.2.8/Makefile (about) 1 PREFIX ?= /usr 2 DESTDIR ?= 3 BINDIR ?= $(PREFIX)/bin 4 export GO111MODULE := on 5 6 all: generate-version-and-build 7 8 MAKEFLAGS += --no-print-directory 9 10 generate-version-and-build: 11 @export GIT_CEILING_DIRECTORIES="$(realpath $(CURDIR)/..)" && \ 12 tag="$$(git describe --dirty 2>/dev/null)" && \ 13 ver="$$(printf 'package main\n\nconst Version = "%s"\n' "$$tag")" && \ 14 [ "$$(cat version.go 2>/dev/null)" != "$$ver" ] && \ 15 echo "$$ver" > version.go && \ 16 git update-index --assume-unchanged version.go || true 17 @$(MAKE) amneziawg-go 18 19 amneziawg-go: $(wildcard *.go) $(wildcard */*.go) 20 go build -v -o "$@" 21 22 install: amneziawg-go 23 @install -v -d "$(DESTDIR)$(BINDIR)" && install -v -m 0755 "$<" "$(DESTDIR)$(BINDIR)/amneziawg-go" 24 25 test: 26 go test ./... 27 28 clean: 29 rm -f amneziawg-go 30 31 .PHONY: all clean test install generate-version-and-build