Fix build of pspp.xml
[pspp] / doc / automake.mk
1 ## PSPP - a program for statistical analysis.
2 ## Copyright (C) 2019, 2020 Free Software Foundation, Inc.
3 ##
4 ## This program is free software: you can redistribute it and/or modify
5 ## it under the terms of the GNU General Public License as published by
6 ## the Free Software Foundation, either version 3 of the License, or
7 ## (at your option) any later version.
8 ##
9 ## This program is distributed in the hope that it will be useful,
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 ## GNU General Public License for more details.
13 ##
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 ## Process this file with automake to produce Makefile.in  -*- makefile -*-
18
19 info_TEXINFOS = doc/pspp.texi doc/pspp-dev.texi
20
21 doc_pspp_TEXINFOS = doc/version.texi \
22         doc/bugs.texi \
23         doc/command-index.texi \
24         doc/concept-index.texi \
25         doc/data-io.texi \
26         doc/data-selection.texi \
27         doc/expressions.texi \
28         doc/files.texi \
29         doc/combining.texi \
30         doc/flow-control.texi \
31         doc/function-index.texi \
32         doc/installing.texi \
33         doc/introduction.texi \
34         doc/invoking.texi \
35         doc/language.texi \
36         doc/license.texi \
37         doc/pspp-convert.texi \
38         doc/pspp-output.texi \
39         doc/pspp-dump-sav.texi \
40         doc/ni.texi \
41         doc/not-implemented.texi \
42         doc/statistics.texi \
43         doc/transformation.texi \
44         doc/tutorial.texi \
45         doc/tut.texi \
46         doc/regression.texi \
47         doc/utilities.texi \
48         doc/variables.texi \
49         doc/fdl.texi
50
51 doc_pspp_dev_TEXINFOS = doc/version-dev.texi \
52         doc/dev/intro.texi \
53         doc/dev/concepts.texi \
54         doc/dev/syntax.texi \
55         doc/dev/data.texi \
56         doc/dev/i18n.texi \
57         doc/dev/output.texi \
58         doc/dev/system-file-format.texi \
59         doc/dev/pc+-file-format.texi \
60         doc/dev/portable-file-format.texi \
61         doc/dev/spv-file-format.texi \
62         doc/dev/encrypted-file-wrappers.texi \
63         doc/dev/q2c.texi
64
65 dist_man_MANS += doc/pspp.1 \
66                  doc/psppire.1
67
68 EXTRA_DIST += doc/get-commands.pl \
69               doc/help-pages-list \
70               doc/prepdoc.sh
71
72 $(srcdir)/doc/ni.texi: $(top_srcdir)/src/language/command.def doc/get-commands.pl
73         @$(MKDIR_P)  doc
74         $(AM_V_GEN)$(PERL) $(top_srcdir)/doc/get-commands.pl $(top_srcdir)/src/language/command.def > $@
75
76 $(srcdir)/doc/tut.texi:
77         @$(MKDIR_P) doc
78         $(AM_V_GEN)echo "@set example-dir $(examplesdir)" > $@
79
80
81 doc/pspp.xml: doc/pspp.texi $(doc_pspp_TEXINFOS) doc/help-pages-list
82 if BROKEN_DOCBOOK_XML
83         touch $@
84 else
85         @$(MKDIR_P)  doc
86         $(AM_V_GEN)$(MAKEINFO) $(AM_MAKEINFOFLAGS) --docbook -I $(top_srcdir) \
87                 $< -o $@
88 endif
89
90 docbookdir = $(docdir)
91 dist_docbook_DATA = doc/pspp.xml
92
93
94 CLEANFILES += pspp-dev.dvi $(docbook_DATA) doc/pspp.info* doc/pspp.xml
95
96
97 doc: $(INFO_DEPS) $(DVIS) $(PDFS) $(PSS) $(HTMLS) $(dist_docbook_DATA)
98 PHONY += doc
99
100 doc/help-pages-list: $(UI_FILES)
101          $(AM_V_GEN)cat $^ | grep '"help[-_]page"' | \
102    $(SED) -e 's% *<property name="help[-_]page">\([^<]*\)</property>%//*[@id='"'"'\1'"'"']%' \
103         -e 's%#%'"'"']/*[@id='"'"'%g' > $@,tmp
104         test -s $@,tmp
105         mv $@,tmp $@
106
107 EXTRA_DIST += \
108         doc/help-pages-list \
109         doc/pspp-manual.css
110
111
112 AM_MAKEINFOFLAGS=-I $(top_srcdir)/doc/examples -I $(top_builddir)/doc/examples
113 am__TEXINFO_TEX_DIR=:$(top_srcdir)/doc/examples:$(top_builddir)/doc/examples
114
115 ################# Example programs ##############################
116
117 EXAMPLE_SYNTAX = \
118  doc/examples/autorecode.sps \
119  doc/examples/chisquare.sps \
120  doc/examples/compute.sps \
121  doc/examples/count.sps \
122  doc/examples/descriptives.sps \
123  doc/examples/flip.sps \
124  doc/examples/frequencies.sps \
125  doc/examples/means.sps \
126  doc/examples/one-sample-t.sps \
127  doc/examples/independent-samples-t.sps \
128  doc/examples/reliability.sps \
129  doc/examples/split.sps \
130  doc/examples/weight.sps
131
132
133 EXTRA_DIST += $(EXAMPLE_SYNTAX)
134
135 EXAMPLE_OUTPUTS = $(EXAMPLE_SYNTAX:.sps=.out)
136 EXAMPLE_HTML = $(EXAMPLE_SYNTAX:.sps=.html)
137
138 $(top_builddir)/doc/pspp.info:  $(EXAMPLE_OUTPUTS)
139 $(top_builddir)/doc/pspp.ps:    $(EXAMPLE_OUTPUTS)
140 $(top_builddir)/doc/pspp.dvi:   $(EXAMPLE_OUTPUTS)
141 $(top_builddir)/doc/pspp.html:  $(EXAMPLE_HTML)
142 $(top_builddir)/doc/pspp.pdf:   $(EXAMPLE_OUTPUTS)
143 $(top_builddir)/doc/pspp.xml:   $(EXAMPLE_OUTPUTS)
144
145 # The examples cannot be built until the binary has been built
146 $(EXAMPLE_OUTPUTS): $(top_builddir)/src/ui/terminal/pspp
147 $(EXAMPLE_HTML): $(top_builddir)/src/ui/terminal/pspp
148
149 CLEANFILES += $(EXAMPLE_OUTPUTS)
150
151 SUFFIXES: .sps
152
153 # use pspp to process a syntax file and reap the output into a text file
154 .sps.out:
155         $(MKDIR_P) $(@D)
156         where=$$PWD ; \
157         (cd $(top_srcdir)/examples; ${abs_builddir}/src/ui/terminal/pspp $(abs_srcdir)/doc/examples/$(<F) -o $$where/$@)
158
159 # Use pspp to process a syntax file and reap the output into a html file
160 # Then, use sed to delete everything up to and including <body> and
161 # everything after and including </body>
162 .sps.html:
163         $(MKDIR_P) $(@D)
164         where=$$PWD ; \
165         (cd $(top_srcdir)/examples; ${abs_builddir}/src/ui/terminal/pspp $(abs_srcdir)/doc/examples/$(<F) -o $$where/$@,x -O format=html)
166         $(SED) -e '\%</body%,$$d' -e '0,/<body/d' $@,x > $@
167
168 # Insert the link tag for the cascading style sheet.
169 # But make sure these operations are idempotent.
170 html-local:
171         for h in doc/pspp.html/*.html; do \
172                 if grep -Fq '<link rel="stylesheet"' $$h; then continue; fi ; \
173                 $(SED) -i -e '/^<\/head>/i \\\
174 <link rel="stylesheet" href="pspp-manual.css">' $$h; \
175         done
176
177 install-html-local: html-local
178         $(MKDIR_P) $(DESTDIR)$(prefix)/share/doc/pspp/pspp.html
179         $(INSTALL_DATA) ${top_srcdir}/doc/pspp-manual.css $(DESTDIR)$(prefix)/share/doc/pspp/pspp.html