Makefile 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. export NAME=eliasdb
  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 eliasdb
  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. build: clean mod fmt vet
  22. go build -o $(NAME) cli/eliasdb.go
  23. build-win: clean mod fmt vet
  24. GOOS=windows GOARCH=amd64 go build -o $(NAME).exe cli/eliasdb.go
  25. dist: build build-win
  26. rm -fR dist
  27. mkdir -p dist/$(NAME)_linux_amd64
  28. mv $(NAME) dist/$(NAME)_linux_amd64
  29. cp LICENSE dist/$(NAME)_linux_amd64
  30. cp NOTICE dist/$(NAME)_linux_amd64
  31. tar --directory=dist -cz $(NAME)_linux_amd64 > dist/$(NAME)_$(TAG)_linux_amd64.tar.gz
  32. mkdir -p dist/$(NAME)_windows_amd64
  33. mv $(NAME).exe dist/$(NAME)_windows_amd64
  34. cp LICENSE dist/$(NAME)_windows_amd64
  35. cp NOTICE dist/$(NAME)_windows_amd64
  36. tar --directory=dist -cz $(NAME)_windows_amd64 > dist/$(NAME)_$(TAG)_windows_amd64.tar.gz
  37. sh -c 'cd dist; sha256sum *.tar.gz' > dist/checksums.txt