fzf/src/Makefile

86 lines
2.1 KiB
Makefile
Raw Normal View History

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
VERSION = $(shell fzf/$(BINARY64) --version)
RELEASE32 = fzf-$(VERSION)-$(GOOS)_386
RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd64
2015-01-01 19:49:30 +00:00
all: release
2015-01-01 19:49:30 +00:00
release: build
2015-08-26 18:28:05 +00:00
-cd fzf && cp $(BINARY32) $(RELEASE32) && tar -czf $(RELEASE32).tgz $(RELEASE32)
cd fzf && cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64) && \
rm -f $(RELEASE32) $(RELEASE64)
build: test 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
install: $(BINDIR)/fzf
2015-01-11 05:19:50 +00:00
uninstall:
rm -f $(BINDIR)/fzf $(BINDIR)/$(BINARY64)
clean:
2015-08-26 18:28:05 +00:00
cd fzf && rm -f fzf-*
2015-01-11 05:19:50 +00:00
fzf/$(BINARY32): $(SOURCES)
cd fzf && GOARCH=386 CGO_ENABLED=1 go build -a -o $(BINARY32)
2015-01-05 17:04:06 +00:00
2015-01-11 05:19:50 +00:00
fzf/$(BINARY64): $(SOURCES)
cd fzf && go build -a -tags "$(TAGS)" -o $(BINARY64)
2015-01-05 17:04:06 +00:00
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-08-26 18:28:05 +00:00
docker-arch:
docker build -t junegunn/arch-sandbox - < Dockerfile.arch
2015-01-01 19:49:30 +00:00
2015-08-26 18:28:05 +00:00
docker-ubuntu:
2015-08-27 13:48:42 +00:00
docker build -t junegunn/ubuntu-sandbox - < Dockerfile.ubuntu
2015-01-05 17:04:06 +00:00
2015-09-19 15:17:44 +00:00
docker-centos:
docker build -t junegunn/centos-sandbox - < Dockerfile.centos
2015-08-26 18:28:05 +00:00
arch: docker-arch
docker run -i -t -v $(GOPATH):/go junegunn/$@-sandbox \
sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'
2015-01-05 17:04:06 +00:00
2015-08-26 18:28:05 +00:00
ubuntu: docker-ubuntu
docker run -i -t -v $(GOPATH):/go junegunn/$@-sandbox \
2015-01-05 17:04:06 +00:00
sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'
2015-09-19 15:17:44 +00:00
centos: docker-centos
docker run -i -t -v $(GOPATH):/go junegunn/$@-sandbox \
sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'
linux: docker-centos
docker run -i -t -v $(GOPATH):/go junegunn/centos-sandbox \
/bin/bash -ci 'cd /go/src/github.com/junegunn/fzf/src; make TAGS=static'
2015-08-26 18:28:05 +00:00
.PHONY: all build release test install uninstall clean docker \
2015-09-19 15:17:44 +00:00
linux arch ubuntu centos docker-arch docker-ubuntu docker-centos