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 GOBIN ?= $(shell go env GOPATH)/bin
11 GOVARS = -X github.com/zyedidia/micro/internal/util.Version=$(VERSION) -X github.com/zyedidia/micro/internal/util.CommitHash=$(HASH) -X 'github.com/zyedidia/micro/internal/util.CompileDate=$(DATE)' -X github.com/zyedidia/micro/internal/util.Debug=OFF
13 # Builds micro after checking dependencies but without updating the runtime
15 go build -mod=readonly -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
18 go build -mod=readonly -ldflags "-s -w $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
21 go build -ldflags "-s -w $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
23 # Builds micro after building the runtime and checking dependencies
24 build-all: runtime build
26 # Builds micro without checking for dependencies
28 go build -mod=readonly -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
30 # Same as 'build' but installs to $GOBIN afterward
32 go install -mod=readonly -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
34 # Same as 'build-all' but installs to $GOBIN afterward
35 install-all: runtime install
37 # Same as 'build-quick' but installs to $GOBIN afterward
39 go install -mod=readonly -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
43 git submodule update --init
44 go run runtime/syntax/make_headers.go runtime/syntax
45 go build -o tools/bindata ./tools/go-bindata
46 tools/bindata -pkg config -nomemcopy -nometadata -o runtime.go runtime/...
47 mv runtime.go internal/config
48 gofmt -w internal/config/runtime.go
51 go test ./internal/...