2018-02-09 21:20:32 +01:00
|
|
|
OS := $(shell uname)
|
|
|
|
ifeq ($(OS),Linux)
|
|
|
|
TAR_OPTS := --wildcards
|
|
|
|
endif
|
|
|
|
|
2016-04-15 17:59:56 +02:00
|
|
|
all: deps test vet install
|
2014-12-22 16:01:23 +01:00
|
|
|
|
2015-09-17 20:57:27 +02:00
|
|
|
fmt:
|
|
|
|
go fmt ./...
|
2013-09-08 19:37:41 +02:00
|
|
|
|
|
|
|
test:
|
2015-09-17 20:57:27 +02:00
|
|
|
go test ./...
|
2014-12-22 16:53:41 +01:00
|
|
|
|
2016-04-15 17:59:56 +02:00
|
|
|
vet:
|
|
|
|
go vet ./...
|
|
|
|
|
|
|
|
deps:
|
|
|
|
go get -d -v ./...
|
|
|
|
|
2015-09-17 20:57:27 +02:00
|
|
|
install:
|
2018-02-09 21:57:33 +01:00
|
|
|
go install ./...
|
2015-09-17 22:25:37 +02:00
|
|
|
|
2018-02-09 21:20:32 +01:00
|
|
|
databases := GeoLite2-City GeoLite2-Country
|
|
|
|
|
|
|
|
$(databases):
|
|
|
|
mkdir -p data
|
|
|
|
curl -fsSL -m 30 http://geolite.maxmind.com/download/geoip/database/$@.tar.gz | tar $(TAR_OPTS) --strip-components=1 -C $(PWD)/data -xzf - '*.mmdb'
|
|
|
|
test ! -f data/GeoLite2-City.mmdb || mv data/GeoLite2-City.mmdb data/city.mmdb
|
|
|
|
test ! -f data/GeoLite2-Country.mmdb || mv data/GeoLite2-Country.mmdb data/country.mmdb
|
|
|
|
|
|
|
|
geoip-download: $(databases)
|