mirror of
https://github.com/Jguer/yay.git
synced 2024-11-06 17:17:22 +01:00
81bccfd34e
The go root might be in different places if the user is using a different go binary that is not managed by the system (eg /usr/local/bin/go). In this case the go binary should be smart enough to default to it's own go root. Or if there are still problems, it is on the user to configure it themselves.
61 lines
1.6 KiB
Makefile
61 lines
1.6 KiB
Makefile
.PHONY: all default install uninstall test build release clean
|
|
|
|
PREFIX := /usr
|
|
DESTDIR :=
|
|
|
|
ifndef VERSION
|
|
MAJORVERSION := 8
|
|
MINORVERSION ?= $(shell git rev-list --count master)
|
|
endif
|
|
VERSION := ${MAJORVERSION}.${MINORVERSION}
|
|
|
|
LDFLAGS := -ldflags '-s -w -X main.version=${VERSION}'
|
|
ARCH := $(shell uname -m)
|
|
PKGNAME := yay
|
|
BINNAME := yay
|
|
PACKAGE := ${PKGNAME}_${VERSION}_${ARCH}
|
|
|
|
export GOPATH=$(shell pwd)/.go
|
|
|
|
default: build
|
|
|
|
all: | clean package
|
|
|
|
install:
|
|
install -Dm755 ${BINNAME} $(DESTDIR)$(PREFIX)/bin/${BINNAME}
|
|
install -Dm644 doc/${PKGNAME}.8 $(DESTDIR)$(PREFIX)/share/man/man8/${PKGNAME}.8
|
|
install -Dm644 completions/bash $(DESTDIR)$(PREFIX)/share/bash-completion/completions/${PKGNAME}
|
|
install -Dm644 completions/zsh $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_${PKGNAME}
|
|
install -Dm644 completions/fish $(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d/${PKGNAME}.fish
|
|
|
|
uninstall:
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/${BINNAME}
|
|
rm -f $(DESTDIR)$(PREFIX)/share/man/man8/${PKGNAME}.8
|
|
rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/${PKGNAME}
|
|
rm -f $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_${PKGNAME}
|
|
rm -f $(DESTDIR)$(PREFIX)/share/fish/vendor_completions.d/${PKGNAME}.fish
|
|
|
|
test:
|
|
gofmt -l *.go
|
|
@test -z "$$(gofmt -l *.go)" || (echo "Files need to be linted" && false)
|
|
go vet
|
|
go test -v
|
|
|
|
build:
|
|
go build -v ${LDFLAGS} -o ${BINNAME}
|
|
|
|
release: | test build
|
|
mkdir ${PACKAGE}
|
|
cp ./${BINNAME} ${PACKAGE}/
|
|
cp ./doc/${PKGNAME}.8 ${PACKAGE}/
|
|
cp ./completions/zsh ${PACKAGE}/
|
|
cp ./completions/fish ${PACKAGE}/
|
|
cp ./completions/bash ${PACKAGE}/
|
|
|
|
package: release
|
|
tar -czvf ${PACKAGE}.tar.gz ${PACKAGE}
|
|
clean:
|
|
rm -rf ${PKGNAME}_*
|
|
rm -f ${BINNAME}
|
|
|