.PHONY: deps dev build install image test clean CGO_ENABLED=0 VERSION=$(shell git describe --abbrev=0 --tags 2>/dev/null || echo "$VERSION") COMMIT=$(shell git rev-parse --short HEAD || echo "$COMMIT") all: build deps: @go get -u github.com/GeertJohan/go.rice/rice @go get -u github.com/tdewolff/minify/v2/cmd/... dev : DEBUG=1 dev : build @./twt -v @./twtd -D -O -R cli: @go build -tags "netgo static_build" -installsuffix netgo \ -ldflags "-w \ -X $(shell go list).Version=$(VERSION) \ -X $(shell go list).Commit=$(COMMIT)" \ ./cmd/twt/... server: generate @go build -tags "netgo static_build" -installsuffix netgo \ -ldflags "-w \ -X $(shell go list).Version=$(VERSION) \ -X $(shell go list).Commit=$(COMMIT)" \ ./cmd/twtd/... build: cli server generate: @if [ x"$(DEBUG)" = x"1" ]; then \ echo 'Running in debug mode...'; \ rm -f -v ./internal/rice-box.go; \ else \ minify -b -o ./internal/static/css/spyda.min.css ./internal/static/css/[0-9]*-*.css; \ minify -b -o ./internal/static/js/spyda.min.js ./internal/static/js/[0-9]*-*.js; \ rm -f ./internal/rice-box.go; \ rice -i ./internal embed-go; \ fi install: build @go install ./cmd/twt/... @go install ./cmd/twtd/... ifeq ($(PUBLISH), 1) image: @docker build --build-arg VERSION="$(VERSION)" --build-arg COMMIT="$(COMMIT)" -t r.mills.io/prologic/spyda . @docker push r.mills.io/prologic/spyda else image: @docker build --build-arg VERSION="$(VERSION)" --build-arg COMMIT="$(COMMIT)" -t r.mills.io/prologic/spyda . endif test: @go test -v -cover -race ./... clean: @git clean -f -d -X