summaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-10-09 18:11:36 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-09 18:13:56 +0200
commit5d6083df7e0399d9cbb47a9dc0b227fd86ccffbb (patch)
tree35c6ffd3ec526190c9917ec5398716fd80bbcf84 /Makefile
parentb41922e5c81a8121734143f9b773f976cd891081 (diff)
Switch to go modules
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 6 insertions, 23 deletions
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