export DEBUG = routewatch

.PHONY: test fmt lint build clean run asupdate

all: test

test: lint
	go test -v ./...

fmt:
	go fmt ./...

lint:
	go vet ./...
	golangci-lint run

build:
	CGO_ENABLED=1 go build -o bin/routewatch cmd/routewatch/main.go

clean:
	rm -rf bin/

run: build
	DEBUG=routewatch ./bin/routewatch 2>&1 | tee log.txt

asupdate:
	@echo "Updating AS info data..."
	@go run cmd/asinfo-gen/main.go | gzip > pkg/asinfo/asdata.json.gz.tmp && \
		mv pkg/asinfo/asdata.json.gz.tmp pkg/asinfo/asdata.json.gz
