Makefile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. PACKAGE=Medical_ERP
  2. PREFIX=$(shell pwd)
  3. CMD_PACKAGE=${PACKAGE}
  4. OUTPUT_DIR=${PREFIX}/bin
  5. OUTPUT_FILE=${OUTPUT_DIR}/Medical_ERP
  6. OUTPUT_FILE_LINUX=${OUTPUT_DIR}/linux/Medical_ERP6410
  7. COMMIT_ID=$(shell git rev-parse --short HEAD)
  8. VERSION=$(shell git describe --tags || echo "v0.0.1")
  9. VERSION_IMPORT_PATH=github.com/lneoe/go-help-libs/version
  10. BUILD_TIME=$(shell date '+%Y-%m-%dT%H:%M:%S%Z')
  11. VCS_BRANCH=$(shell git symbolic-ref --short -q HEAD)
  12. # build args
  13. BUILD_ARGS := \
  14. -ldflags "-X $(VERSION_IMPORT_PATH).appName=$(PACKAGE) \
  15. -X $(VERSION_IMPORT_PATH).version=$(VERSION) \
  16. -X $(VERSION_IMPORT_PATH).revision=$(COMMIT_ID) \
  17. -X $(VERSION_IMPORT_PATH).branch=$(VCS_BRANCH) \
  18. -X $(VERSION_IMPORT_PATH).buildDate=$(BUILD_TIME)"
  19. EXTRA_BUILD_ARGS=
  20. build:
  21. @echo "+ build"
  22. go build $(BUILD_ARGS) $(EXTRA_BUILD_ARGS) -o ${OUTPUT_FILE} $(CMD_PACKAGE)
  23. build-linux:
  24. @echo "+ build linux"
  25. GOOS=linux GOARCH=amd64 go build $(BUILD_ARGS) $(EXTRA_BUILD_ARGS) -o ${OUTPUT_FILE_LINUX} $(CMD_PACKAGE)
  26. #.PHONY: test
  27. #test:
  28. # go test -v ./... -cover
  29. #.PHONY: docker
  30. #docker:
  31. # docker build . -t Medical_ERP:latest