comparison Makefile @ 5:f0c7f45022c0

Add manpage
author Guido Berhoerster <guido+xwrited@berhoerster.name>
date Sun, 27 Apr 2014 23:12:06 +0200
parents 6e2d746b06ae
children 129f316b99aa
comparison
equal deleted inserted replaced
4:f219f96f07c2 5:f0c7f45022c0
40 SED := sed 40 SED := sed
41 PASTE := paste 41 PASTE := paste
42 MSGFMT := msgfmt 42 MSGFMT := msgfmt
43 INTLTOOL_UPDATE := intltool-update 43 INTLTOOL_UPDATE := intltool-update
44 INTLTOOL_MERGE := intltool-merge 44 INTLTOOL_MERGE := intltool-merge
45 XSLTPROC := xsltproc
46 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
47
48 define generate-manpage-rule =
49 %.$(1): %.$(1).xml
50 $$(XSLTPROC) \
51 --xinclude \
52 --stringparam package $$(PACKAGE) \
53 --stringparam version $$(VERSION)\
54 data/docbook-update-source-data.xsl $$< | \
55 $$(XSLTPROC) \
56 --xinclude \
57 $$(DOCBOOK5_MANPAGES_FLAGS) \
58 --output $$@ \
59 $$(DOCBOOK5_MANPAGES_STYLESHEET) \
60 -
61 endef
45 62
46 DESTDIR ?= 63 DESTDIR ?=
47 prefix ?= /usr/local 64 prefix ?= /usr/local
48 bindir ?= $(prefix)/bin 65 bindir ?= $(prefix)/bin
49 datadir ?= $(prefix)/share 66 datadir ?= $(prefix)/share
67 mandir ?= $(datadir)/man
50 localedir ?= $(datadir)/locale 68 localedir ?= $(datadir)/locale
51 sysconfdir ?= /etc 69 sysconfdir ?= /etc
52 xdgautostartdir ?= $(sysconfdir)/xdg/autostart 70 xdgautostartdir ?= $(sysconfdir)/xdg/autostart
53 71
54 OS_NAME := $(shell uname -s) 72 OS_NAME := $(shell uname -s)
80 else 98 else
81 PKGCONFIG_LIBS += dbus-glib-1 99 PKGCONFIG_LIBS += dbus-glib-1
82 endif 100 endif
83 101
84 OBJS = main.o xwrited-debug.o xwrited-unique.o $(OBJS_UTMP) 102 OBJS = main.o xwrited-debug.o xwrited-unique.o $(OBJS_UTMP)
85 AUTOSTART_FILE = $(PACKAGE).desktop 103 MANPAGES = data/$(PACKAGE).1
104 AUTOSTART_FILE = data/$(PACKAGE).desktop
86 MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po)) 105 MOFILES := $(patsubst %.po,%.mo,$(wildcard po/*.po))
87 POTFILE = po/$(PACKAGE).pot 106 POTFILE = po/$(PACKAGE).pot
88 POSRCS := $(shell $(SED) -e 's/\#.*//' -e '/^[ \t]*$$/d' \ 107 POSRCS := $(shell $(SED) -e 's/\#.*//' -e '/^[ \t]*$$/d' \
89 -e 's/^\[[^]]*\]//' po/POTFILES.in | $(PASTE) -s -d ' ') 108 -e 's/^\[[^]]*\]//' po/POTFILES.in | $(PASTE) -s -d ' ')
90 CPPFLAGS := $(CPPFLAGS_EXTRA) \ 109 CPPFLAGS := $(CPPFLAGS_EXTRA) \
95 -DVERSION=\"$(VERSION)\" \ 114 -DVERSION=\"$(VERSION)\" \
96 -DLOCALEDIR="\"$(localedir)\"" \ 115 -DLOCALEDIR="\"$(localedir)\"" \
97 -DG_LOG_DOMAIN=\"$(PACKAGE)\" 116 -DG_LOG_DOMAIN=\"$(PACKAGE)\"
98 LDLIBS := $(EXTRA_LIBS) \ 117 LDLIBS := $(EXTRA_LIBS) \
99 $(shell pkg-config --libs $(PKGCONFIG_LIBS)) 118 $(shell pkg-config --libs $(PKGCONFIG_LIBS))
119 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
120 --stringparam man.copyright.section.enabled 0
100 121
101 .DEFAULT_TARGET = all 122 .DEFAULT_TARGET = all
102 123
103 .PHONY: all clean clobber dist install 124 .PHONY: all clean clobber dist install
104 125
105 all: $(PACKAGE) $(MOFILES) $(AUTOSTART_FILE) 126 all: $(PACKAGE) $(MANPAGES) $(MOFILES) $(AUTOSTART_FILE)
106 127
107 $(PACKAGE): $(OBJS) 128 $(PACKAGE): $(OBJS)
108 $(LINK.o) $^ $(LDLIBS) -o $@ 129 $(LINK.o) $^ $(LDLIBS) -o $@
109 130
110 $(POTFILE): po/POTFILES.in $(POSRCS) 131 $(POTFILE): po/POTFILES.in $(POSRCS)
120 141
121 %.o: %.c 142 %.o: %.c
122 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d 143 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
123 $(COMPILE.c) -o $@ $< 144 $(COMPILE.c) -o $@ $<
124 145
146 $(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section))))
147
125 %.desktop: %.desktop.in $(MOFILES) 148 %.desktop: %.desktop.in $(MOFILES)
126 $(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@ 149 $(INTLTOOL_MERGE) --desktop-style --utf8 po $< $@
127 150
128 %.mo: %.po 151 %.mo: %.po
129 $(MSGFMT) -o $@ $< 152 $(MSGFMT) -o $@ $<
134 $(INSTALL.data) po/$${lang}.mo \ 157 $(INSTALL.data) po/$${lang}.mo \
135 "$(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/$(PACKAGE).mo"; \ 158 "$(DESTDIR)$(localedir)/$${lang}/LC_MESSAGES/$(PACKAGE).mo"; \
136 done 159 done
137 $(INSTALL.data) $(AUTOSTART_FILE) \ 160 $(INSTALL.data) $(AUTOSTART_FILE) \
138 "$(DESTDIR)$(xdgautostartdir)/$(notdir $(AUTOSTART_FILE))" 161 "$(DESTDIR)$(xdgautostartdir)/$(notdir $(AUTOSTART_FILE))"
162 $(INSTALL.data) data/$(PACKAGE).1 \
163 "$(DESTDIR)$(mandir)/man1/$(PACKAGE).1"
139 164
140 clean: 165 clean:
141 rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(AUTOSTART_FILE) 166 rm -f $(PACKAGE) $(OBJS) $(POTFILE) $(MOFILES) $(MANPAGES) $(AUTOSTART_FILE)
142 167
143 clobber: clean 168 clobber: clean
144 rm -f $(patsubst %.o,%.d,$(OBJS)) 169 rm -f $(patsubst %.o,%.d,$(OBJS))
145 170
146 dist: clobber 171 dist: clobber