-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (36 loc) · 1.35 KB
/
Makefile
File metadata and controls
50 lines (36 loc) · 1.35 KB
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
48
49
50
SOURCES = $(shell find ./ -type f -name '*.go' | grep -vE './(build|vendor)/' )
PREDICATES ?= geoip
PLUGINS = $(shell for t in $(PREDICATES); do echo build/pred_$$t.so; done )
CURRENT_VERSION = $(shell git tag | sort -V | tail -n1)
VERSION ?= $(CURRENT_VERSION)
COMMIT_HASH = $(shell git rev-parse --short HEAD)
XGOPATH = $(HOME)/go
default: plugins
plugins: deps $(PLUGINS) checks
geoipdb: GeoLite2-Country.mmdb
GeoLite2-Country.mmdb: GeoLite2-Country.tar.gz
tar xvzf GeoLite2-Country.tar.gz --wildcards --strip-components=1 '*/GeoLite2-Country.mmdb'
GeoLite2-Country.tar.gz:
wget -O GeoLite2-Country.tar.gz http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.tar.gz
deps:
go get -t github.com/zalando/skipper
go get -t github.com/opentracing/opentracing-go
# glide update
glide install
checks: vet fmt tests
tests: geoipdb
go test -run LoadPredicate
vet: $(SOURCES)
go vet $(shell for t in $(FILTERS); do echo ./$$t/...; done )
fmt: $(SOURCES)
@if [ "$$(gofmt -d $(SOURCES))" != "" ]; then false; else true; fi
test:
go test -v
$(PLUGINS): $(SOURCES)
mkdir -p build/
MODULE=$(shell basename $@ .so | sed -e 's/pred_//' ); \
go build -buildmode=plugin -o $@ $$MODULE/$$MODULE.go
clean:
rm -f build/*.so
realclean: clean
rm -f GeoLite2-Country.mmdb GeoLite2-Country.tar.gz