Makefile 924 B

1234567891011121314151617181920212223242526272829303132333435
  1. VERSION="1.0.0"
  2. default: debug test run
  3. debug:
  4. go vet ./...
  5. gofmt -d ./
  6. go build -mod vendor -o ./fave
  7. test:
  8. go test ./...
  9. run:
  10. @./fave -host 0.0.0.0 -port 8080 -dir ./hosts -debug true
  11. build: clean
  12. @-mkdir ./bin
  13. @cd ./bin
  14. @cd ..
  15. CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod vendor -a -o ./bin/fave.linux-amd64 -ldflags='-X main.Version=$(VERSION) -extldflags "-static"'
  16. CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -mod vendor -a -o ./bin/fave.darwin-amd64 -ldflags='-X main.Version=$(VERSION) -extldflags "-static"'
  17. CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -mod vendor -a -o ./bin/fave.windows-amd64.exe -ldflags='-X main.Version=$(VERSION) -extldflags "-static"'
  18. cd ./bin && find . -name 'fave*' | xargs -I{} tar czf {}.tar.gz {}
  19. cd ./bin && shasum -a 256 * > sha256sum.txt
  20. cat ./bin/sha256sum.txt
  21. clean:
  22. @-rm -r ./bin
  23. format:
  24. gofmt -w ./
  25. update:
  26. go mod vendor
  27. go mod download