2
0
mirror of https://github.com/junegunn/fzf synced 2024-11-16 12:12:48 +00:00
fzf/src/Makefile

79 lines
1.9 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)
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-08-26 18:28:05 +00:00
cd fzf && go build $(LDFLAGS) -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-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'
linux: docker-ubuntu
2015-08-26 18:28:05 +00:00
docker run -i -t -v $(GOPATH):/go junegunn/ubuntu-sandbox \
/bin/bash -ci 'cd /go/src/github.com/junegunn/fzf/src; make'
2015-08-26 18:28:05 +00:00
.PHONY: all build release test install uninstall clean docker \
linux arch ubuntu docker-arch docker-ubuntu