X-Git-Url: https://git.madduck.net/code/molly-guard.git/blobdiff_plain/fea7b8cdf75e8aa668889f8db66270a5f971ef1a..9f14fa052e94d7b340522ddcdd3d0cfaf744aa21:/Makefile diff --git a/Makefile b/Makefile index 242c36e..c4ccf7f 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,47 @@ -DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl -XP=xsltproc -''-nonet +prefix?=/usr/local +etc_prefix?=$(prefix) +DST=$(DEST)$(prefix) +ETCDIR=$(DEST)$(etc_prefix)/etc/molly-guard -MANPAGE=molly-guard.8 - -all: $(MANPAGE) +all: molly-guard.8.gz shutdown +%.8: DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl +%.8: XP=xsltproc -''-nonet %.8: %.xml $(XP) $(DB2MAN) $< -man: $(MANPAGE) +%.gz: % + gzip -9 $< + +man: molly-guard.8 man -l $< .PHONY: man clean: - rm -f $(MANPAGE) + rm -f shutdown + rm -f molly-guard.8 molly-guard.8.gz .PHONY: clean +shutdown: shutdown.in + sed -e 's,@ETCDIR@,$(ETCDIR),g' $< > $@ + +install: shutdown molly-guard.8.gz + mkdir -m755 --parent $(DST)/share/molly-guard + install -m755 -oroot -oroot shutdown $(DST)/share/molly-guard + + mkdir -m755 --parent $(DST)/sbin + ln -s ../share/molly-guard/shutdown $(DST)/sbin/poweroff + ln -s ../share/molly-guard/shutdown $(DST)/sbin/halt + ln -s ../share/molly-guard/shutdown $(DST)/sbin/reboot + ln -s ../share/molly-guard/shutdown $(DST)/sbin/shutdown + + mkdir -m755 --parent $(ETCDIR) + install -m644 -oroot -oroot rc $(ETCDIR) + cp -r run.d $(ETCDIR) \ + && chown root.root $(ETCDIR)/run.d && chmod 755 $(ETCDIR)/run.d + + mkdir -m755 --parent $(ETCDIR)/messages.d + + mkdir -m755 --parent $(DST)/share/man/man8 + install -m644 -oroot -groot molly-guard.8.gz $(DST)/share/man/man8 +.PHONY: install