fzf/src/Makefile
Junegunn Choi 82156d34cc Update Makefile and install script
fzf may not run correctly on some OS even when the binary the platform
is successfully downloaded. The install script is updated to check if
the system has no problem running the executable and fall back to Ruby
version when necessary.
2015-01-05 12:21:26 +09:00

52 lines
1.1 KiB
Makefile

UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SUFFIX := darwin
else ifeq ($(UNAME_S),Linux)
SUFFIX := linux
endif
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_M),x86_64)
SUFFIX := $(SUFFIX)_amd64
else ifneq ($(filter i386 i686,$(UNAME_M)),)
SUFFIX := $(SUFFIX)_386
else # TODO
$(error "$(UNAME_M) is not supported, yet.")
endif
BINARY := fzf-$(SUFFIX)
BINDIR := ../bin
SOURCES := $(wildcard *.go fzf/*.go)
RELEASE = fzf-$(shell fzf/$(BINARY) --version)-$(SUFFIX)
all: release
release: build
cd fzf && \
cp $(BINARY) $(RELEASE) && \
tar -czf $(RELEASE).tgz $(RELEASE) && \
rm $(RELEASE)
build: fzf/$(BINARY)
fzf/$(BINARY): $(SOURCES)
go get
go test -v
cd fzf && go build -o $(BINARY)
install: fzf/$(BINARY)
mkdir -p $(BINDIR)
cp -f fzf/$(BINARY) $(BINDIR)/fzf
clean:
cd fzf && rm -f $(BINARY) $(RELEASE).tgz
docker:
docker build -t junegunn/ubuntu-sandbox .
linux64: docker
docker run -i -t -u jg -v $(shell cd ..; pwd):/fzf junegunn/ubuntu-sandbox \
/bin/bash -ci 'cd ~jg/go/src/github.com/junegunn/fzf/src; make'
.PHONY: build release install linux64 clean docker