mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-30 00:33:56 +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 && \
|
pacman-db-upgrade && yes | pacman -Sy gcc-multilib lib32-ncurses && \
|
||||||
cd $GOROOT/src && GOARCH=386 ./make.bash
|
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
|
||||||
VOLUME /fzf
|
VOLUME /go
|
||||||
|
|
||||||
# Default CMD
|
# Default CMD
|
||||||
CMD cd /go/src/github.com/junegunn/fzf/src && /bin/bash
|
CMD cd /go/src/github.com/junegunn/fzf/src && /bin/bash
|
||||||
|
@ -13,12 +13,8 @@ ENV GOPATH /go
|
|||||||
ENV GOROOT /go1.4
|
ENV GOROOT /go1.4
|
||||||
ENV PATH /go1.4/bin:$PATH
|
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
|
||||||
VOLUME /fzf
|
VOLUME /go
|
||||||
|
|
||||||
# Default CMD
|
# Default CMD
|
||||||
CMD cd /go/src/github.com/junegunn/fzf/src && /bin/bash
|
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 && \
|
RUN apt-get install -y lib32ncurses5-dev && \
|
||||||
cd $GOROOT/src && GOARCH=386 ./make.bash
|
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
|
||||||
VOLUME /fzf
|
VOLUME /go
|
||||||
|
|
||||||
# Default CMD
|
# Default CMD
|
||||||
CMD cd /go/src/github.com/junegunn/fzf/src && /bin/bash
|
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)
|
UNAME_S := $(shell uname -s)
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
GOOS := darwin
|
GOOS := darwin
|
||||||
@ -9,7 +13,7 @@ ifneq ($(shell uname -m),x86_64)
|
|||||||
$(error "Build on $(UNAME_M) is not supported, yet.")
|
$(error "Build on $(UNAME_M) is not supported, yet.")
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SOURCES := $(wildcard *.go fzf/*.go)
|
SOURCES := $(wildcard *.go */*.go)
|
||||||
BINDIR := ../bin
|
BINDIR := ../bin
|
||||||
|
|
||||||
BINARY32 := fzf-$(GOOS)_386
|
BINARY32 := fzf-$(GOOS)_386
|
||||||
@ -17,7 +21,7 @@ BINARY64 := fzf-$(GOOS)_amd64
|
|||||||
RELEASE32 = fzf-$(shell fzf/$(BINARY64) --version)-$(GOOS)_386
|
RELEASE32 = fzf-$(shell fzf/$(BINARY64) --version)-$(GOOS)_386
|
||||||
RELEASE64 = fzf-$(shell fzf/$(BINARY64) --version)-$(GOOS)_amd64
|
RELEASE64 = fzf-$(shell fzf/$(BINARY64) --version)-$(GOOS)_amd64
|
||||||
|
|
||||||
all: release
|
all: test release
|
||||||
|
|
||||||
release: build
|
release: build
|
||||||
cd fzf && \
|
cd fzf && \
|
||||||
@ -27,23 +31,31 @@ release: build
|
|||||||
|
|
||||||
build: fzf/$(BINARY32) fzf/$(BINARY64)
|
build: fzf/$(BINARY32) fzf/$(BINARY64)
|
||||||
|
|
||||||
test: $(SOURCES)
|
test:
|
||||||
go get
|
go get
|
||||||
go test -v
|
go test -v
|
||||||
|
|
||||||
fzf/$(BINARY32): test
|
install: $(BINDIR)/fzf
|
||||||
cd fzf && GOARCH=386 CGO_ENABLED=1 go build -o $(BINARY32)
|
|
||||||
|
|
||||||
fzf/$(BINARY64): test
|
uninstall:
|
||||||
cd fzf && go build -o $(BINARY64)
|
rm -f $(BINDIR)/fzf $(BINDIR)/$(BINARY64)
|
||||||
|
|
||||||
install: fzf/$(BINARY64)
|
|
||||||
mkdir -p $(BINDIR)
|
|
||||||
cp -f fzf/$(BINARY64) $(BINDIR)/fzf
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cd fzf && rm -f $(BINARY32) $(BINARY64) $(RELEASE32).tgz $(RELEASE64).tgz
|
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
|
# Linux distribution to build fzf on
|
||||||
DISTRO := arch
|
DISTRO := arch
|
||||||
|
|
||||||
@ -51,11 +63,11 @@ docker:
|
|||||||
docker build -t junegunn/$(DISTRO)-sandbox - < Dockerfile.$(DISTRO)
|
docker build -t junegunn/$(DISTRO)-sandbox - < Dockerfile.$(DISTRO)
|
||||||
|
|
||||||
linux: docker
|
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'
|
/bin/bash -ci 'cd /go/src/github.com/junegunn/fzf/src; make'
|
||||||
|
|
||||||
$(DISTRO): docker
|
$(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'
|
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