2015-01-11 05:19:50 +00:00
|
|
|
ifndef GOPATH
|
|
|
|
$(error GOPATH is undefined)
|
|
|
|
endif
|
|
|
|
|
2015-01-01 19:49:30 +00:00
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S),Darwin)
|
2015-01-05 17:04:06 +00:00
|
|
|
GOOS := darwin
|
2015-01-01 19:49:30 +00:00
|
|
|
else ifeq ($(UNAME_S),Linux)
|
2015-01-05 17:04:06 +00:00
|
|
|
GOOS := linux
|
2015-01-01 19:49:30 +00:00
|
|
|
endif
|
|
|
|
|
2015-01-05 17:04:06 +00:00
|
|
|
ifneq ($(shell uname -m),x86_64)
|
|
|
|
$(error "Build on $(UNAME_M) is not supported, yet.")
|
2015-01-01 19:49:30 +00:00
|
|
|
endif
|
|
|
|
|
2015-01-11 05:19:50 +00:00
|
|
|
SOURCES := $(wildcard *.go */*.go)
|
2015-01-05 17:04:06 +00:00
|
|
|
BINDIR := ../bin
|
|
|
|
|
|
|
|
BINARY32 := fzf-$(GOOS)_386
|
|
|
|
BINARY64 := fzf-$(GOOS)_amd64
|
2015-01-13 03:29:12 +00:00
|
|
|
VERSION = $(shell fzf/$(BINARY64) --version)
|
|
|
|
RELEASE32 = fzf-$(VERSION)-$(GOOS)_386
|
|
|
|
RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd64
|
2015-01-01 19:49:30 +00:00
|
|
|
|
2015-01-11 05:19:50 +00:00
|
|
|
all: test release
|
2015-01-01 19:49:30 +00:00
|
|
|
|
2015-01-04 16:25:54 +00:00
|
|
|
release: build
|
|
|
|
cd fzf && \
|
2015-01-05 17:04:06 +00:00
|
|
|
cp $(BINARY32) $(RELEASE32) && tar -czf $(RELEASE32).tgz $(RELEASE32) && \
|
2015-01-13 17:26:47 +00:00
|
|
|
cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64) && \
|
|
|
|
rm $(RELEASE32) $(RELEASE64)
|
2015-01-03 17:00:22 +00:00
|
|
|
|
2015-01-05 17:04:06 +00:00
|
|
|
build: fzf/$(BINARY32) fzf/$(BINARY64)
|
2015-01-01 19:49:30 +00:00
|
|
|
|
2015-01-11 05:19:50 +00:00
|
|
|
test:
|
2015-01-01 19:49:30 +00:00
|
|
|
go get
|
2015-01-12 03:56:17 +00:00
|
|
|
go test -v ./...
|
2015-01-01 19:49:30 +00:00
|
|
|
|
2015-01-11 05:19:50 +00:00
|
|
|
install: $(BINDIR)/fzf
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
rm -f $(BINDIR)/fzf $(BINDIR)/$(BINARY64)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
cd fzf && rm -f $(BINARY32) $(BINARY64) $(RELEASE32).tgz $(RELEASE64).tgz
|
|
|
|
|
|
|
|
fzf/$(BINARY32): $(SOURCES)
|
2015-01-05 17:04:06 +00:00
|
|
|
cd fzf && GOARCH=386 CGO_ENABLED=1 go build -o $(BINARY32)
|
|
|
|
|
2015-01-11 05:19:50 +00:00
|
|
|
fzf/$(BINARY64): $(SOURCES)
|
2015-01-05 17:04:06 +00:00
|
|
|
cd fzf && go build -o $(BINARY64)
|
|
|
|
|
2015-01-11 05:19:50 +00:00
|
|
|
$(BINDIR)/fzf: fzf/$(BINARY64) | $(BINDIR)
|
|
|
|
cp -f fzf/$(BINARY64) $(BINDIR)
|
|
|
|
cd $(BINDIR) && ln -sf $(BINARY64) fzf
|
2015-01-01 19:49:30 +00:00
|
|
|
|
2015-01-11 05:19:50 +00:00
|
|
|
$(BINDIR):
|
|
|
|
mkdir -p $@
|
2015-01-05 17:04:06 +00:00
|
|
|
|
2015-01-05 17:07:30 +00:00
|
|
|
# Linux distribution to build fzf on
|
2015-01-06 15:24:05 +00:00
|
|
|
DISTRO := arch
|
2015-01-01 19:49:30 +00:00
|
|
|
|
|
|
|
docker:
|
2015-01-05 17:04:06 +00:00
|
|
|
docker build -t junegunn/$(DISTRO)-sandbox - < Dockerfile.$(DISTRO)
|
|
|
|
|
|
|
|
linux: docker
|
2015-01-11 05:19:50 +00:00
|
|
|
docker run -i -t -v $(GOPATH):/go junegunn/$(DISTRO)-sandbox \
|
2015-01-05 17:04:06 +00:00
|
|
|
/bin/bash -ci 'cd /go/src/github.com/junegunn/fzf/src; make'
|
|
|
|
|
|
|
|
$(DISTRO): docker
|
2015-01-11 05:19:50 +00:00
|
|
|
docker run -i -t -v $(GOPATH):/go junegunn/$(DISTRO)-sandbox \
|
2015-01-05 17:04:06 +00:00
|
|
|
sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'
|
|
|
|
|
2015-01-13 17:26:47 +00:00
|
|
|
.PHONY: all build release test install uninstall clean docker linux $(DISTRO)
|