summaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
authorAlex Cornejo <acornejo@gmail.com>2015-10-13 09:40:40 -0700
committerAlex Cornejo <acornejo@gmail.com>2015-11-18 23:20:51 -0800
commit28ffb9638d7a06b4bfcb87ce6af28c66c2210de3 (patch)
treefea75ac0063c3499c04a004f78c303238d53e0eb /src/Makefile
parentae04f56dbdc9cd635f5a3d56082faf2399d91f75 (diff)
downloadfzf-28ffb9638d7a06b4bfcb87ce6af28c66c2210de3.tar.gz
add android build
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/Makefile b/src/Makefile
index ff40897c..6b564fcf 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,12 +2,14 @@ ifndef GOPATH
$(error GOPATH is undefined)
endif
+ifndef GOOS
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
GOOS := darwin
else ifeq ($(UNAME_S),Linux)
GOOS := linux
endif
+endif
ifneq ($(shell uname -m),x86_64)
$(error "Build on $(UNAME_M) is not supported, yet.")
@@ -16,11 +18,13 @@ endif
SOURCES := $(wildcard *.go */*.go)
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
+BINARY32 := fzf-$(GOOS)_386
+BINARY64 := fzf-$(GOOS)_amd64
+BINARYARM7 := fzf-$(GOOS)_arm7
+VERSION := $(shell awk -F= '/version =/ {print $$2}' constants.go | tr -d "\" ")
+RELEASE32 = fzf-$(VERSION)-$(GOOS)_386
+RELEASE64 = fzf-$(VERSION)-$(GOOS)_amd64
+RELEASEARM7 = fzf-$(VERSION)-$(GOOS)_arm7
all: release
@@ -31,6 +35,11 @@ release: build
build: test fzf/$(BINARY32) fzf/$(BINARY64)
+android-build:
+ cd fzf && GOARCH=arm GOARM=7 CGO_ENABLED=1 go build -a -ldflags="-extldflags=-pie" -o $(BINARYARM7)
+ cd fzf && cp $(BINARYARM7) $(RELEASEARM7) && tar -czf $(RELEASEARM7).tgz $(RELEASEARM7) && \
+ rm -f $(RELEASEARM7)
+
test:
go get
go test -v ./...
@@ -65,6 +74,9 @@ docker-ubuntu:
docker-centos:
docker build -t junegunn/centos-sandbox - < Dockerfile.centos
+docker-android:
+ docker build -t junegunn/android-sandbox - < Dockerfile.android
+
arch: docker-arch
docker run -i -t -v $(GOPATH):/go junegunn/$@-sandbox \
sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'
@@ -81,5 +93,14 @@ 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'
+ubuntu-android: docker-android
+ docker run -i -t -v $(GOPATH):/go junegunn/$@-sandbox \
+ sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'
+
+android: docker-android
+ docker run -i -t -v $(GOPATH):/go junegunn/android-sandbox \
+ /bin/bash -ci 'cd /go/src/github.com/junegunn/fzf/src; GOOS=android make android-build'
+
.PHONY: all build release test install uninstall clean docker \
- linux arch ubuntu centos docker-arch docker-ubuntu docker-centos
+ linux arch ubuntu centos docker-arch docker-ubuntu docker-centos \
+ android-build docker-android ubuntu-android android