Makefile 1001 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. SHA := $(shell git rev-parse HEAD)
  2. ASSETS := \
  3. internal/ui/assets/edit/index.html \
  4. internal/ui/assets/index.html
  5. .PHONY: all clean develop publish
  6. all: bin/go
  7. bin/go: cmd/go/main.go $(ASSETS) $(shell find internal -name '*.go')
  8. go build -o $@ ./cmd/go
  9. bin/devserver: cmd/devserver/main.go $(ASSETS)
  10. go build -o $@ ./cmd/devserver
  11. node_modules/.build: package.json
  12. npm install
  13. touch $@
  14. internal/ui/assets/edit/index.html: node_modules/.build $(shell find ui -type f)
  15. npm run build
  16. internal/ui/assets/index.html: node_modules/.build $(shell find ui -type f)
  17. npm run build
  18. develop: bin/devserver bin/go
  19. bin/devserver
  20. clean:
  21. rm -rf bin internal/ui/assets
  22. bin/buildimg:
  23. GOBIN="$(CURDIR)/bin" go install github.com/kellegous/buildimg@latest
  24. bin/publish: cmd/publish/main.go
  25. go build -o $@ ./cmd/publish
  26. publish: bin/publish
  27. bin/publish \
  28. --tag=latest \
  29. --tag=$(shell git rev-parse --short $(SHA)) \
  30. --platform=linux/arm64 \
  31. --platform=linux/amd64 \
  32. --image=kellegous/go