2021-09-29 23:30:20 +00:00
|
|
|
.PHONY: runtime build generate build-quick
|
2016-04-18 18:40:07 +00:00
|
|
|
|
2019-12-29 02:26:22 +00:00
|
|
|
VERSION = $(shell GOOS=$(shell go env GOHOSTOS) GOARCH=$(shell go env GOHOSTARCH) \
|
2017-04-12 17:42:39 +00:00
|
|
|
go run tools/build-version.go)
|
2019-12-29 02:26:22 +00:00
|
|
|
HASH = $(shell git rev-parse --short HEAD)
|
|
|
|
DATE = $(shell GOOS=$(shell go env GOHOSTOS) GOARCH=$(shell go env GOHOSTARCH) \
|
2017-04-12 17:42:39 +00:00
|
|
|
go run tools/build-date.go)
|
|
|
|
GOBIN ?= $(shell go env GOPATH)/bin
|
2020-05-04 14:34:16 +00:00
|
|
|
GOVARS = -X github.com/zyedidia/micro/v2/internal/util.Version=$(VERSION) -X github.com/zyedidia/micro/v2/internal/util.CommitHash=$(HASH) -X 'github.com/zyedidia/micro/v2/internal/util.CompileDate=$(DATE)'
|
|
|
|
DEBUGVAR = -X github.com/zyedidia/micro/v2/internal/util.Debug=ON
|
2020-02-22 03:21:38 +00:00
|
|
|
VSCODE_TESTS_BASE_URL = 'https://raw.githubusercontent.com/microsoft/vscode/e6a45f4242ebddb7aa9a229f85555e8a3bd987e2/src/vs/editor/test/common/model/'
|
2024-09-17 19:04:43 +00:00
|
|
|
CGO_ENABLED := $(if $(CGO_ENABLED),$(CGO_ENABLED),0)
|
|
|
|
|
|
|
|
ADDITIONAL_GO_LINKER_FLAGS := ""
|
|
|
|
GOHOSTOS = $(shell go env GOHOSTOS)
|
|
|
|
ifeq ($(GOHOSTOS), darwin)
|
|
|
|
# Native darwin resp. macOS builds need external and dynamic linking
|
|
|
|
ADDITIONAL_GO_LINKER_FLAGS += $(shell GOOS=$(GOHOSTOS) \
|
|
|
|
GOARCH=$(shell go env GOHOSTARCH) \
|
|
|
|
go run tools/info-plist.go "$(shell go env GOOS)" "$(VERSION)")
|
|
|
|
CGO_ENABLED = 1
|
|
|
|
endif
|
2016-10-11 15:07:53 +00:00
|
|
|
|
2021-09-29 23:30:20 +00:00
|
|
|
build: generate build-quick
|
|
|
|
|
|
|
|
build-quick:
|
2024-09-12 16:54:09 +00:00
|
|
|
CGO_ENABLED=$(CGO_ENABLED) go build -trimpath -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
|
2016-03-21 16:51:45 +00:00
|
|
|
|
2019-03-18 22:40:53 +00:00
|
|
|
build-dbg:
|
2024-09-12 16:54:09 +00:00
|
|
|
CGO_ENABLED=$(CGO_ENABLED) go build -trimpath -ldflags "$(ADDITIONAL_GO_LINKER_FLAGS) $(DEBUGVAR)" ./cmd/micro
|
2019-12-28 23:53:51 +00:00
|
|
|
|
2024-09-12 16:43:19 +00:00
|
|
|
build-tags: fetch-tags build
|
2020-02-14 00:57:31 +00:00
|
|
|
|
2021-09-29 23:30:20 +00:00
|
|
|
build-all: build
|
2016-08-28 02:00:56 +00:00
|
|
|
|
2021-09-29 23:30:20 +00:00
|
|
|
install: generate
|
2020-01-02 01:44:45 +00:00
|
|
|
go install -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
|
2016-03-21 16:51:45 +00:00
|
|
|
|
2021-09-29 23:30:20 +00:00
|
|
|
install-all: install
|
2016-03-25 17:42:41 +00:00
|
|
|
|
2021-09-24 21:40:26 +00:00
|
|
|
fetch-tags:
|
2024-08-31 16:08:16 +00:00
|
|
|
git fetch --tags --force
|
2021-09-24 21:40:26 +00:00
|
|
|
|
|
|
|
generate:
|
2021-10-29 04:47:23 +00:00
|
|
|
GOOS=$(shell go env GOHOSTOS) GOARCH=$(shell go env GOHOSTARCH) go generate ./runtime
|
2021-09-24 21:40:26 +00:00
|
|
|
|
2020-02-22 03:21:38 +00:00
|
|
|
testgen:
|
|
|
|
mkdir -p tools/vscode-tests
|
|
|
|
cd tools/vscode-tests && \
|
|
|
|
curl --remote-name-all $(VSCODE_TESTS_BASE_URL){editableTextModelAuto,editableTextModel,model.line}.test.ts
|
|
|
|
tsc tools/vscode-tests/*.ts > /dev/null; true
|
|
|
|
go run tools/testgen.go tools/vscode-tests/*.js > buffer_generated_test.go
|
|
|
|
mv buffer_generated_test.go internal/buffer
|
|
|
|
gofmt -w internal/buffer/buffer_generated_test.go
|
|
|
|
|
2019-02-04 05:24:55 +00:00
|
|
|
test:
|
|
|
|
go test ./internal/...
|
2020-06-20 22:24:12 +00:00
|
|
|
go test ./cmd/...
|
2019-02-04 05:24:55 +00:00
|
|
|
|
2020-02-22 03:21:38 +00:00
|
|
|
bench:
|
2020-03-01 07:50:10 +00:00
|
|
|
for i in 1 2 3; do \
|
|
|
|
go test -bench=. ./internal/...; \
|
|
|
|
done > benchmark_results
|
|
|
|
benchstat benchmark_results
|
|
|
|
|
|
|
|
bench-baseline:
|
|
|
|
for i in 1 2 3; do \
|
|
|
|
go test -bench=. ./internal/...; \
|
|
|
|
done > benchmark_results_baseline
|
|
|
|
|
|
|
|
bench-compare:
|
|
|
|
for i in 1 2 3; do \
|
|
|
|
go test -bench=. ./internal/...; \
|
|
|
|
done > benchmark_results
|
2020-06-12 04:10:00 +00:00
|
|
|
benchstat -alpha 0.15 benchmark_results_baseline benchmark_results
|
2020-02-22 03:21:38 +00:00
|
|
|
|
2016-03-25 17:42:41 +00:00
|
|
|
clean:
|
|
|
|
rm -f micro
|