aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-04-03 15:38:21 +0000
committerB Stack <bgstack15@gmail.com>2020-04-03 15:38:21 +0000
commit25a302edc305fe9bf5cd5561c91769c659ea815f (patch)
treeaf3658a050028eb914180c8ddd83a33b0ba5a611 /src/Makefile
parentMerge branch 'add-trayicon' into 'master' (diff)
parentMerge branch 'master' into 'dev' (diff)
downloadlogout-manager-25a302edc305fe9bf5cd5561c91769c659ea815f.tar.gz
logout-manager-25a302edc305fe9bf5cd5561c91769c659ea815f.tar.bz2
logout-manager-25a302edc305fe9bf5cd5561c91769c659ea815f.zip
Merge branch 'dev' into 'master'HEADmaster
minor refactor and add documentation Closes #1, #3, #2, #4, #5, and #6 See merge request bgstack15/logout-manager!3
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile43
1 files changed, 29 insertions, 14 deletions
diff --git a/src/Makefile b/src/Makefile
index 010b71e..6407823 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -16,9 +16,11 @@
# Document:
# Includes a nice way to dynamically generate dependencies as self-reported by all the files.
# Dependencies:
+# exclude-raw: go-md2man
+# exclude-devuan: go-md2man
APPNAME = logout-manager
-APPVERSION = 0.0.2
+APPVERSION = 0.0.4
SRCDIR = $(CURDIR)
prefix = /usr
SYSCONFDIR = $(DESTDIR)/etc
@@ -27,10 +29,11 @@ DEFAULTDIR = $(DESTDIR)/etc/sysconfig
BINDIR = $(DESTDIR)$(prefix)/bin
SHAREDIR = $(DESTDIR)$(prefix)/share
LIBEXECDIR = $(DESTDIR)$(prefix)/libexec
-DOCDIR = $(SHAREDIR)/doc/$(APPNAME)
APPDIR = $(SHAREDIR)/$(APPNAME)
APPSDIR = $(SHAREDIR)/applications
BASHCDIR = $(SHAREDIR)/bash-completion/completions
+DOCDIR = $(SHAREDIR)/doc/$(APPNAME)
+MANDIR = $(SHAREDIR)/man
SUDOERSDIR = $(SYSCONFDIR)/sudoers.d
XDGAUTODIR = $(SYSCONFDIR)/xdg/autostart
@@ -39,8 +42,10 @@ cpbin :=$(shell which cp)
echobin :=$(shell which echo)
findbin :=$(shell which find)
grepbin :=$(shell which grep)
+gzipbin :=$(shell which gzip)
installbin :=$(shell which install)
lnbin :=$(shell which ln)
+md2manbin :=$(shell which go-md2man)
rmbin :=$(shell which rm)
sedbin :=$(shell which sed)
sortbin :=$(shell which sort)
@@ -48,23 +53,28 @@ truebin :=$(shell which true)
uniqbin :=$(shell which uniq)
xargsbin :=$(shell which xargs)
+SEPARATOR ?=,
+
all:
- ${echobin} "No compilation in this package."
+ @${echobin} "No compilation in this package."
-.PHONY: clean install uninstall list deplist deplist_opts
+.PHONY: clean install uninstall list deplist deplist_opts install_files install_man
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' --exclude-dir='doc' -A5 -riIE dependencies $(SRCDIR) | ${awkbin} -v 'distro=$(DISTRO)' 'tolower($$0) ~ distro {$$1="";$$2="";print}' | ${awkbin} 'BEGIN{cmd="${xargsbin} -n1"} $$0 !~ /\(/{print $$0 | cmd ; close(cmd);} $$0 ~ /\(/{print;}' | ${sortbin} | ${uniqbin} | ${sedbin} -r -e 's/$$/$(SEPARATOR)/' | ${xargsbin}
+ @# deplist 2020-03-24 input must be comma separated
+ @${grepbin} -h --exclude-dir='doc' -riIE '\<dep-' ${SRCDIR} | ${awkbin} -v "domain=${DISTRO}" 'tolower($$2) ~ "dep-"domain {$$1="";$$2="";print}' | tr ',' '\n' | ${sortbin} | ${uniqbin} | ${sedbin} -r -e 's/^\s*//' -e "s/\s*\$$/${SEPARATOR}/" | ${xargsbin}
deplist_opts:
- @${echobin} "el7" 1>&2
- @${echobin} "devuan" 1>&2
+ @# deplist_opts 2020-03-24 find all available dependency domains
+ @${grepbin} -h -o -riIE '\<dep-[^\ :]+:' ${SRCDIR} | ${sedbin} -r -e 's/dep-//;' -e 's/:$$//;' | ${sortbin} | ${uniqbin} 1>&2
-install:
+install: install_files install_man
+
+install_files:
@${echobin} Installing files to ${DESTDIR}
${installbin} -d ${SYSCONFDIR} ${DEFAULTDIR} ${BINDIR} \
${APPSDIR} ${APPDIR} ${DOCDIR} ${BASHCDIR} ${SUDOERSDIR} \
@@ -80,17 +90,22 @@ install:
${installbin} -m 0755 -t ${LIBEXECDIR}/${APPNAME} ${SRCDIR}/usr/libexec/${APPNAME}/*
${installbin} -m 0644 -t ${XDGAUTODIR} ${SRCDIR}/etc/xdg/autostart/*
# symlink, when alternatives is not being used
- ${lnbin} -s logout-manager-gtk.py ${BINDIR}/logout-manager
+ ${lnbin} -s logout-manager-gtk ${BINDIR}/logout-manager || :
+
+install_man:
+ifeq ($(md2manbin),)
+ @${echobin} Cannot install man pages, because go-md2man is not found.
+ @false
+endif
+ ${installbin} -d ${MANDIR}/man1 ${MANDIR}/man5 ${MANDIR}/man7
+ for tm in $$( ${findbin} ${SRCDIR}/usr/share/man ! -type d -name '*[0-9].md' -printf '%P\n' ) ; do ${md2manbin} < ${SRCDIR}/usr/share/man/$${tm} | ${gzipbin} > ${MANDIR}/$${tm%%.md}.gz ; done
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}
+ ${rmbin} -f $$( ${findbin} ${SRCDIR} -mindepth 1 ! -type d ! -name 'Makefile' -printf '%p\n' | ${sedbin} -r -e "s:^${SRCDIR}:${DESTDIR}:" -e '/man[0-9]\/.*[0-9]\.md$$/{s:\.md$$:.gz:}' ) ${DEFAULTDIR}/${APPNAME} ${BINDIR}/logout-manager
# 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."
+ -@${echobin} "target $@ not implemented yet! Gotta say unh."
bgstack15