3 VERSION := $(shell GOOS=$(shell go env GOHOSTOS) GOARCH=$(shell go env GOHOSTARCH) \
4 go run tools/build-version.go)
5 HASH := $(shell git rev-parse --short HEAD)
6 DATE := $(shell GOOS=$(shell go env GOHOSTOS) GOARCH=$(shell go env GOHOSTARCH) \
7 go run tools/build-date.go)
8 ADDITIONAL_GO_LINKER_FLAGS := $(shell GOOS=$(shell go env GOHOSTOS) \
9 GOARCH=$(shell go env GOHOSTARCH) \
10 go run tools/info-plist.go "$(VERSION)")
11 GOBIN ?= $(shell go env GOPATH)/bin
12 GOVARS := -X main.Version=$(VERSION) -X main.CommitHash=$(HASH) -X 'main.CompileDate=$(DATE)' -X main.Debug=OFF
14 # Builds micro after checking dependencies but without updating the runtime
16 go build -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
18 # Builds micro after building the runtime and checking dependencies
19 build-all: runtime build
21 # Builds micro without checking for dependencies
23 go build -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
25 # Same as 'build' but installs to $GOBIN afterward
27 go install -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
29 # Same as 'build-all' but installs to $GOBIN afterward
30 install-all: runtime install
32 # Same as 'build-quick' but installs to $GOBIN afterward
34 go install -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
38 git submodule update --init
42 go get -u github.com/jteeuwen/go-bindata/...
43 $(GOBIN)/go-bindata -pkg config -nomemcopy -nometadata -o runtime.go runtime/...
44 mv runtime.go cmd/micro/config
45 gofmt -w cmd/micro/config/runtime.go