.PHONY: dev-backend dev-frontend build clean

dev-backend:
	cd backend && GO111MODULE=on go run ./cmd/server

dev-frontend:
	cd frontend && pnpm dev

build:
	cd frontend && pnpm install && pnpm build
	find backend/static -not -name 'embed.go' -not -name '.gitkeep' -not -path backend/static -delete
	cp -r frontend/dist/* backend/static/
	cd backend && GO111MODULE=on CGO_ENABLED=1 go build -o ../krafttrainer ./cmd/server

clean:
	rm -f krafttrainer
	rm -rf frontend/dist
	find backend/static -not -name '.gitkeep' -not -path backend/static -delete 2>/dev/null || true
