2
0
mirror of https://github.com/junegunn/fzf synced 2024-11-10 13:10:44 +00:00
fzf/src/Makefile

62 lines
1.5 KiB
Makefile
Raw Normal View History

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-05 17:04:06 +00:00
SOURCES := $(wildcard *.go fzf/*.go)
BINDIR := ../bin
BINARY32 := fzf-$(GOOS)_386
BINARY64 := fzf-$(GOOS)_amd64
RELEASE32 = fzf-$(shell fzf/$(BINARY64) --version)-$(GOOS)_386
RELEASE64 = fzf-$(shell fzf/$(BINARY64) --version)-$(GOOS)_amd64
2015-01-01 19:49:30 +00:00
all: release
2015-01-01 19:49:30 +00:00
release: build
cd fzf && \
2015-01-05 17:04:06 +00:00
cp $(BINARY32) $(RELEASE32) && tar -czf $(RELEASE32).tgz $(RELEASE32) && \
cp $(BINARY64) $(RELEASE64) && tar -czf $(RELEASE64).tgz $(RELEASE64) && \
rm $(RELEASE32) $(RELEASE64)
2015-01-05 17:04:06 +00:00
build: fzf/$(BINARY32) fzf/$(BINARY64)
2015-01-01 19:49:30 +00:00
2015-01-05 17:04:06 +00:00
test: $(SOURCES)
2015-01-01 19:49:30 +00:00
go get
go test -v
2015-01-05 17:04:06 +00:00
fzf/$(BINARY32): test
cd fzf && GOARCH=386 CGO_ENABLED=1 go build -o $(BINARY32)
fzf/$(BINARY64): test
cd fzf && go build -o $(BINARY64)
install: fzf/$(BINARY64)
2015-01-01 19:49:30 +00:00
mkdir -p $(BINDIR)
2015-01-05 17:04:06 +00:00
cp -f fzf/$(BINARY64) $(BINDIR)/fzf
2015-01-01 19:49:30 +00:00
clean:
2015-01-05 17:04:06 +00:00
cd fzf && rm -f $(BINARY32) $(BINARY64) $(RELEASE32).tgz $(RELEASE64).tgz
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
docker run -i -t -v $(shell cd ..; pwd):/fzf junegunn/$(DISTRO)-sandbox \
/bin/bash -ci 'cd /go/src/github.com/junegunn/fzf/src; make'
$(DISTRO): docker
docker run -i -t -v $(shell cd ..; pwd):/fzf junegunn/$(DISTRO)-sandbox \
sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'
.PHONY: build release install linux clean docker $(DISTRO)