mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-29 16:23:57 +00:00
Refactor Makefile and Dockerfiles
This commit is contained in:
parent
313578a1a0
commit
6c3489087c
@ -19,12 +19,8 @@ RUN echo '[multilib]' >> /etc/pacman.conf && \
|
||||
pacman-db-upgrade && yes | pacman -Sy gcc-multilib lib32-ncurses && \
|
||||
cd $GOROOT/src && GOARCH=386 ./make.bash
|
||||
|
||||
# Symlink fzf directory
|
||||
RUN mkdir -p /go/src/github.com/junegunn && \
|
||||
ln -s /fzf /go/src/github.com/junegunn/fzf
|
||||
|
||||
# Volume
|
||||
VOLUME /fzf
|
||||
VOLUME /go
|
||||
|
||||
# Default CMD
|
||||
CMD cd /go/src/github.com/junegunn/fzf/src && /bin/bash
|
||||
|
@ -13,12 +13,8 @@ ENV GOPATH /go
|
||||
ENV GOROOT /go1.4
|
||||
ENV PATH /go1.4/bin:$PATH
|
||||
|
||||
# Symlink fzf directory
|
||||
RUN mkdir -p /go/src/github.com/junegunn && \
|
||||
ln -s /fzf /go/src/github.com/junegunn/fzf
|
||||
|
||||
# Volume
|
||||
VOLUME /fzf
|
||||
VOLUME /go
|
||||
|
||||
# Default CMD
|
||||
CMD cd /go/src/github.com/junegunn/fzf/src && /bin/bash
|
||||
|
@ -18,12 +18,8 @@ ENV PATH /go1.4/bin:$PATH
|
||||
RUN apt-get install -y lib32ncurses5-dev && \
|
||||
cd $GOROOT/src && GOARCH=386 ./make.bash
|
||||
|
||||
# Symlink fzf directory
|
||||
RUN mkdir -p /go/src/github.com/junegunn && \
|
||||
ln -s /fzf /go/src/github.com/junegunn/fzf
|
||||
|
||||
# Volume
|
||||
VOLUME /fzf
|
||||
VOLUME /go
|
||||
|
||||
# Default CMD
|
||||
CMD cd /go/src/github.com/junegunn/fzf/src && /bin/bash
|
||||
|
40
src/Makefile
40
src/Makefile
@ -1,3 +1,7 @@
|
||||
ifndef GOPATH
|
||||
$(error GOPATH is undefined)
|
||||
endif
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
GOOS := darwin
|
||||
@ -9,7 +13,7 @@ ifneq ($(shell uname -m),x86_64)
|
||||
$(error "Build on $(UNAME_M) is not supported, yet.")
|
||||
endif
|
||||
|
||||
SOURCES := $(wildcard *.go fzf/*.go)
|
||||
SOURCES := $(wildcard *.go */*.go)
|
||||
BINDIR := ../bin
|
||||
|
||||
BINARY32 := fzf-$(GOOS)_386
|
||||
@ -17,7 +21,7 @@ BINARY64 := fzf-$(GOOS)_amd64
|
||||
RELEASE32 = fzf-$(shell fzf/$(BINARY64) --version)-$(GOOS)_386
|
||||
RELEASE64 = fzf-$(shell fzf/$(BINARY64) --version)-$(GOOS)_amd64
|
||||
|
||||
all: release
|
||||
all: test release
|
||||
|
||||
release: build
|
||||
cd fzf && \
|
||||
@ -27,23 +31,31 @@ release: build
|
||||
|
||||
build: fzf/$(BINARY32) fzf/$(BINARY64)
|
||||
|
||||
test: $(SOURCES)
|
||||
test:
|
||||
go get
|
||||
go test -v
|
||||
|
||||
fzf/$(BINARY32): test
|
||||
cd fzf && GOARCH=386 CGO_ENABLED=1 go build -o $(BINARY32)
|
||||
install: $(BINDIR)/fzf
|
||||
|
||||
fzf/$(BINARY64): test
|
||||
cd fzf && go build -o $(BINARY64)
|
||||
|
||||
install: fzf/$(BINARY64)
|
||||
mkdir -p $(BINDIR)
|
||||
cp -f fzf/$(BINARY64) $(BINDIR)/fzf
|
||||
uninstall:
|
||||
rm -f $(BINDIR)/fzf $(BINDIR)/$(BINARY64)
|
||||
|
||||
clean:
|
||||
cd fzf && rm -f $(BINARY32) $(BINARY64) $(RELEASE32).tgz $(RELEASE64).tgz
|
||||
|
||||
fzf/$(BINARY32): $(SOURCES)
|
||||
cd fzf && GOARCH=386 CGO_ENABLED=1 go build -o $(BINARY32)
|
||||
|
||||
fzf/$(BINARY64): $(SOURCES)
|
||||
cd fzf && go build -o $(BINARY64)
|
||||
|
||||
$(BINDIR)/fzf: fzf/$(BINARY64) | $(BINDIR)
|
||||
cp -f fzf/$(BINARY64) $(BINDIR)
|
||||
cd $(BINDIR) && ln -sf $(BINARY64) fzf
|
||||
|
||||
$(BINDIR):
|
||||
mkdir -p $@
|
||||
|
||||
# Linux distribution to build fzf on
|
||||
DISTRO := arch
|
||||
|
||||
@ -51,11 +63,11 @@ docker:
|
||||
docker build -t junegunn/$(DISTRO)-sandbox - < Dockerfile.$(DISTRO)
|
||||
|
||||
linux: docker
|
||||
docker run -i -t -v $(shell cd ..; pwd):/fzf junegunn/$(DISTRO)-sandbox \
|
||||
docker run -i -t -v $(GOPATH):/go 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 \
|
||||
docker run -i -t -v $(GOPATH):/go junegunn/$(DISTRO)-sandbox \
|
||||
sh -c 'cd /go/src/github.com/junegunn/fzf/src; /bin/bash'
|
||||
|
||||
.PHONY: build release install linux clean docker $(DISTRO)
|
||||
.PHONY: all build release test install uninstall clean docker linux $(DISTRO)
|
||||
|
Loading…
Reference in New Issue
Block a user