fix: Makefile

This commit is contained in:
Markus Pesch 2021-05-26 19:57:47 +02:00
parent ffbc8a793c
commit a62bf175cb
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
2 changed files with 24 additions and 56 deletions

3
.gitignore vendored
View File

@ -1,7 +1,8 @@
# absolute files # absolute files
bin
.env .env
flucky*
# directories # directories
.vscode/ .vscode/

View File

@ -7,42 +7,9 @@ PREFIX?=/usr/local
# BINARIES # BINARIES
# ============================================================================== # ==============================================================================
EXECUTABLE_TARGETS:= \ all: ${EXECUTABLE}
bin/linux/amd64/${EXECUTABLE} \
bin/linux/arm/5/${EXECUTABLE} \
bin/linux/arm/7/${EXECUTABLE} \
bin/tmp/${EXECUTABLE}
${EXECUTABLE}: bin/tmp/${EXECUTABLE} ${EXECUTABLE}:
bin/linux/amd64/${EXECUTABLE}:
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64 \
GOPROXY=$(shell go env GOPROXY) \
GOPRIVATE=$(shell go env GOPRIVATE) \
go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@}
bin/linux/arm/5/${EXECUTABLE}:
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=arm \
GOARM=5 \
GOPROXY=$(shell go env GOPROXY) \
GOPRIVATE=$(shell go env GOPRIVATE) \
go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@}
bin/linux/arm/7/${EXECUTABLE}:
CC=arm-linux-gnueabihf-gcc \
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=arm \
GOARM=7 \
GOPROXY=$(shell go env GOPROXY) \
GOPRIVATE=$(shell go env GOPRIVATE) \
go build -ldflags "-X main.version=${VERSION:v%=%}" -o ${@}
bin/tmp/${EXECUTABLE}:
CGO_ENABLED=1 \ CGO_ENABLED=1 \
GOPROXY=$(shell go env GOPROXY) \ GOPROXY=$(shell go env GOPROXY) \
GOPRIVATE=$(shell go env GOPRIVATE) \ GOPRIVATE=$(shell go env GOPRIVATE) \
@ -50,48 +17,48 @@ bin/tmp/${EXECUTABLE}:
# COMPLETIONS # COMPLETIONS
# ============================================================================== # ==============================================================================
bin/tmp/${EXECUTABLE}.sh: bin/tmp/${EXECUTABLE} ${EXECUTABLE}.sh: ${EXECUTABLE}
bin/tmp/${EXECUTABLE} completion bash > ${@} ${EXECUTABLE} completion bash > ${@}
bin/tmp/${EXECUTABLE}.fish: bin/tmp/${EXECUTABLE} ${EXECUTABLE}.fish: ${EXECUTABLE}
bin/tmp/${EXECUTABLE} completion fish > ${@} ${EXECUTABLE} completion fish > ${@}
bin/tmp/${EXECUTABLE}.zsh: bin/tmp/${EXECUTABLE} ${EXECUTABLE}.zsh: ${EXECUTABLE}
bin/tmp/${EXECUTABLE} completion zsh > ${@} ${EXECUTABLE} completion zsh > ${@}
# UN/INSTALL # UN/INSTALL
# ============================================================================== # ==============================================================================
PHONY+=install PHONY+=install
install: bin/tmp/${EXECUTABLE} bin/tmp/${EXECUTABLE}.sh bin/tmp/${EXECUTABLE}.fish bin/tmp/${EXECUTABLE}.zsh install: ${EXECUTABLE} ${EXECUTABLE}.sh ${EXECUTABLE}.fish ${EXECUTABLE}.zsh
install --directory ${DESTDIR}${PREFIX}/bin install --directory ${DESTDIR}${PREFIX}/bin
install --mode 755 bin/tmp/${EXECUTABLE} ${DESTDIR}${PREFIX}/bin/${EXECUTABLE} install --mode 755 ${EXECUTABLE} ${DESTDIR}${PREFIX}/bin/${EXECUTABLE}
install --directory ${DESTDIR}/etc/bash_completion.d
install --mode 755 bin/tmp/${EXECUTABLE}.sh ${DESTDIR}/etc/bash_completion.d/${EXECUTABLE}.sh
install --directory ${DESTDIR}/usr/share/fish/vendor_completions.d
install --mode 644 bin/tmp/${EXECUTABLE}.fish ${DESTDIR}/usr/share/fish/vendor_completions.d/${EXECUTABLE}.fish
install --directory ${DESTDIR}/usr/lib/systemd/system install --directory ${DESTDIR}/usr/lib/systemd/system
install --mode 644 systemd/${EXECUTABLE}.service ${DESTDIR}/usr/lib/systemd/system/${EXECUTABLE}.service install --mode 644 systemd/${EXECUTABLE}.service ${DESTDIR}/usr/lib/systemd/system/${EXECUTABLE}.service
install --directory ${DESTDIR}/usr/share/licenses/${EXECUTABLE} install --directory ${DESTDIR}${PREFIX}/share/bash-completion/completions/
install --mode 644 LICENSE ${DESTDIR}/usr/share/licenses/${EXECUTABLE}/LICENSE install --mode 644 ${EXECUTABLE}.sh ${DESTDIR}${PREFIX}/share/bash-completion/completions/${EXECUTABLE}.sh
install --directory ${DESTDIR}${PREFIX}/fish/vendor_completions.d
install --mode 644 ${EXECUTABLE}.fish ${DESTDIR}${PREFIX}/fish/vendor_completions.d/${EXECUTABLE}.fish
install --directory ${DESTDIR}${PREFIX}/licenses/${EXECUTABLE}
install --mode 644 LICENSE ${DESTDIR}${PREFIX}/licenses/${EXECUTABLE}/LICENSE
PHONY+=uninstall PHONY+=uninstall
uninstall: uninstall:
-rm --recursive --force \ -rm --recursive --force \
${DESTDIR}${PREFIX}/bin/${EXECUTABLE} \ ${DESTDIR}${PREFIX}/bin/${EXECUTABLE} \
${DESTDIR}/etc/bash_completion.d/${EXECUTABLE}.sh \
${DESTDIR}/usr/lib/systemd/system/${EXECUTABLE}.service \ ${DESTDIR}/usr/lib/systemd/system/${EXECUTABLE}.service \
${DESTDIR}/usr/share/fish/vendor_completions.d/${EXECUTABLE}.fish \ ${DESTDIR}${PREFIX}/share/bash-completion/completions/${EXECUTABLE}.sh \
${DESTDIR}/usr/share/licenses/${EXECUTABLE}/LICENSE ${DESTDIR}${PREFIX}/fish/vendor_completions.d/${EXECUTABLE}.fish \
${DESTDIR}${PREFIX}/licenses/${EXECUTABLE}/LICENSE
# CLEAN # CLEAN
# ============================================================================== # ==============================================================================
PHONY+=clean PHONY+=clean
clean: clean:
rm --force --recursive bin/ || true rm --force --recursive ${EXECUTABLE}* || true
# TEST # TEST
# ============================================================================== # ==============================================================================