-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
32 lines (30 loc) · 739 Bytes
/
Makefile
File metadata and controls
32 lines (30 loc) · 739 Bytes
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
PREFIX = /usr/local
GEOIP = utils/GeoLite2-City.mmdb
MAIN = cmd/*.go
APP = transport
VERSION = 1.0.0
TIME = $(shell date "+%F %T")
GIT = $(shell git rev-parse HEAD)
PKG = github.com/luopengift/version
FLAG = "-X '${PKG}.VERSION=${VERSION}' -X '${PKG}.APP=${APP}' -X '${PKG}.TIME=${TIME}' -X '${PKG}.GIT=${GIT}'"
build:
go build -ldflags $(FLAG) -o ${APP} ${MAIN}
update:
go get -u ./...
package: build
tar -cvf $(APP).tar.gz $(APP) config.json init.sh Makefile
install:
mv -f $(APP) $(PREFIX)/bin
fmt:
go fmt ./...
lint:
go vet ./...
test:
go test -short ./...
test-all: lint
go test ./...
clean:
rm -f $(APP)
rm -f $(APP).exe
rm -f $(PREFIX)/bin/$(APP)
.PHONY: build update package install fmt lint test test-all clean all