-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
42 lines (35 loc) · 1.13 KB
/
Makefile
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
40
41
42
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
GOARM ?= $(shell go env GOARM)
.PHONY: all
all: openvpn
.PHONY: openvpn
openvpn:
go build ./cmd/openvpn
.PHONY: dist
dist: openvpn-$(GOOS)-$(GOARCH).tar.gz
.PHONY: dist-all
dist-all: openvpn-linux-amd64.tar.gz
dist-all: openvpn-linux-arm64.tar.gz
dist-all: openvpn-windows-amd64.zip
openvpn-linux-amd64.tar.gz: GOOS := linux
openvpn-linux-amd64.tar.gz: GOARCH := amd64
openvpn-linux-arm64.tar.gz: GOOS := linux
openvpn-linux-arm64.tar.gz: GOARCH := arm64
openvpn-windows-amd64.zip: GOOS := windows
openvpn-windows-amd64.zip: GOARCH := amd64
openvpn-windows-amd64.zip: EXT := .exe
openvpn-%.tar.gz:
mkdir -p "dist/openvpn-$*"
env GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o "dist/openvpn-$*/openvpn$(EXT)" -ldflags "-w -s" ./cmd/openvpn
cp openvpn.conf "dist/openvpn-$*"
cd dist && tar czf "$@" "openvpn-$*"
openvpn-%.zip:
mkdir -p "dist/openvpn-$*"
env GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o "dist/openvpn-$*/openvpn$(EXT)" -ldflags "-w -s" ./cmd/openvpn
cp openvpn.conf "dist/openvpn-$*"
cd dist && zip -r "$@" "openvpn-$*"
.PHONY: clean
clean:
rm -f openvpn{,.exe}
rm -rf dist