Makefile 2.4 KB

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