-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMakefile
47 lines (35 loc) · 1 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
43
44
45
46
47
.PHONY: build-tunc build-tuns dist
VERSION ?= `git describe --tags --always`
PACKAGE := github.com/4396/tun
DIST_DIRS := find * -type d -exec
LDFLAGS := -ldflags "-w -s"
build-tunc:
go build ${LDFLAGS} -o ./bin/tunc ./cmd/tunc/*.go
build-tuns:
go build ${LDFLAGS} -o ./bin/tuns ./cmd/tuns/*.go
dist:
go get -u github.com/franciscocpg/gox
gox -verbose ${LDFLAGS} \
-os="linux windows" \
-arch="amd64 386" \
-osarch="darwin/amd64 linux/arm" \
-output="dist/{{.OS}}_{{.Arch}}/{{.Dir}}" ${PACKAGE}/cmd/tuns ${PACKAGE}/cmd/tunc
cd dist && \
$(DIST_DIRS) cp ../conf/*.ini {} \; && \
$(DIST_DIRS) tar -zcf tun_${VERSION}_{}.tar.gz {} \; && \
$(DIST_DIRS) zip -r tun_${VERSION}_{}.zip {} \; && \
cd ..
clean-tunc:
rm -f ./bin/tunc
clean-tuns:
rm -f ./bin/tuns
clean-dist:
rm -rf ./dist
build: build-tunc build-tuns
clean: clean-tunc clean-tuns clean-dist
dep:
go get github.com/golang/glog
go get github.com/golang/snappy
go get github.com/pkg/errors
go get github.com/xtaci/smux
go get gopkg.in/ini.v1