Skip to content
Myr

Make Makefile fail when git information is not available

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 254e976 · Browse files · 2 files+24 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+24 added−2 removed

  • other:+24 added−2 removed

2 files+24 added−2 removed

modified:BUILD.md+7 added
modified:Makefile+17 added-2 removed
3 unmodified lines
4MAKEFILE := $(realpath $(lastword $(MAKEFILE_LIST)))5ROOT_DIR := $(shell dirname $(MAKEFILE))6SOURCES := $(wildcard *.go src/*.go src/*/*.go) $(MAKEFILE)78ifdef FZF_VERSION9VERSION := $(FZF_VERSION)10else8VERSION := $(shell git describe --abbrev=0)11VERSION := $(shell git describe --abbrev=0 2> /dev/null)12endif13ifeq ($(VERSION),)14$(error Not on git repository; cannot determine $$FZF_VERSION)15endif16VERSION_TRIM := $(shell sed "s/-.*//" <<< $(VERSION))17VERSION_REGEX := $(subst .,\.,$(VERSION_TRIM))1819ifdef FZF_REVISION20REVISION := $(FZF_REVISION)21else11REVISION := $(shell git log -n 1 --pretty=format:%h -- $(SOURCES))22REVISION := $(shell git log -n 1 --pretty=format:%h -- $(SOURCES) 2> /dev/null)23endif24ifeq ($(REVISION),)25$(error Not on git repository; cannot determine $$FZF_REVISION)26endif27BUILD_FLAGS := -a -ldflags "-X main.version=$(VERSION) -X main.revision=$(REVISION) -w '-extldflags=$(LDFLAGS)'" -tags "$(TAGS)"2829BINARY64 := fzf-$(GOOS)_amd6430BINARYARM5 := fzf-$(GOOS)_arm5
114 unmodified lines