PACKAGE=Cold_Logistic PREFIX=$(shell pwd) CMD_PACKAGE=${PACKAGE} OUTPUT_DIR=${PREFIX}/cmd OUTPUT_FILE=${OUTPUT_DIR}/Cold_Logistic OUTPUT_FILE_LINUX=${OUTPUT_DIR}/linux/Cold_Logistic6270 COMMIT_ID=$(shell git rev-parse --short HEAD) VERSION=$(shell git describe --tags || echo "v0.0.1") VERSION_IMPORT_PATH=github.com/lneoe/go-help-libs/version BUILD_TIME=$(shell date '+%Y-%m-%dT%H:%M:%S%Z') VCS_BRANCH=$(shell git symbolic-ref --short -q HEAD) # build args BUILD_ARGS := \ -ldflags "-X $(VERSION_IMPORT_PATH).appName=$(PACKAGE) \ -X $(VERSION_IMPORT_PATH).version=$(VERSION) \ -X $(VERSION_IMPORT_PATH).revision=$(COMMIT_ID) \ -X $(VERSION_IMPORT_PATH).branch=$(VCS_BRANCH) \ -X $(VERSION_IMPORT_PATH).buildDate=$(BUILD_TIME)" EXTRA_BUILD_ARGS= build: @echo "+ build" go build $(BUILD_ARGS) $(EXTRA_BUILD_ARGS) -o ${OUTPUT_FILE} $(CMD_PACKAGE) build-linux: @echo "+ build linux" GOOS=linux GOARCH=amd64 go build $(BUILD_ARGS) $(EXTRA_BUILD_ARGS) -o ${OUTPUT_FILE_LINUX} $(CMD_PACKAGE) #.PHONY: test #test: # go test -v ./... -cover #.PHONY: docker #docker: # docker build . -t Cold_Logistic:latest