Makefile 964 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. export NAME=brawler
  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 brawler
  8. mod:
  9. go mod init || true
  10. go mod tidy
  11. test:
  12. go test -p 1 ./...
  13. fmt:
  14. gofmt -l -w -s .
  15. vet:
  16. go vet ./...
  17. build: clean mod fmt vet
  18. go build -o $(NAME) cli/*
  19. build-win: clean mod fmt vet
  20. GOOS=windows GOARCH=amd64 go build -o $(NAME).exe cli/*
  21. dist: build build-win
  22. rm -fR dist
  23. mkdir -p dist/$(NAME)_linux_amd64
  24. mv $(NAME) dist/$(NAME)_linux_amd64
  25. cp LICENSE dist/$(NAME)_linux_amd64
  26. cp NOTICE dist/$(NAME)_linux_amd64
  27. tar --directory=dist -cz $(NAME)_linux_amd64 > dist/$(NAME)_$(TAG)_linux_amd64.tar.gz
  28. mkdir -p dist/$(NAME)_windows_amd64
  29. mv $(NAME).exe dist/$(NAME)_windows_amd64
  30. cp LICENSE dist/$(NAME)_windows_amd64
  31. cp NOTICE dist/$(NAME)_windows_amd64
  32. tar --directory=dist -cz $(NAME)_windows_amd64 > dist/$(NAME)_$(TAG)_windows_amd64.tar.gz
  33. sh -c 'cd dist; sha256sum *.tar.gz' > dist/checksums.txt