diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-03-07 06:27:53 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-03-07 20:55:12 +0100 |
commit | 439748fdeecad1e97307c2b0b154a6d1370b518c (patch) | |
tree | 2c825b68c237a877878ffbd626a822b63e2d8fac /Makefile | |
parent | names: better casing (diff) | |
download | wireguard-windows-439748fdeecad1e97307c2b0b154a6d1370b518c.tar.xz wireguard-windows-439748fdeecad1e97307c2b0b154a6d1370b518c.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.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -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 |