From 5d6083df7e0399d9cbb47a9dc0b227fd86ccffbb Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 9 Oct 2018 18:11:36 +0200 Subject: Switch to go modules --- Makefile | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e10fdc2..6b95f89 100644 --- a/Makefile +++ b/Makefile @@ -10,11 +10,9 @@ $(shell printf 'package main\nconst UseTheKernelModuleInstead = 0xdeadbabe\n' > endif endif -all: wireguard-go +export GOPATH ?= $(CURDIR)/.gopath -export GOPATH := $(CURDIR)/.gopath -export PATH := $(PATH):$(CURDIR)/.gopath/bin -GO_IMPORT_PATH := git.zx2c4.com/wireguard-go +all: wireguard-go version.go: @export GIT_CEILING_DIRECTORIES="$(realpath $(CURDIR)/..)" && \ @@ -24,28 +22,13 @@ version.go: echo "$$ver" > $@ && \ git update-index --assume-unchanged $@ || true -.gopath/.created: - rm -rf .gopath - mkdir -p $(dir .gopath/src/$(GO_IMPORT_PATH)) - ln -s ../../.. .gopath/src/$(GO_IMPORT_PATH) - touch $@ - -vendor/.created: Gopkg.toml Gopkg.lock | .gopath/.created - command -v dep >/dev/null || go get -v github.com/golang/dep/cmd/dep - export PWD; cd .gopath/src/$(GO_IMPORT_PATH) && dep ensure -vendor-only -v - touch $@ - -wireguard-go: $(wildcard *.go) $(wildcard */*.go) .gopath/.created vendor/.created version.go - go build -v $(GO_IMPORT_PATH) +wireguard-go: $(wildcard *.go) $(wildcard */*.go) + go build -v -o "$@" install: wireguard-go - @install -v -d "$(DESTDIR)$(BINDIR)" && install -v -m 0755 wireguard-go "$(DESTDIR)$(BINDIR)/wireguard-go" + @install -v -d "$(DESTDIR)$(BINDIR)" && install -v -m 0755 "$<" "$(DESTDIR)$(BINDIR)/wireguard-go" clean: rm -f wireguard-go -update-dep: | .gopath/.created - command -v dep >/dev/null || go get -v github.com/golang/dep/cmd/dep - cd .gopath/src/$(GO_IMPORT_PATH) && dep ensure -update -v - -.PHONY: clean install update-dep version.go +.PHONY: clean install version.go -- cgit v1.2.3