Makefile 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. export NAME=ecal
  2. export TAG=`git describe --abbrev=0 --tags`
  3. # CGO_ENABLED is enabled here to support Go plugins
  4. # if Go plugins are not used this can be disabled.
  5. export CGO_ENABLED=1
  6. export GOOS=linux
  7. all: build
  8. clean:
  9. rm -f ecal
  10. mod:
  11. go mod init || true
  12. go mod tidy
  13. test:
  14. go test -p 1 ./...
  15. cover:
  16. go test -p 1 --coverprofile=coverage.out ./...
  17. go tool cover --html=coverage.out -o coverage.html
  18. sh -c "open coverage.html || xdg-open coverage.html" 2>/dev/null
  19. fmt:
  20. gofmt -l -w -s .
  21. vet:
  22. go vet ./...
  23. generate:
  24. go generate devt.de/krotik/ecal/stdlib/generate
  25. build: clean mod generate fmt vet
  26. go build -ldflags "-s -w" -o $(NAME) cli/*.go
  27. build-mac: clean mod generate fmt vet
  28. CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o $(NAME).mac cli/*.go
  29. build-win: clean mod generate fmt vet
  30. CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o $(NAME).exe cli/*.go
  31. build-arm7: clean mod generate fmt vet
  32. CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -o $(NAME).arm7 cli/*.go
  33. build-arm8: clean mod generate fmt vet
  34. CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o $(NAME).arm8 cli/*.go
  35. dist: build build-win build-mac build-arm7 build-arm8
  36. rm -fR dist
  37. mkdir -p dist/$(NAME)_linux_amd64
  38. mv $(NAME) dist/$(NAME)_linux_amd64
  39. cp -fR examples dist/$(NAME)_linux_amd64
  40. cp LICENSE dist/$(NAME)_linux_amd64
  41. cp NOTICE dist/$(NAME)_linux_amd64
  42. tar --directory=dist -cz $(NAME)_linux_amd64 > dist/$(NAME)_$(TAG)_linux_amd64.tar.gz
  43. mkdir -p dist/$(NAME)_darwin_amd64
  44. mv $(NAME).mac dist/$(NAME)_darwin_amd64/$(NAME)
  45. cp -fR examples dist/$(NAME)_darwin_amd64
  46. cp LICENSE dist/$(NAME)_darwin_amd64
  47. cp NOTICE dist/$(NAME)_darwin_amd64
  48. tar --directory=dist -cz $(NAME)_darwin_amd64 > dist/$(NAME)_$(TAG)_darwin_amd64.tar.gz
  49. mkdir -p dist/$(NAME)_windows_amd64
  50. mv $(NAME).exe dist/$(NAME)_windows_amd64
  51. cp -fR examples dist/$(NAME)_windows_amd64
  52. cp LICENSE dist/$(NAME)_windows_amd64
  53. cp NOTICE dist/$(NAME)_windows_amd64
  54. tar --directory=dist -cz $(NAME)_windows_amd64 > dist/$(NAME)_$(TAG)_windows_amd64.tar.gz
  55. mkdir -p dist/$(NAME)_arm7
  56. mv $(NAME).arm7 dist/$(NAME)_arm7
  57. cp -fR examples dist/$(NAME)_arm7
  58. cp LICENSE dist/$(NAME)_arm7
  59. cp NOTICE dist/$(NAME)_arm7
  60. tar --directory=dist -cz $(NAME)_arm7 > dist/$(NAME)_$(TAG)_arm7.tar.gz
  61. mkdir -p dist/$(NAME)_arm8
  62. mv $(NAME).arm8 dist/$(NAME)_arm8
  63. cp -fR examples dist/$(NAME)_arm8
  64. cp LICENSE dist/$(NAME)_arm8
  65. cp NOTICE dist/$(NAME)_arm8
  66. tar --directory=dist -cz $(NAME)_arm8 > dist/$(NAME)_$(TAG)_arm8.tar.gz
  67. sh -c 'cd dist; sha256sum *.tar.gz' > dist/checksums.txt