]> git.lizzy.rs Git - micro.git/blob - Makefile
Fix makefile tags dependencies
[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 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
12
13 # Builds micro after checking dependencies but without updating the runtime
14 build:
15         go build -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
16
17 build-dbg:
18         go build -ldflags "-s -w $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
19
20 build-tags: fetch-tags
21         go build -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
22
23 # Builds micro after building the runtime and checking dependencies
24 build-all: runtime build
25
26 # Builds micro without checking for dependencies
27 build-quick:
28         go build -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
29
30 # Same as 'build' but installs to $GOBIN afterward
31 install:
32         go install -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
33
34 # Same as 'build-all' but installs to $GOBIN afterward
35 install-all: runtime install
36
37 # Same as 'build-quick' but installs to $GOBIN afterward
38 install-quick:
39         go install -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)"  ./cmd/micro
40
41 fetch-tags:
42         git fetch --tags
43
44 # Builds the runtime
45 runtime:
46         git submodule update --init
47         go run runtime/syntax/make_headers.go runtime/syntax
48         go build -o tools/bindata ./tools/go-bindata
49         tools/bindata -pkg config -nomemcopy -nometadata -o runtime.go runtime/...
50         mv runtime.go internal/config
51         gofmt -w internal/config/runtime.go
52
53 test:
54         go test ./internal/...
55
56 clean:
57         rm -f micro