summaryrefslogtreecommitdiff
path: root/doc/manual/Makefile.am
blob: 45c490ad5e473ed95b3095fde9473205d7c1dd4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
SUBDIRS = \
	images \
	po

STYLESHEET = $(PACKAGE)-html.xsl
DOCUMENT = $(PACKAGE).xml
LINGUAS = $(shell cd $(srcdir)/po && echo `/bin/ls *.po | sed 's,[.]po,,g'`)
ALL_LINGUAS = C $(LINGUAS)

# install the html files to the destdir
install-data-local:
	for lang in $(ALL_LINGUAS); do \
		if test -d $(srcdir)/html/$$lang; then \
			dest=$(DESTDIR)$(docdir)/html/$$lang; \
			$(mkinstalldirs) $$dest; \
			installfiles=`echo $(srcdir)/html/$$lang/*`; \
			for file in $$installfiles; do \
				echo "--- Installing "$$file; \
				$(INSTALL_DATA) $$file $$dest; \
			done; \
			if test x"$$lang" != x"C" -a ! -d $(srcdir)/images/$$lang; then \
				echo "--- Creating symlink to C images for $$lang"; \
				ln -sf ../C/images $(DESTDIR)$(docdir)/html/$$lang/images; \
			fi \
		fi \
	done;

# remove installed files from the destdir
uninstall-local:
	for lang in $(ALL_LINGUAS); do \
		dest=$(DESTDIR)$(docdir)/html/$$lang; \
		if test -d $$dest; then \
			if test -L $$dest/images; then \
				rm -rf $$dest; \
			else \
				rm -f $$dest/*.html; \
			fi \
		fi \
	done

# remove generate html from the srcdir
clean-local:
	rm -rf $(srcdir)/html

if GENERATE_DOCUMENTATION

# regenerate po(t) files
update-po:
	rm -f $(srcdir)/po/$(GETTEXT_PACKAGE).pot; \
	$(XML2PO) -o $(srcdir)/po/$(GETTEXT_PACKAGE).pot $(srcdir)/$(DOCUMENT); \
	for lang in $(LINGUAS); do \
		pofile=$(srcdir)/po/$$lang.po; \
		$(XML2PO) -u $(srcdir)/po/$$lang.po $(srcdir)/$(DOCUMENT); \
	done

# build the translated help files
doc-build.stamp: $(srcdir)/$(DOCUMENT) $(srcdir)/$(STYLESHEET)
	@chmod -R u+w $(srcdir); \
	rm -rf $(srcdir)/html; \
	echo; \
	for lang in $(ALL_LINGUAS); do \
		pofile=$(srcdir)/po/$$lang.po; \
		echo "*** Generating $$lang documentation"; \
		if test x"$$lang" = x"C"; then \
			cp $(srcdir)/$(DOCUMENT) xgen-doc; \
		else \
			echo "Building the translated DocBook XML file"; \
			$(XML2PO) -e -l $$lang -p $$pofile $(srcdir)/$(DOCUMENT) > xgen-doc; \
			rm -f .xml2po.mo; \
		fi; \
		sed -e "s,\@PACKAGE_NAME\@,$(PACKAGE_NAME),g" \
			-e "s,\@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g" \
			-i xgen-doc; \
		echo "Validating DocBook XML file"; \
		$(XMLLINT) --noout --valid xgen-doc || exit 1; \
		echo "Creating the HTML pages"; \
		$(XSLTPROC) --nonet -o $(srcdir)/html/$$lang/ $(srcdir)/$(STYLESHEET) xgen-doc; \
		chmod -R u+w $(srcdir)/html/$$lang; \
		rm -f xgen-doc; \
		echo; \
	done; \
	touch doc-build.stamp

dist-check-doc: all

else

update-po:
	@echo "*** You need to compile with --enable-gen-doc in order to make update-po"
	@false

doc-build.stamp:
	@if test ! -d $(srcdir)/html; then \
		echo; \
		echo "*** No generated documentation found. If you want to"; \
		echo "*** generate the (translated) documentation, run configure"; \
		echo "*** with --enable-gen-doc."; \
		echo; \
	fi

dist-check-doc:
	@echo "*** You need to compile with --enable-gen-doc in order to make dist"
	@false

endif

# always try to build (if compiling with --enable-build-doc) or print
# a message if no html files were found in the tarball
all: doc-build.stamp

# include the html and man files in the dist
dist-hook: dist-check-doc doc-build.stamp
	for lang in $(ALL_LINGUAS); do \
		if test -d $(srcdir)/html/$$lang; then \
			mkdir -p $(distdir)/html/$$lang; \
			cp $(srcdir)/html/$$lang/* $(distdir)/html/$$lang/; \
		fi \
	done

# css file
cssdir = $(docdir)/html
css_DATA = \
	xfce4-session.css

EXTRA_DIST = \
	$(css_DATA) \
	$(STYLESHEET) \
	$(DOCUMENT)

CLEANFILES = \
	xgen-doc \
	doc-build.stamp