Changes to makefile

This commit is contained in:
Jguer 2017-07-04 18:54:03 +01:00
parent b7eb2f963f
commit 2ea7510093

View file

@ -1,16 +1,13 @@
.PHONY: build doc fmt lint run test vendor_clean vendor_get vendor_update vet .PHONY: build doc fmt lint run test vendor_clean vendor_get vendor_update vet
# Prepend our _vendor directory to the system GOPATH
# so that import path resolution will prioritize
# our third party snapshots.
VERSION := $(shell git rev-list --count master) VERSION := $(shell git rev-list --count master)
LDFLAGS=-ldflags "-s -w -X main.version=${VERSION}" LDFLAGS=-ldflags "-s -w -X main.version=${VERSION}"
GOFILES := $(shell ls *.go | grep -v /vendor/) GOFILES := $(shell ls *.go | grep -v /vendor/)
ARCH=$(shell uname -m)
PKGNAME=yay PKGNAME=yay
BINARY=./bin/${PKGNAME}
ARCH64="amd64" OUTPUT="${PKGNAME}_2.${VERSION}_${ARCH}/"
ARCH86="386" PACKAGE="${PKGNAME}_2.${VERSION}_${ARCH}"
default: build default: build
@ -19,25 +16,17 @@ install:
test: test:
go test ./... go test ./...
build: build:
go build -v -o ${BINARY} ${LDFLAGS} ./cmd/yay/ go build -v -o ${OUTPUT}/${PKGNAME} ${LDFLAGS}
release64: release:
GOARCH=${ARCH64} go build -v -o ./${PKGNAME}_1.${VERSION}_${ARCH64}/${PKGNAME} ${LDFLAGS} ./cmd/yay/ GOARCH=${ARCH64} go build -v -o ${OUTPUT}/${PKGNAME} ${LDFLAGS}
cp ./LICENSE ./${PKGNAME}_1.${VERSION}_${ARCH64}/ cp ./LICENSE ${OUTPUT}
cp ./yay.fish ./${PKGNAME}_1.${VERSION}_${ARCH64}/ cp ./yay.8 ${OUTPUT}
cp ./zsh-completion ./${PKGNAME}_1.${VERSION}_${ARCH64}/ cp ./zsh-completion ${OUTPUT}
cp ./bash-completion ./${PKGNAME}_1.${VERSION}_${ARCH64}/ cp ./yay.fish ${OUTPUT}
tar -czvf ${PKGNAME}_1.${VERSION}_${ARCH64}.tar.gz ${PKGNAME}_1.${VERSION}_${ARCH64} cp ./bash-completion ${OUTPUT}
release86: tar -czvf ${PACKAGE}.tar.gz ${PACKAGE}
GOARCH=${ARCH86} go build -v -o ./${PKGNAME}_1.${VERSION}_${ARCH86}/${PKGNAME} ${LDFLAGS} ./cmd/yay/ rm -r ${OUTPUT}
cp ./LICENSE ./${PKGNAME}_1.${VERSION}_${ARCH86}/
cp ./yay.fish ./${PKGNAME}_1.${VERSION}_${ARCH86}/
cp ./zsh-completion ./${PKGNAME}_1.${VERSION}_${ARCH86}/
cp ./bash-completion ./${PKGNAME}_1.${VERSION}_${ARCH86}/
tar -czvf ${PKGNAME}_1.${VERSION}_${ARCH86}.tar.gz ${PKGNAME}_1.${VERSION}_${ARCH86}
run:
build
${BINARY}
clean: clean:
go clean go clean
rm -r ./${PKGNAME}_1* rm -r ./${PKGNAME}_*