.DEFAULT_GOAL := all

# seems superfluous
#.PHONY: fmt vet build clean

fmt:
	go fmt ./...


generate:
	templ generate
	cp LICENSE pkg/server/ui
	cp licenses/LICENSE* pkg/server/ui

vet: fmt
	go vet ./...

test: build
	go test -count=1 ${TESTFLAGS} ./pkg/... ./cmd/...
        
integrationtest: build
	go test -count=1 ${TESTFLAGS} ./integrationtest/...

build: generate vet
	mkdir -p bin
	go build -o bin ./cmd/...

buildwin: 
	mkdir -p bin
	GOOS=windows GOARCH=amd64 go build -o bin ./cmd/...

clean:
	rm -rf bin
	rm -rf static/icons
	rm -f pkg/server/ui/LICENSE*

static/icons/.downloaded:
	./getbootstrapicons.sh
	touch static/icons/.downloaded

icons: static/icons/.downloaded

all: icons build buildwin

images:
	docker compose --profile build build

push: images
	docker compose --profile build push