forked from mushorg/glutton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (29 loc) · 779 Bytes
/
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
VERSION := v1.0.1
NAME := glutton
BUILDSTRING := $(shell git log --pretty=format:'%h' -n 1)
VERSIONSTRING := $(NAME) version $(VERSION)+$(BUILDSTRING)
BUILDDATE := $(shell date -u -Iseconds)
LDFLAGS := "-X \"main.VERSION=$(VERSIONSTRING)\" -X \"main.BUILDDATE=$(BUILDDATE)\""
.PHONY: all test clean build
.PHONY: tag
tag:
git tag $(VERSION)
git push origin --tags
.PHONY: upx
upx:
cd bin; find . -type f -exec upx "{}" \;
default: build
build:
go build -ldflags=$(LDFLAGS) -o bin/server app/server.go
static:
go build --ldflags '-extldflags "-static"' -o bin/server app/server.go
upx -1 bin/server
clean:
rm -rf bin/
run: build
sudo bin/server -i eth0
docker:
docker build -t glutton .
docker run --rm --cap-add=NET_ADMIN -it glutton
test:
go test -v ./...