Makefile 453 B

1234567891011121314151617
  1. VER="0.0.1"
  2. DATA=$(shell date +%Y%m%d)
  3. GIT=$(shell git rev-parse --short HEAD)
  4. BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
  5. build: checkfile
  6. ${GOPATH}/bin/swag init
  7. go build -v -a -ldflags "-X main.MinVersion=$(VER) -X main.PublishDate=$(DATA) -X main.CommitId=$(GIT) -X main.Branch=$(BRANCH)"
  8. clean:
  9. rm apsServer -f
  10. .PHONY: checkfile
  11. checkfile:
  12. if [ ! -f $(GOPATH)/bin/swag ];then \
  13. go install github.com/swaggo/swag/cmd/swag@latest; \
  14. fi