blob: 23bba17c8f3efcc13d52a2acf11caafec355f582 (
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
28
29
30
31
32
33
34
35
36
37
38
39
|
export CFLAGS := -O3 -Wall -std=gnu11
GOFLAGS := -ldflags="-H windowsgui -s -w" -v
WINDRES := x86_64-w64-mingw32-windres
export CGO_ENABLED := 1
export GOOS := windows
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
SOURCE_FILES := $(call rwildcard,,*.go *.c *.h)
RESOURCE_FILES := resources.rc manifest.xml ui/icon/icon.ico
DEPLOYMENT_HOST ?= winvm
DEPLOYMENT_PATH ?= Desktop
all: amd64/wireguard.exe x86/wireguard.exe
resources_amd64.syso: $(RESOURCE_FILES)
x86_64-w64-mingw32-windres -i $< -o $@ -O coff
resources_386.syso: $(RESOURCE_FILES)
i686-w64-mingw32-windres -i $< -o $@ -O coff
amd64/wireguard.exe: export CC := x86_64-w64-mingw32-gcc
amd64/wireguard.exe: export GOARCH := amd64
amd64/wireguard.exe: resources_amd64.syso $(SOURCE_FILES)
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)
go build $(GOFLAGS) -o $@
deploy: amd64/wireguard.exe
-ssh $(DEPLOYMENT_HOST) -- 'taskkill /im wireguard.exe /f'
scp $< $(DEPLOYMENT_HOST):$(DEPLOYMENT_PATH)
clean:
rm -rf *.syso x86/ amd64/
.PHONY: deploy clean all
|