mirror of
https://github.com/zyedidia/micro.git
synced 2024-10-28 05:21:40 +03:00
a61616d79e
This change introduces header files for syntax files. The header files only contain the filetype and detection info and can be parsed much faster than parsing a full yaml file. To determine which filetype a file is, only scanning the headers is necessary and afterwards only one yaml file needs to be parsed. Use the make_headers.go file to generate the header files. Micro expects that all default syntax files will have header files and that custom user syntax files may or may not have them. Resolving includes within syntax has not yet been implemented. This optimization improves startup time. Ref #1427
55 lines
2.0 KiB
Makefile
55 lines
2.0 KiB
Makefile
.PHONY: runtime
|
|
|
|
VERSION = $(shell GOOS=$(shell go env GOHOSTOS) GOARCH=$(shell go env GOHOSTARCH) \
|
|
go run tools/build-version.go)
|
|
HASH = $(shell git rev-parse --short HEAD)
|
|
DATE = $(shell GOOS=$(shell go env GOHOSTOS) GOARCH=$(shell go env GOHOSTARCH) \
|
|
go run tools/build-date.go)
|
|
ADDITIONAL_GO_LINKER_FLAGS = $(shell GOOS=$(shell go env GOHOSTOS) \
|
|
GOARCH=$(shell go env GOHOSTARCH))
|
|
GOBIN ?= $(shell go env GOPATH)/bin
|
|
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
|
|
|
|
# Builds micro after checking dependencies but without updating the runtime
|
|
build:
|
|
go build -mod=readonly -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
|
|
|
|
build-dbg:
|
|
go build -mod=readonly -ldflags "-s -w $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
|
|
|
|
build-mod:
|
|
go build -ldflags "-s -w $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
|
|
|
|
# Builds micro after building the runtime and checking dependencies
|
|
build-all: runtime build
|
|
|
|
# Builds micro without checking for dependencies
|
|
build-quick:
|
|
go build -mod=readonly -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
|
|
|
|
# Same as 'build' but installs to $GOBIN afterward
|
|
install:
|
|
go install -mod=readonly -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
|
|
|
|
# Same as 'build-all' but installs to $GOBIN afterward
|
|
install-all: runtime install
|
|
|
|
# Same as 'build-quick' but installs to $GOBIN afterward
|
|
install-quick:
|
|
go install -mod=readonly -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
|
|
|
|
# Builds the runtime
|
|
runtime:
|
|
git submodule update --init
|
|
go run runtime/syntax/make_headers.go runtime/syntax
|
|
go build -o tools/bindata ./tools/go-bindata
|
|
tools/bindata -pkg config -nomemcopy -nometadata -o runtime.go runtime/...
|
|
mv runtime.go internal/config
|
|
gofmt -w internal/config/runtime.go
|
|
|
|
test:
|
|
go test ./internal/...
|
|
|
|
clean:
|
|
rm -f micro
|