]> git.lizzy.rs Git - micro.git/blob - Makefile
Resolve versions in plugin manager
[micro.git] / Makefile
1 .PHONY: runtime
2
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 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
14 # Builds micro after checking dependencies but without updating the runtime
15 build:
16         go build -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
17
18 # Builds micro after building the runtime and checking dependencies
19 build-all: runtime build
20
21 # Builds micro without checking for dependencies
22 build-quick:
23         go build -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
24
25 # Same as 'build' but installs to $GOBIN afterward
26 install:
27         go install -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
28
29 # Same as 'build-all' but installs to $GOBIN afterward
30 install-all: runtime install
31
32 # Same as 'build-quick' but installs to $GOBIN afterward
33 install-quick:
34         go install -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)"  ./cmd/micro
35
36 # Builds the runtime
37 runtime:
38         git submodule update --init
39         go build -o tools/bindata ./tools/go-bindata
40         tools/bindata -pkg config -nomemcopy -nometadata -o runtime.go runtime/...
41         mv runtime.go internal/config
42         gofmt -w internal/config/runtime.go
43
44 test:
45         go test ./internal/...
46
47 clean:
48         rm -f micro