Makefile 557 B

123456789101112131415
  1. GO ?= go
  2. SHELL := bash
  3. IMAGE_TAG ?= $(shell ./tools/image-tag)
  4. GIT_REVISION := $(shell git rev-parse --short HEAD)
  5. GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
  6. GIT_LAST_COMMIT_DATE := $(shell git log -1 --date=iso-strict --format=%cd)
  7. # Build flags
  8. VPREFIX := github.com/opencost/opencost/core/pkg/version
  9. GO_LDFLAGS := -X $(VPREFIX).Version=$(IMAGE_TAG) -X $(VPREFIX).GitCommit=$(GIT_REVISION)
  10. GO_FLAGS := -ldflags "-extldflags \"-static\" -s -w $(GO_LDFLAGS)"
  11. .PHONY: go/bin
  12. go/bin:
  13. CGO_ENABLED=0 $(GO) build $(GO_FLAGS) ./cmd/costmodel