diff Makefile @ 5:1508a4c35c47

Rewrite the man page in DocBook 5 XML
author Guido Berhoerster <guido+xinhibit-applet@berhoerster.name>
date Thu, 08 Aug 2013 16:17:03 +0200
parents 9a16bf50daba
children 880ab1925442
line wrap: on
line diff
--- a/Makefile	Thu Aug 08 16:16:40 2013 +0200
+++ b/Makefile	Thu Aug 08 16:17:03 2013 +0200
@@ -35,6 +35,23 @@
 MSGFMT :=	msgfmt
 INTLTOOL_UPDATE :=	intltool-update
 INTLTOOL_MERGE :=	intltool-merge
+XSLTPROC :=	xsltproc
+DOCBOOK5_MANPAGES_STYLESHEET =	http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
+
+define generate-manpage-rule =
+%.$(1): %.$(1).xml
+	$$(XSLTPROC) \
+	    --xinclude \
+	    --stringparam package $$(PACKAGE) \
+	    --stringparam version $$(VERSION)\
+	    data/docbook-update-source-data.xsl $$< | \
+	    $$(XSLTPROC) \
+	    --xinclude \
+	    $$(DOCBOOK5_MANPAGES_FLAGS) \
+	    --output $$@ \
+	    $$(DOCBOOK5_MANPAGES_STYLESHEET) \
+	    -
+endef
 
 DESTDIR ?=
 prefix ?=	/usr/local
@@ -53,6 +70,7 @@
 endif
 
 OBJS =		main.o xia-icon.o xia-inhibitor.o xia-debug.o
+MANPAGES =	data/$(PACKAGE).1
 AUTOSTART_FILE =	data/$(PACKAGE).desktop
 MOFILES :=	$(patsubst %.po,%.mo,$(wildcard po/*.po))
 POTFILE =	po/$(PACKAGE).pot
@@ -66,12 +84,14 @@
 		-DLOCALEDIR="\"$(localedir)\""
 LDLIBS :=	$(LDLIBS_LIBXTST) \
 		$(shell pkg-config --libs glib-2.0 gtk+-2.0 unique-1.0)
+DOCBOOK5_MANPAGES_FLAGS =	--stringparam man.authors.section.enabled 0 \
+				--stringparam man.copyright.section.enabled 0
 
 .DEFAULT_TARGET = all
 
 .PHONY: all clean clobber dist install
 
-all: $(PACKAGE) $(MOFILES) $(AUTOSTART_FILE)
+all: $(PACKAGE) $(MANPAGES) $(MOFILES) $(AUTOSTART_FILE)
 
 $(PACKAGE): $(OBJS)
 	$(LINK.o) $^ $(LDLIBS) -o $@
@@ -94,6 +114,8 @@
 	        -e 's/$$/ :/' < $*.d >> $*.P; \
 	rm -f $*.d
 
+$(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section))))
+
 %.desktop: %.desktop.in $(MOFILES)
 	$(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@
 
@@ -116,7 +138,7 @@
 	        "$(DESTDIR)$(mandir)/man1/$(PACKAGE).1"
 
 clean:
-	rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(AUTOSTART_FILE)
+	rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(MANPAGES) $(AUTOSTART_FILE)
 
 clobber: clean
 	rm -f *.P