diff Makefile @ 37:7e44a0a8dc2c

Convert the manpage to DocBook V5.0
author Guido Berhoerster <gber@opensuse.org>
date Fri, 07 Feb 2014 18:10:41 +0100
parents 82a31628a26d
children ccbbb9f3d7fc
line wrap: on
line diff
--- a/Makefile	Fri Feb 07 18:10:41 2014 +0100
+++ b/Makefile	Fri Feb 07 18:10:41 2014 +0100
@@ -38,6 +38,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)\
+	    docbook-update-source-data.xsl $$< | \
+	    $$(XSLTPROC) \
+	    --xinclude \
+	    $$(DOCBOOK5_MANPAGES_FLAGS) \
+	    --output $$@ \
+	    $$(DOCBOOK5_MANPAGES_STYLESHEET) \
+	    -
+endef
 
 DESTDIR ?=
 prefix ?=	/usr/local
@@ -49,6 +66,7 @@
 xdgautostartdir ?=	$(sysconfdir)/xdg/autostart
 
 OBJS =		main.o pkui-icon.o pkui-backend.o
+MANPAGES =	$(PACKAGE).1
 AUTOSTART_FILE =	$(PACKAGE).desktop
 MOFILES :=	$(patsubst %.po,%.mo,$(wildcard po/*.po))
 POTFILE =	po/$(PACKAGE).pot
@@ -59,12 +77,14 @@
 		-DVERSION=\"$(VERSION)\" \
 		-DLOCALEDIR="\"$(localedir)\""
 LDLIBS :=	$(shell pkg-config --libs gtk+-2.0 unique-1.0 libnotify packagekit-glib2)
+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 $@
@@ -84,6 +104,8 @@
 	$(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
 	$(COMPILE.c) -o $@ $<
 
+$(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 $< $@
 
@@ -102,7 +124,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 $(patsubst %.o,%.d,$(OBJS))