aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Makefile
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-03-07 06:27:53 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-03-07 20:55:12 +0100
commit9c9c8d13bbc9b58de02271d4690cb20840c1d7c2 (patch)
tree2c825b68c237a877878ffbd626a822b63e2d8fac /Makefile
parentnames: better casing (diff)
downloadwireguard-windows-9c9c8d13bbc9b58de02271d4690cb20840c1d7c2.tar.xz
wireguard-windows-9c9c8d13bbc9b58de02271d4690cb20840c1d7c2.zip
ui: embed resource the old fashioned way
If we ever get rid of the cgo requirement, we can return to rsrc or some variant of it. But given that win32 GUI stuff benefits from the larger cgo stacks, that seems unlikely. This gives us a bit more latitude to embed all sorts of interesting things in here as well. Clean up the makefile while we're at it and reduce the size of the exe.
Diffstat (limited to '')
-rw-r--r--Makefile24
1 files changed, 16 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 0fb865a9..720c0099 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,27 @@
-CFLAGS ?= -O3
-CFLAGS += -Wall -std=gnu11
+export CFLAGS := -O3 -Wall -std=gnu11
+export CC := x86_64-w64-mingw32-gcc
+WINDRES := x86_64-w64-mingw32-windres
+export CGO_ENABLED := 1
+export GOOS := windows
+export GOARCH := amd64
+
+DEPLOYMENT_HOST ?= winvm
+DEPLOYMENT_PATH ?= Desktop
all: wireguard.exe
-resources.syso: ui/icon/icon.ico ui/manifest.xml go.mod
- go run github.com/akavel/rsrc -manifest ui/manifest.xml -ico ui/icon/icon.ico -arch amd64 -o resources.syso
+resources.syso: resources.rc manifest.xml ui/icon/icon.ico
+ $(WINDRES) -i $< -o $@ -O coff
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
wireguard.exe: resources.syso $(call rwildcard,,*.go *.c *.h)
- CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -ldflags="-H windowsgui" -o $@
+ go build -ldflags="-H windowsgui -s -w" -v -o $@
-run: wireguard.exe
- wine wireguard.exe
+deploy: wireguard.exe
+ -ssh $(DEPLOYMENT_HOST) -- 'taskkill /im wireguard.exe /f'
+ scp wireguard.exe $(DEPLOYMENT_HOST):$(DEPLOYMENT_PATH)
clean:
rm -rf resources.syso wireguard.exe
-.PHONY: run clean all
+.PHONY: deploy clean all