Makefile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. BINARY := bin/wikijs-mcp
  2. VERSION ?= $(shell git describe --tags --dirty 2>/dev/null || echo dev)
  3. LDFLAGS := -s -w -X main.version=$(VERSION)
  4. .PHONY: build test test-race vet fmt check run run-http docker-up docker-down clean help
  5. build:
  6. @mkdir -p bin
  7. go build -trimpath -ldflags '$(LDFLAGS)' -o $(BINARY) ./cmd/wikijs-mcp
  8. test:
  9. go test ./...
  10. test-race:
  11. go test -race ./...
  12. vet:
  13. go vet ./...
  14. fmt:
  15. gofmt -w .
  16. check: vet test-race
  17. run: build
  18. ./$(BINARY)
  19. run-http: build
  20. ./$(BINARY) -transport http -addr 127.0.0.1:8080 -path /mcp
  21. docker-up:
  22. docker compose up -d
  23. docker-down:
  24. docker compose down
  25. clean:
  26. rm -rf bin
  27. help:
  28. @echo "Targets:"
  29. @echo " build build $(BINARY)"
  30. @echo " test run unit tests"
  31. @echo " test-race run unit tests with the race detector"
  32. @echo " vet run go vet"
  33. @echo " check vet + race tests"
  34. @echo " run build and run with the stdio transport"
  35. @echo " run-http build and run with the HTTP transport on 127.0.0.1:8080"
  36. @echo " docker-up start a local WikiJS stack"
  37. @echo " docker-down stop the local WikiJS stack"
  38. @echo " clean remove build artifacts"