You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.3 KiB

4 years ago
4 years ago
4 years ago
4 years ago
  1. .PHONY: all build run gotool clean help
  2. BINARY="gin-vue-admin"
  3. GVA = "gva"
  4. all: check gva initdb run
  5. gva:
  6. go env -w GO111MODULE=on
  7. go env -w GOPROXY=https://goproxy.io,direct
  8. go build -o ${GVA} cmd/main.go
  9. initdb:
  10. @if [ -f ${GVA} ] ; then ./gva initdb && rm ${GVA} ; fi
  11. linux-build:
  12. CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
  13. windows-build:
  14. CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ${BINARY}.exe
  15. mac-build:
  16. CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ${BINARY}
  17. run:
  18. @go run main.go
  19. check:
  20. go fmt ./
  21. go vet ./
  22. clean:
  23. @if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
  24. @if [ -f ${GVA} ] ; then rm ${GVA} ; fi
  25. help:
  26. @echo "make - 构建gva终端工具并初始化数据,初始化数据后删除gva终端工具,启动server项目"
  27. @echo "make gva - 构建gva终端工具"
  28. @echo "make initdb - 如果有gva终端工具就初始化数据,初始化数据后删除gva终端工具,没有则不会执行"
  29. @echo "make linux-build - 编译 Go 代码, 生成Linux系统的二进制文件"
  30. @echo "make windows-build - 编译 Go 代码, 生成Windows系统的exe文件"
  31. @echo "make mac-build - 编译 Go 代码, 生成Mac系统的二进制文件"
  32. @echo "make run - 直接运行 main.go"
  33. @echo "make clean - 移除二进制文件"
  34. @echo "make check - 运行 Go 工具 'fmt' and 'vet'"