added
[rrq/hourglass.git] / Makefile
index 1d27cfa13b0d9be73d0345edf7a9df18e84cc62c..b5bcebdb7b92c27f0287e463189021aadd52e815 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,11 +2,13 @@ MAIN = command.lsp
 LSP = $(filter-out $(MAIN),$(wildcard *.lsp))
 BIN = hourglass hourglass-web hourglass-site
 DOCS = hourglass-guide.html hourglass-guide.pdf
+MANPGS = hourglass.8 hourglass-site.8 hourglass-web.8
 IMGS = $(wildcard *.png)
 OTHER = setup.sh hourglass.conf
 VERSION = 0.1
+GENERATED = $(BIN) $(DOCS) $(MANPGS)
 
-dist: hourglass-$(VERSION).tgz
+default: dist
 
 hourglass: $(MAIN) $(LSP)
        packnl -w $@ $^
@@ -19,15 +21,52 @@ hourglass-site: sitetool
        $(MAKE) -C sitetool
        mv sitetool/sitetool $@
 
-hourglass-$(VERSION).tgz: $(BIN) $(OTHER) $(DOCS) $(IMGS)
-       tar czf $@ $^
-
 %.html: %.adoc
-       asciidoctor $< > $@
+       asciidoctor -a 'webfonts!' $< > $@
 
 %.pdf: %.adoc | $(IMGS)
        asciidoctor-pdf $< > $@
 
+%.8: %.8.adoc
+       a2x -d manpage -f manpage $^
+
+############################################################
 clean:
        $(MAKE) -C manager clean
-       rm -f $(BIN) hourglass-$(VERSION).tgz
+       $(MAKE) -C sitetool clean
+       rm -f $(GENERATED)
+
+############################################################
+hourglass-$(VERSION).tgz: $(BIN) $(OTHER) $(DOCS) $(MANPGS) $(IMGS)
+       tar czf $@ $^
+
+dist: hourglass-$(VERSION).tgz
+
+########################################################
+BINDIR = $(DESTDIR)/usr/bin
+MANDIR = $(DESTDIR)/usr/share/man/man8
+RUNDIR = $(DESTDIR)/var/lib/hourglass
+DOCDIR = $(DESTDIR)/usr/share/hourglass
+
+INSTALLTARGETS = $(addprefix $(BINDIR)/,$(BIN))
+INSTALLTARGETS += $(addprefix $(MANDIR)/,$(MANPGS))
+INSTALLTARGETS += $(addprefix $(DOCDIR)/,$(DOCS))
+INSTALLTARGETS += $(addprefix $(RUNDIR)/,$(OTHER))
+
+$(RUNDIR)/%.conf: %.conf
+       install -D -T $< $@
+       chmod a-x $@
+
+$(MANDIR)/% $(DOCDIR)/%:%
+       install -D -T $< $@
+       chmod a-x $@
+
+$(BINDIR)/% $(RUNDIR)/%: %
+       install -D -T $< $@
+
+install: $(INSTALLTARGETS)
+
+BUILDPACKAGE = -us -uc --build=full
+
+deb:
+       PREFIX= INCLUDE_PREFIX=/usr dpkg-buildpackage $(BUILDPACKAGE)