blob: 6af4efbcc29c5042351a4bc685c0ea8cfa4542e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File: Makefile for logout-manager
# Location: logout-manager source package
# Author: bgstack15
# Startdate: 2020-03-10
# Title: Makefile for logout-manager source package
# Purpose: To use traditional Unix make utility
# History:
# Usage:
# Reference:
# https://stackoverflow.com/questions/4219255/how-do-you-get-the-list-of-targets-in-a-makefile/26339924#26339924
# https://stackoverflow.com/questions/19105241/how-do-you-conditionally-call-a-target-based-on-a-target-variable-makefile/19107231#19107231
# https://stackoverflow.com/questions/5917576/sort-a-text-file-by-line-length-including-spaces
# https://superuser.com/questions/352289/bash-scripting-test-for-empty-directory/667100#667100
# bgscripts Makefile
# Improve:
# Document:
# Dependencies:
APPNAME = logout-manager
APPVERSION = 0.0.1
SRCDIR = $(CURDIR)
prefix = /usr
SYSCONFDIR = $(DESTDIR)/etc
DEFAULTDIR = $(DESTDIR)/etc/sysconfig
# for debian use '$(DESTDIR)/etc/default'
BINDIR = $(DESTDIR)$(prefix)/bin
SHAREDIR = $(DESTDIR)$(prefix)/share
LIBEXECDIR = $(DESTDIR)$(prefix)/libexec
DOCDIR = $(SHAREDIR)/doc/$(APPNAME)
APPDIR = $(SHAREDIR)/$(APPNAME)
APPSDIR = $(SHAREDIR)/applications
awkbin :=$(shell which awk)
cpbin :=$(shell which cp)
echobin :=$(shell which echo)
findbin :=$(shell which find)
grepbin :=$(shell which grep)
installbin :=$(shell which install)
rmbin :=$(shell which rm)
sedbin :=$(shell which sed)
sortbin :=$(shell which sort)
truebin :=$(shell which true)
xargsbin :=$(shell which xargs)
lnbin :=$(shell which ln)
all:
${echobin} "No compilation in this package."
.PHONY: clean install uninstall list deplist deplist_opts
list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | ${awkbin} -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | ${sortbin} | ${grepbin} -E -v -e '^[^[:alnum:]]' -e '^$@$$'
deplist:
@if test -z "$(DISTRO)" ; then ${echobin} "Please run \`make deplist\` with DISTRO= one of: `make deplist_opts 2>&1 1>/dev/null | ${xargsbin}`. Aborted." ; exit 1 ; fi
@${grepbin} -h --exclude='Makefile' -A5 -riIE dependencies $(SRCDIR) | awk -v 'distro=$(DISTRO)' 'tolower($$0) ~ distro {$$1="";$$2="";print}' | sort | uniq | xargs
deplist_opts:
@${echobin} "el7" 1>&2
@${echobin} "devuan" 1>&2
install:
@${echobin} Installing files to ${DESTDIR}
${installbin} -d ${SYSCONFDIR} ${DEFAULTDIR} ${BINDIR} ${APPSDIR} ${APPDIR} ${DOCDIR}
${cpbin} -pr ${SRCDIR}/etc/*.* ${SYSCONFDIR}
${cpbin} -pr ${SRCDIR}/etc/sysconfig/* ${DEFAULTDIR}
${cpbin} -pr ${SRCDIR}/usr/bin/* ${BINDIR}
${cpbin} -pr ${SRCDIR}/usr/share/applications/* ${APPSDIR}
${cpbin} -pr ${SRCDIR}/usr/share/${APPNAME}/*.* ${APPDIR}
${cpbin} -pr ${SRCDIR}/usr/share/doc/${APPNAME}/* ${DOCDIR}
# symlink, when alternatives is not being used
${lnbin} -s logout-manager-gtk.py ${BINDIR}/logout-manager
uninstall:
@${echobin} SRCDIR=${SRCDIR}
${rmbin} -f $$( ${findbin} ${SRCDIR} -mindepth 1 ! -type d -printf '%p\n' | ${sedbin} -r -e "s:^${SRCDIR}:${DESTDIR}:" ) ${DEFAULTDIR}/${APPNAME} ${BINDIR}/logout-manager
# absolute minimum directories to remove
#${rmbin} -rf ${APPDIR} ${SYSCONFDIR}/${APPNAME} ${DOCDIR}
# remove all installed directories that are now blank.
rmdir ${DEFAULTDIR} 2>/dev/null ; for word in $$( ${findbin} ${SRCDIR} -mindepth 1 -type d -printf '%p\n' | ${sedbin} -r -e "s:^${SRCDIR}:${DESTDIR}:" | ${awkbin} '{ print length, $$0 }' | sort -rn | ${awkbin} '{print $$2}' ) ; do ${findbin} $${word} -mindepth 1 1>/dev/null 2>&1 | read 1>/dev/null 2>&1 || { rmdir "$${word}" 2>/dev/null || ${truebin} ; } ; done
clean:
-${echobin} "target $@ not implemented yet! Gotta say unh."
|