pomme/Makefile

38 lines
955 B
Makefile

CGO_ENABLED ?= 0
GOFLAGS ?= -trimpath -ldflags="-s -w"
PROG ?= pomme
GO_SOURCES ?= $(shell find . -name "*.go" -type f ! -name '*_test*')
GO_TEST_SOURCES ?= $(shell find . -name "*_test.go" -type f)
NODE_SOURCES ?= $(shell find ./frontend -type d \( -name node_modules -o -name .svelte-kit -o -name tests \) -prune -o -name '*.ts' -o -name '*.js' -o -name '*.html' -o -name '*.svelte' -o -name '*.json' -print)
all: frontend backend
.PHONY: frontend
frontend: $(NODE_SOURCES)
pnpm -F frontend build
.PHONY: backend
$(PROG): $(GO_SOURCES)
go build $(GOFLAGS) ./cmd/pomme
backend: $(PROG)
.PHONY: format format-frontend format-backend
format: format-frontend format-backend
format-frontend:
pnpm -F frontend format
format-backend:
gofmt -w -s .
.PHONY: lint lint-frontend lint-backend
lint: lint-frontend lint-backend
lint-frontend:
pnpm -F frontend lint
lint-backend:
golangci-lint run --timeout=5m --out-format colored-line-number:stdout