]> git.madduck.net Git - code/molly-guard.git/blobdiff - Makefile

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

improved installation
[code/molly-guard.git] / Makefile
index 242c36e6adc4bc54085cbc973e9c631756e67ac5..c4ccf7f16b984ed6856bac5aa52bcb42b668a05e 100644 (file)
--- 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) $<
 
 %.8: %.xml
        $(XP) $(DB2MAN) $<
 
-man: $(MANPAGE)
+%.gz: %
+       gzip -9 $<
+
+man: molly-guard.8
        man -l $<
 .PHONY: man
 
 clean:
        man -l $<
 .PHONY: man
 
 clean:
-       rm -f $(MANPAGE)
+       rm -f shutdown
+       rm -f molly-guard.8 molly-guard.8.gz
 .PHONY: clean
 
 .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