EtherGuard-VPN/Makefile

35 lines
992 B
Makefile
Raw Normal View History

2018-05-15 02:15:16 +02:00
PREFIX ?= /usr
DESTDIR ?=
BINDIR ?= $(PREFIX)/bin
2018-05-20 03:18:47 +02:00
ifeq ($(shell go env GOOS),linux)
ifeq ($(wildcard .git),)
$(error Do not build this for Linux. Instead use the Linux kernel module. See wireguard.com/install/ for more info.)
2018-06-13 16:21:59 +02:00
else
$(shell printf 'package main\nconst UseTheKernelModuleInstead = 0xdeadbabe\n' > ireallywantobuildon_linux.go)
2018-05-20 03:18:47 +02:00
endif
endif
2018-10-09 18:11:36 +02:00
export GOPATH ?= $(CURDIR)/.gopath
2018-10-09 18:11:36 +02:00
all: wireguard-go
2018-05-24 01:52:22 +02:00
version.go:
@export GIT_CEILING_DIRECTORIES="$(realpath $(CURDIR)/..)" && \
tag="$$(git describe --dirty 2>/dev/null)" && \
ver="$$(printf 'package main\nconst WireGuardGoVersion = "%s"\n' "$$tag")" && \
[ "$$(cat $@ 2>/dev/null)" != "$$ver" ] && \
echo "$$ver" > $@ && \
git update-index --assume-unchanged $@ || true
2018-10-09 18:11:36 +02:00
wireguard-go: $(wildcard *.go) $(wildcard */*.go)
go build -v -o "$@"
2018-05-15 02:15:16 +02:00
install: wireguard-go
2018-10-09 18:11:36 +02:00
@install -v -d "$(DESTDIR)$(BINDIR)" && install -v -m 0755 "$<" "$(DESTDIR)$(BINDIR)/wireguard-go"
clean:
rm -f wireguard-go
2018-10-09 18:11:36 +02:00
.PHONY: clean install version.go