github.com/tailscale/wireguard-go@v0.0.20201119-0.20210522003738-46b531feb08a/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) wireguard-go 18 19 wireguard-go: $(wildcard *.go) $(wildcard */*.go) 20 go build -v -o "$@" 21 22 install: wireguard-go 23 @install -v -d "$(DESTDIR)$(BINDIR)" && install -v -m 0755 "$<" "$(DESTDIR)$(BINDIR)/wireguard-go" 24 25 test: 26 go test -v ./... 27 28 clean: 29 rm -f wireguard-go 30 31 .PHONY: all clean test install generate-version-and-build