comparison 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
comparison
equal deleted inserted replaced
4:54ecfe6a14cf 5:1508a4c35c47
33 GZIP := gzip 33 GZIP := gzip
34 SED := sed 34 SED := sed
35 MSGFMT := msgfmt 35 MSGFMT := msgfmt
36 INTLTOOL_UPDATE := intltool-update 36 INTLTOOL_UPDATE := intltool-update
37 INTLTOOL_MERGE := intltool-merge 37 INTLTOOL_MERGE := intltool-merge
38 XSLTPROC := xsltproc
39 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
40
41 define generate-manpage-rule =
42 %.$(1): %.$(1).xml
43 $$(XSLTPROC) \
44 --xinclude \
45 --stringparam package $$(PACKAGE) \
46 --stringparam version $$(VERSION)\
47 data/docbook-update-source-data.xsl $$< | \
48 $$(XSLTPROC) \
49 --xinclude \
50 $$(DOCBOOK5_MANPAGES_FLAGS) \
51 --output $$@ \
52 $$(DOCBOOK5_MANPAGES_STYLESHEET) \
53 -
54 endef
38 55
39 DESTDIR ?= 56 DESTDIR ?=
40 prefix ?= /usr/local 57 prefix ?= /usr/local
41 bindir ?= $(prefix)/bin 58 bindir ?= $(prefix)/bin
42 datadir ?= $(prefix)/share 59 datadir ?= $(prefix)/share
51 CPPFLAGS_LIBXTST := -DHAVE_LIBXTST 68 CPPFLAGS_LIBXTST := -DHAVE_LIBXTST
52 LDLIBS_LIBXTST := -lX11 -lXext -lXtst 69 LDLIBS_LIBXTST := -lX11 -lXext -lXtst
53 endif 70 endif
54 71
55 OBJS = main.o xia-icon.o xia-inhibitor.o xia-debug.o 72 OBJS = main.o xia-icon.o xia-inhibitor.o xia-debug.o
73 MANPAGES = data/$(PACKAGE).1
56 AUTOSTART_FILE = data/$(PACKAGE).desktop 74 AUTOSTART_FILE = data/$(PACKAGE).desktop
57 MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po)) 75 MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po))
58 POTFILE = po/$(PACKAGE).pot 76 POTFILE = po/$(PACKAGE).pot
59 POSRCS := $(shell sed -e 's/\#.*//' -e '/^[ \t]*$$/d' \ 77 POSRCS := $(shell sed -e 's/\#.*//' -e '/^[ \t]*$$/d' \
60 -e 's/^\[[^]]*\]//' po/POTFILES.in | paste -s -d ' ') 78 -e 's/^\[[^]]*\]//' po/POTFILES.in | paste -s -d ' ')
64 -DAPP_NAME=\"$(APP_NAME)\" \ 82 -DAPP_NAME=\"$(APP_NAME)\" \
65 -DVERSION=\"$(VERSION)\" \ 83 -DVERSION=\"$(VERSION)\" \
66 -DLOCALEDIR="\"$(localedir)\"" 84 -DLOCALEDIR="\"$(localedir)\""
67 LDLIBS := $(LDLIBS_LIBXTST) \ 85 LDLIBS := $(LDLIBS_LIBXTST) \
68 $(shell pkg-config --libs glib-2.0 gtk+-2.0 unique-1.0) 86 $(shell pkg-config --libs glib-2.0 gtk+-2.0 unique-1.0)
87 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
88 --stringparam man.copyright.section.enabled 0
69 89
70 .DEFAULT_TARGET = all 90 .DEFAULT_TARGET = all
71 91
72 .PHONY: all clean clobber dist install 92 .PHONY: all clean clobber dist install
73 93
74 all: $(PACKAGE) $(MOFILES) $(AUTOSTART_FILE) 94 all: $(PACKAGE) $(MANPAGES) $(MOFILES) $(AUTOSTART_FILE)
75 95
76 $(PACKAGE): $(OBJS) 96 $(PACKAGE): $(OBJS)
77 $(LINK.o) $^ $(LDLIBS) -o $@ 97 $(LINK.o) $^ $(LDLIBS) -o $@
78 98
79 $(POTFILE): po/POTFILES.in $(POSRCS) 99 $(POTFILE): po/POTFILES.in $(POSRCS)
91 $(COMPILE.c) -MD -o $@ $< 111 $(COMPILE.c) -MD -o $@ $<
92 @cp $*.d $*.P; \ 112 @cp $*.d $*.P; \
93 $(SED) -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' -e '/^$$/ d' \ 113 $(SED) -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' -e '/^$$/ d' \
94 -e 's/$$/ :/' < $*.d >> $*.P; \ 114 -e 's/$$/ :/' < $*.d >> $*.P; \
95 rm -f $*.d 115 rm -f $*.d
116
117 $(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section))))
96 118
97 %.desktop: %.desktop.in $(MOFILES) 119 %.desktop: %.desktop.in $(MOFILES)
98 $(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@ 120 $(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@
99 121
100 %.mo: %.po 122 %.mo: %.po
114 "$(DESTDIR)$(xdgautostartdir)/$(notdir $(AUTOSTART_FILE))" 136 "$(DESTDIR)$(xdgautostartdir)/$(notdir $(AUTOSTART_FILE))"
115 $(INSTALL.data) data/$(PACKAGE).1 \ 137 $(INSTALL.data) data/$(PACKAGE).1 \
116 "$(DESTDIR)$(mandir)/man1/$(PACKAGE).1" 138 "$(DESTDIR)$(mandir)/man1/$(PACKAGE).1"
117 139
118 clean: 140 clean:
119 rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(AUTOSTART_FILE) 141 rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(MANPAGES) $(AUTOSTART_FILE)
120 142
121 clobber: clean 143 clobber: clean
122 rm -f *.P 144 rm -f *.P
123 145
124 dist: clobber 146 dist: clobber