aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Makefile
blob: 720c0099490ef906d3d818e75680d17d88b47160 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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: 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)
	go build -ldflags="-H windowsgui -s -w" -v -o $@

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: deploy clean all