Skip to content
Myr

Makefile

This file

Path

Makefile

144 lines · 3.8 KiB

Last changed by

Make build flags consistentJunegunn Choibefore adoptiona7d3b72

History of this file

Take it

The walk stopped after 200 commits: lines older than a9906c7 point at it.

Add MSYS2 support as a vim plugin (#1677)msr1kbefore adoptiona9906c7

lines 1–7why, one step back
1GO ?= go
2GOOS ?= $(word 1, $(subst /, " ", $(word 4, $(shell go version))))34MAKEFILE := $(realpath $(lastword $(MAKEFILE_LIST)))5ROOT_DIR := $(shell dirname $(MAKEFILE))6SOURCES := $(wildcard *.go src/*.go src/*/*.go) $(MAKEFILE)7

Make Makefile fail when git information is not availableJunegunn Choibefore adoption3ba7b5c

lines 8–15why, one step back
8ifdef FZF_VERSION
9VERSION := $(FZF_VERSION)10else11VERSION := $(shell git describe --abbrev=0 2> /dev/null)12endif13ifeq ($(VERSION),)14$(error Not on git repository; cannot determine $$FZF_VERSION)15endif

0.24.0Junegunn Choibefore adoption0d5f862

lines 16–17why, one step back
16VERSION_TRIM := $(shell sed "s/-.*//" <<< $(VERSION))
17VERSION_REGEX := $(subst .,\.,$(VERSION_TRIM))

Make Makefile fail when git information is not availableJunegunn Choibefore adoption3ba7b5c

lines 18–26why, one step back
18
19ifdef FZF_REVISION20REVISION := $(FZF_REVISION)21else22REVISION := $(shell git log -n 1 --pretty=format:%h -- $(SOURCES) 2> /dev/null)23endif24ifeq ($(REVISION),)25$(error Not on git repository; cannot determine $$FZF_REVISION)26endif

Make build flags consistentJunegunn Choibefore adoptiona7d3b72

line 27why, one step back
27BUILD_FLAGS := -a -ldflags "-s -w -X main.version=$(VERSION) -X main.revision=$(REVISION)" -tags "$(TAGS)"

Add MSYS2 support as a vim plugin (#1677)msr1kbefore adoptiona9906c7

lines 28–54why, one step back
28
29BINARY64 := fzf-$(GOOS)_amd6430BINARYARM5 := fzf-$(GOOS)_arm531BINARYARM6 := fzf-$(GOOS)_arm632BINARYARM7 := fzf-$(GOOS)_arm733BINARYARM8 := fzf-$(GOOS)_arm834BINARYPPC64LE := fzf-$(GOOS)_ppc64le3536# https://en.wikipedia.org/wiki/Uname37UNAME_M := $(shell uname -m)38ifeq ($(UNAME_M),x86_64)39 BINARY := $(BINARY64)40else ifeq ($(UNAME_M),amd64)41 BINARY := $(BINARY64)42else ifeq ($(UNAME_M),armv5l)43 BINARY := $(BINARYARM5)44else ifeq ($(UNAME_M),armv6l)45 BINARY := $(BINARYARM6)46else ifeq ($(UNAME_M),armv7l)47 BINARY := $(BINARYARM7)48else ifeq ($(UNAME_M),armv8l)49 BINARY := $(BINARYARM8)50else ifeq ($(UNAME_M),aarch64)51 BINARY := $(BINARYARM8)52else ifeq ($(UNAME_M),ppc64le)53 BINARY := $(BINARYPPC64LE)54else

0.24.0Junegunn Choibefore adoption0d5f862

line 55why, one step back
55$(error Build on $(UNAME_M) is not supported, yet.)

Add MSYS2 support as a vim plugin (#1677)msr1kbefore adoptiona9906c7

lines 56–68why, one step back
56endif
5758all: target/$(BINARY)5960test: $(SOURCES)61 SHELL=/bin/sh GOOS= $(GO) test -v -tags "$(TAGS)" \62 github.com/junegunn/fzf/src \63 github.com/junegunn/fzf/src/algo \64 github.com/junegunn/fzf/src/tui \65 github.com/junegunn/fzf/src/util6667install: bin/fzf68

0.24.0Junegunn Choibefore adoption0d5f862

line 69why, one step back
69build:

Merge branch 'devel' into masterJunegunn Choibefore adoption51dfacd

lines 70–71why, one step back
70 goreleaser --rm-dist --snapshot
71

0.24.0Junegunn Choibefore adoption0d5f862

lines 72–106why, one step back
72release:
73ifndef GITHUB_TOKEN74 $(error GITHUB_TOKEN is not defined)75endif7677 # Check if we are on master branch78ifneq ($(shell git symbolic-ref --short HEAD),master)79 $(error Not on master branch)80endif8182 # Check if version numbers are properly updated83 grep -q ^$(VERSION_REGEX)$$ CHANGELOG.md84 grep -qF '"fzf $(VERSION_TRIM)"' man/man1/fzf.185 grep -qF '"fzf $(VERSION_TRIM)"' man/man1/fzf-tmux.186 grep -qF $(VERSION) install87 grep -qF $(VERSION) install.ps18889 # Make release note out of CHANGELOG.md90 sed -n '/^$(VERSION_REGEX)$$/,/^[0-9]/p' CHANGELOG.md | tail -r | \91 sed '1,/^ *$$/d' | tail -r | sed 1,2d | tee tmp/release-note9293 # Push to temp branch first so that install scripts always works on master branch94 git checkout -B temp master95 git push origin temp --follow-tags --force9697 # Make a GitHub release98 goreleaser --rm-dist --release-notes tmp/release-note99100 # Push to master101 git checkout master102 git push origin master103104 # Delete temp branch105 git push origin --delete temp106

Add MSYS2 support as a vim plugin (#1677)msr1kbefore adoptiona9906c7

line 107why, one step back
107clean:

Merge branch 'devel' into masterJunegunn Choibefore adoption51dfacd

line 108why, one step back
108 $(RM) -r dist target

Add MSYS2 support as a vim plugin (#1677)msr1kbefore adoptiona9906c7

lines 109–143why, one step back
109
110target/$(BINARY64): $(SOURCES)111 GOARCH=amd64 $(GO) build $(BUILD_FLAGS) -o $@112113# https://github.com/golang/go/wiki/GoArm114target/$(BINARYARM5): $(SOURCES)115 GOARCH=arm GOARM=5 $(GO) build $(BUILD_FLAGS) -o $@116117target/$(BINARYARM6): $(SOURCES)118 GOARCH=arm GOARM=6 $(GO) build $(BUILD_FLAGS) -o $@119120target/$(BINARYARM7): $(SOURCES)121 GOARCH=arm GOARM=7 $(GO) build $(BUILD_FLAGS) -o $@122123target/$(BINARYARM8): $(SOURCES)124 GOARCH=arm64 $(GO) build $(BUILD_FLAGS) -o $@125126target/$(BINARYPPC64LE): $(SOURCES)127 GOARCH=ppc64le $(GO) build $(BUILD_FLAGS) -o $@128129bin/fzf: target/$(BINARY) | bin130 cp -f target/$(BINARY) bin/fzf131132docker:133 docker build -t fzf-arch .134 docker run -it fzf-arch tmux135136docker-test:137 docker build -t fzf-arch .138 docker run -it fzf-arch139140update:141 $(GO) get -u142 $(GO) mod tidy143

0.24.0Junegunn Choibefore adoption0d5f862

line 144why, one step back
144.PHONY: all build release test install clean docker docker-test update