pam_panic/Makefile

34 lines
1.3 KiB
Makefile
Raw Normal View History

2018-03-27 01:32:29 +00:00
POSSIBLE_PAMDIRS = /lib/x86_64-linux-gnu/security /lib/security
PAMDIR = $(shell make detect_pamdir)
2018-03-28 02:51:23 +00:00
MANDIR = /usr/share/man
2018-03-27 01:32:29 +00:00
all:
@which reboot >/dev/null
@which poweroff >/dev/null
@which cryptsetup >/dev/null
mkdir -p build obj
gcc -fPIC -DPOWEROFF=\"`which poweroff`\" -DREBOOT=\"`which reboot`\" -DCRYPTSETUP=\"`which cryptsetup`\" -c src/pam_panic.c -o obj/pam_panic.o
ld -x --shared -o build/pam_panic.so obj/pam_panic.o
@printf "Done!\n"
clean:
rm build/pam_panic.so
rm obj/pam_panic.o
rmdir build obj
@printf "Done!\n"
detect_pamdir:
@for d in $(POSSIBLE_PAMDIRS); do if [ ! -d $${d} ]; then continue; else printf "$${d}\n"; fi; done
2018-03-28 02:34:52 +00:00
install_docs:
2018-03-28 02:51:23 +00:00
for f in `find . -name pam_panic.8 | sed 's/\/pam_panic.8//'`; do gzip -9 -c $${f}/pam_panic.8 > $(MANDIR)/$${f}/pam_panic.8.gz; done
2018-03-28 02:34:52 +00:00
2018-03-27 01:32:29 +00:00
uninstall:
PAMDIR=$(PAMDIR); rm $${PAMDIR}/pam_panic.so
rm /usr/share/man/*/pam_panic.8.gz
@printf "Done!\n"
install:
PAMDIR=$(PAMDIR); if [ -z $${PAMDIR} ]; then printf "Error: PAM's shared object directory was not detected. If you know where it is, please add to POSSIBLE_PAMDIRS and make a pull request.\n"&& exit 1; else cp build/pam_panic.so $${PAMDIR}/pam_panic.so; fi
2018-03-28 02:51:23 +00:00
if [ ! -d $(MANDIR) ]; then printf "Error: Where is the manpage directory?\n" && exit 1; else make install -C man -e "MANDIR = $(MANDIR)"; fi
2018-03-27 01:32:29 +00:00
@printf "Done!\n"