aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Makefile
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-08-27 08:11:01 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2019-08-27 12:12:46 -0600
commitd61926b6788a3c011f4d36ada8b4fcadb306f7b0 (patch)
tree4e7e8ae27ebb69d60180c037831fa249fbbeeba1 /Makefile
parentbuild: use goproxy when not remastering (diff)
downloadwireguard-windows-d61926b6788a3c011f4d36ada8b4fcadb306f7b0.tar.xz
wireguard-windows-d61926b6788a3c011f4d36ada8b4fcadb306f7b0.zip
build: backport resume monitoring for timers
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 17 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index c622fce8..67d85c6c 100644
--- a/Makefile
+++ b/Makefile
@@ -3,16 +3,31 @@ export CGO_ENABLED := 1
export CGO_CFLAGS := -O3 -Wall -Wno-unused-function -Wno-switch -std=gnu11 -DWINVER=0x0601
export CGO_LDFLAGS := -Wl,--major-os-version=6 -Wl,--minor-os-version=1 -Wl,--major-subsystem-version=6 -Wl,--minor-subsystem-version=1 -Wl,--tsaware
export GOOS := windows
+OLD_GOROOT := $(GOROOT)
+export GOROOT := $(CURDIR)/.deps/goroot
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
-SOURCE_FILES := $(call rwildcard,,*.go *.c *.h)
+SOURCE_FILES := $(call rwildcard,,*.go *.c *.h) .deps/prepared
RESOURCE_FILES := resources.rc version.h manifest.xml $(patsubst %.svg,%.ico,$(wildcard ui/icon/*.svg))
+REQUIRED_GO_VERSION := go1.13beta1
+ifneq ($(shell go version 2>/dev/null | cut -d ' ' -f 3),$(REQUIRED_GO_VERSION))
+$(error $(REQUIRED_GO_VERSION) is required)
+endif
+
DEPLOYMENT_HOST ?= winvm
DEPLOYMENT_PATH ?= Desktop
all: amd64/wireguard.exe x86/wireguard.exe
+.deps/prepared: export GOROOT := $(OLD_GOROOT)
+.deps/prepared: $(wildcard golang-*.patch)
+ rm -rf .deps && mkdir -p .deps
+ if ! rsync --exclude=pkg/obj/go-build/trim.txt -aq $$(go env GOROOT)/ .deps/goroot; then chmod -R +w .deps/goroot; exit 1; fi
+ chmod -R +w .deps/goroot
+ cat $^ | patch -f -N -r- -p1 -d .deps/goroot
+ touch $@
+
%.ico: %.svg
convert -background none $< -define icon:auto-resize="256,128,96,64,48,32,16" $@
@@ -22,18 +37,14 @@ resources_amd64.syso: $(RESOURCE_FILES)
resources_386.syso: $(RESOURCE_FILES)
i686-w64-mingw32-windres -i $< -o $@ -O coff
-VERSIONCHECK := @[ "$$(go version | cut -d ' ' -f 3)" == go1.13beta1 ]
-
amd64/wireguard.exe: export CC := x86_64-w64-mingw32-gcc
amd64/wireguard.exe: export GOARCH := amd64
amd64/wireguard.exe: resources_amd64.syso $(SOURCE_FILES)
- $(VERSIONCHECK)
go build $(GOFLAGS) -o $@
x86/wireguard.exe: export CC := i686-w64-mingw32-gcc
x86/wireguard.exe: export GOARCH := 386
x86/wireguard.exe: resources_386.syso $(SOURCE_FILES)
- $(VERSIONCHECK)
go build $(GOFLAGS) -o $@
remaster: export CC := x86_64-w64-mingw32-gcc
@@ -54,6 +65,6 @@ deploy: amd64/wireguard.exe
scp $< $(DEPLOYMENT_HOST):$(DEPLOYMENT_PATH)
clean:
- rm -rf *.syso ui/icon/*.ico x86/ amd64/ .deps
+ rm -rf *.syso ui/icon/*.ico x86/ amd64/ .deps/
.PHONY: deploy clean fmt remaster all