docuemntation and refacotring
[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/matrices.texi \
50         doc/fdl.texi
51
52 doc_pspp_dev_TEXINFOS = doc/version-dev.texi \
53         doc/dev/intro.texi \
54         doc/dev/concepts.texi \
55         doc/dev/gui.texi \
56         doc/dev/syntax.texi \
57         doc/dev/data.texi \
58         doc/dev/i18n.texi \
59         doc/dev/output.texi \
60         doc/dev/system-file-format.texi \
61         doc/dev/pc+-file-format.texi \
62         doc/dev/portable-file-format.texi \
63         doc/dev/spv-file-format.texi \
64         doc/dev/tlo-file-format.texi \
65         doc/dev/encrypted-file-wrappers.texi
66
67 dist_man_MANS += doc/pspp.1 \
68                  doc/psppire.1
69
70 EXTRA_DIST += doc/get-commands.py \
71               doc/help-pages-list \
72               doc/prepdoc.sh
73
74 $(srcdir)/doc/ni.texi: $(top_srcdir)/src/language/command.def doc/get-commands.py
75         $(AM_V_GEN)$(PYTHON3) $(top_srcdir)/doc/get-commands.py $(top_srcdir)/src/language/command.def > $@
76
77 $(srcdir)/doc/tut.texi:
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         $(AM_V_GEN)$(MAKEINFO) --docbook $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \
86                 -I doc -I $(srcdir)/doc $< -o $@
87 endif
88
89 docbookdir = $(docdir)
90 dist_docbook_DATA = doc/pspp.xml
91
92
93 CLEANFILES += pspp-dev.dvi $(docbook_DATA) doc/pspp.info* doc/pspp.xml
94
95
96 doc: $(INFO_DEPS) $(DVIS) $(PDFS) $(PNGS) $(HTMLS) $(dist_docbook_DATA)
97 PHONY += doc
98
99 doc/help-pages-list: $(UI_FILES)
100          $(AM_V_GEN)cat $^ | grep '"help[-_]page"' | \
101    $(SED) -e 's% *<property name="help[-_]page">\([^<]*\)</property>%//*[@id='"'"'\1'"'"']%' \
102         -e 's%#%'"'"']/*[@id='"'"'%g' > $@,tmp
103         test -s $@,tmp
104         mv $@,tmp $@
105
106 EXTRA_DIST += \
107         doc/help-pages-list \
108         doc/pspp-manual.css
109
110 am__TEXINFO_TEX_DIR=:$(top_srcdir)/doc:$(top_builddir)/doc
111
112 ################# Example programs ##############################
113
114 FIGURE_SYNTAX = \
115  doc/pspp-figures/aggregate.sps \
116  doc/pspp-figures/autorecode.sps \
117  doc/pspp-figures/chisquare.sps \
118  doc/pspp-figures/compute.sps \
119  doc/pspp-figures/count.sps \
120  doc/pspp-figures/ctables1.sps \
121  doc/pspp-figures/ctables2.sps \
122  doc/pspp-figures/ctables3.sps \
123  doc/pspp-figures/ctables4.sps \
124  doc/pspp-figures/ctables5.sps \
125  doc/pspp-figures/ctables6.sps \
126  doc/pspp-figures/ctables7.sps \
127  doc/pspp-figures/ctables8.sps \
128  doc/pspp-figures/ctables9.sps \
129  doc/pspp-figures/ctables10.sps \
130  doc/pspp-figures/ctables11.sps \
131  doc/pspp-figures/ctables12.sps \
132  doc/pspp-figures/ctables13.sps \
133  doc/pspp-figures/ctables14.sps \
134  doc/pspp-figures/ctables15.sps \
135  doc/pspp-figures/ctables16.sps \
136  doc/pspp-figures/ctables17.sps \
137  doc/pspp-figures/ctables18.sps \
138  doc/pspp-figures/ctables19.sps \
139  doc/pspp-figures/ctables20.sps \
140  doc/pspp-figures/ctables21.sps \
141  doc/pspp-figures/ctables22.sps \
142  doc/pspp-figures/ctables23.sps \
143  doc/pspp-figures/ctables24.sps \
144  doc/pspp-figures/ctables25.sps \
145  doc/pspp-figures/ctables26.sps \
146  doc/pspp-figures/crosstabs.sps \
147  doc/pspp-figures/descriptives.sps \
148  doc/pspp-figures/flip.sps \
149  doc/pspp-figures/frequencies.sps \
150  doc/pspp-figures/matrix-print.sps \
151  doc/pspp-figures/means.sps \
152  doc/pspp-figures/one-sample-t.sps \
153  doc/pspp-figures/independent-samples-t.sps \
154  doc/pspp-figures/reliability.sps \
155  doc/pspp-figures/select-if.sps \
156  doc/pspp-figures/show-system.sps \
157  doc/pspp-figures/sort-cases.sps \
158  doc/pspp-figures/split.sps \
159  doc/pspp-figures/temporary.sps \
160  doc/pspp-figures/tutorial1.sps \
161  doc/pspp-figures/tutorial2.sps \
162  doc/pspp-figures/tutorial3.sps \
163  doc/pspp-figures/tutorial4.sps \
164  doc/pspp-figures/tutorial5.sps \
165  doc/pspp-figures/tutorial6.sps \
166  doc/pspp-figures/tutorial7.sps \
167  doc/pspp-figures/weight.sps
168
169
170 EXTRA_DIST += $(FIGURE_SYNTAX)
171
172 FIGURE_SPVS = $(FIGURE_SYNTAX:.sps=.spv) \
173         doc/pspp-figures/tutorial2a.spv \
174         doc/pspp-figures/tutorial2b.spv \
175         doc/pspp-figures/tutorial5a.spv \
176         doc/pspp-figures/tutorial5b.spv \
177         doc/pspp-figures/tutorial7a.spv \
178         doc/pspp-figures/tutorial7b.spv
179 FIGURE_TXTS = $(FIGURE_SPVS:.spv=.txt)
180 FIGURE_TEXIS = $(FIGURE_TXTS:.txt=.texi)
181 FIGURE_HTMLS = $(FIGURE_SPVS:.spv=.html)
182 FIGURE_PDFS = $(FIGURE_SPVS:.spv=.pdf)
183 FIGURE_PNGS = $(FIGURE_SPVS:.spv=.png)
184
185 figure-spvs: $(FIGURE_SPVS)
186 figure-txts: $(FIGURE_TXTS)
187 figure-texis: $(FIGURE_TEXIS)
188 figure-htmls: $(FIGURE_HTMLS)
189 figure-pdfs: $(FIGURE_PDFS)
190 figure-pngs: $(FIGURE_PNGS)
191 PHONY += \
192         figure-spv \
193         figure-txts \
194         figure-texis \
195         figure-htmls \
196         figure-pdfs \
197         figure-pngs
198
199 $(top_builddir)/doc/pspp.info:  $(FIGURE_PNGS)
200 $(top_builddir)/doc/pspp.ps:    $(FIGURE_TEXIS)
201 $(top_builddir)/doc/pspp.dvi:   $(FIGURE_TEXIS)
202 $(top_builddir)/doc/pspp.html:  $(FIGURE_HTMLS)
203 $(top_builddir)/doc/pspp.pdf:   $(FIGURE_TEXIS)
204 $(top_builddir)/doc/pspp.xml:   $(FIGURE_TEXIS)
205
206 CLEANFILES += \
207         $(FIGURE_TXTS) \
208         $(FIGURE_SPVS) \
209         $(FIGURE_TEXIS) \
210         $(FIGURE_HTMLS) \
211         $(FIGURE_PNGS)
212 SUFFIXES += .sps .spv .txt .html .texi .pdf .png
213
214 # Use pspp to process a syntax file into an output file.
215 if cross_compiling
216 pspp = native/src/ui/terminal/pspp
217 pspp_output = native/utilities/pspp-output
218
219 native/Makefile:
220         $(MKDIR_P) native
221         (cd native && $(abs_top_srcdir)/configure --host=$(build) --without-gui)
222
223 # The gnulib header files are required for the object files of the native pspp
224 # They are defined in BUILT_SOURCES but that is only defined as a first dependency
225 # for the make all target. src/ui/terminal/pspp as a target will try to compile the
226 # objects first but that fails without the header files. Therefore I build the native
227 # executables via the default make target
228 $(pspp) $(pspp_output) &: native/Makefile
229         (cd native && flock --verbose $(top_builddir)/native-lock $(MAKE) )
230
231 else
232 pspp = src/ui/terminal/pspp$(EXEEXT)
233 pspp_output = utilities/pspp-output$(EXEEXT)
234 endif
235
236 $(FIGURE_SPVS): $(pspp)
237 .sps.spv:
238         $(AM_V_GEN)(cd "$(top_srcdir)/examples" \
239          && "$(abs_top_builddir)/$(pspp)" ../doc/pspp-figures/$(<F) -o - -O format=spv) > $@.tmp
240         $(AM_V_at)mv $@.tmp $@
241
242 # In some cases, the tutorial only wants some parts of the output.
243 convert = $(AM_V_GEN)LSAN_OPTIONS="suppressions=$(abs_top_srcdir)/tests/lsan.supp:print_suppressions=0:$$LSAN_OPTIONS" $(pspp_output) convert $< $@
244 doc/pspp-figures/tutorial2a.spv: doc/pspp-figures/tutorial2.spv $(pspp_output)
245         $(convert) --command='Descriptives'
246 doc/pspp-figures/tutorial2b.spv: doc/pspp-figures/tutorial2.spv $(pspp_output)
247         $(convert) --label='Extreme Values'
248 doc/pspp-figures/tutorial5a.spv: doc/pspp-figures/tutorial5.spv $(pspp_output)
249         $(convert) --commands=examine --nth-command=1 --labels=descriptives
250 doc/pspp-figures/tutorial5b.spv: doc/pspp-figures/tutorial5.spv $(pspp_output)
251         $(convert) --commands=examine --nth-command=2 --labels=descriptives
252 doc/pspp-figures/tutorial7a.spv: doc/pspp-figures/tutorial7.spv $(pspp_output)
253         $(convert) --commands=regression --nth-command=1 --subtypes=coefficients
254 doc/pspp-figures/tutorial7b.spv: doc/pspp-figures/tutorial7.spv $(pspp_output)
255         $(convert) --commands=regression --nth-command=2 --subtypes=coefficients
256
257
258 $(FIGURE_PNGS): $(pspp_output)
259 $(FIGURE_TXTS): $(pspp_output)
260 $(FIGURE_HTMLS): $(pspp_output)
261 $(FIGURE_PDFS): $(pspp_output)
262
263 # Convert an output file into a text file or HTML file.
264 $(FIGURE_TXTS) $(FIGURE_HTMLS): $(pspp_output)
265 .spv.txt:
266         $(convert)
267 .spv.pdf:
268         $(convert) -O trim=true -O left-margin=0in -O right-margin=0in -O top-margin=0in -O bottom-margin=0in -O paper-size=7.5x99in --table-look=$(srcdir)/doc/tutorial.stt
269 .spv.png:
270         $(convert) -O trim=true -O left-margin=0in -O right-margin=0in -O top-margin=0in -O bottom-margin=0in -O paper-size=7.5x99in --table-look=$(srcdir)/doc/tutorial.stt
271 EXTRA_DIST += doc/tutorial.stt
272 .spv.html:
273         $(convert) -O format=html -O bare=true
274
275 # Make sure that tutorial.stt outputs all layers, because a few of the
276 # examples in the manual rely on that and it would be easy to replace
277 # it with a style that didn't.
278 ALL_LOCAL += tutorial-stt-must-print-all-layers
279 tutorial-stt-must-print-all-layers:
280         $(AM_V_GEN)grep 'printAllLayers="true"' $(srcdir)/doc/tutorial.stt >/dev/null 2>&1 && touch $@
281
282 # Convert a text file into a Texinfo file.
283 .txt.texi:
284         $(AM_V_GEN)$(SED) -e 's/@/@@/g' $< > $@
285
286 AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) --css-ref=pspp-manual.css
287 # Adjust the path for screenshot images.
288 # But make sure these operations are idempotent.
289 html-local: doc/pspp.html
290         test -d doc/pspp.html
291         for h in doc/pspp.html/*.html; do \
292                 if grep -Fq '<img src="screenshots/' $$h; then continue; fi ; \
293                 $(SED) -i -e 's|<img src="\([^"]*\)"|<img src="screenshots/\1"|' $$h; \
294         done
295
296 install-html-local: html-local $(HTML_SCREENSHOTS)
297         $(MKDIR_P) $(DESTDIR)$(prefix)/share/doc/pspp/pspp.html
298         $(INSTALL) -d $(DESTDIR)$(prefix)/share/doc/pspp/pspp.html/screenshots
299         for p in $(HTML_SCREENSHOTS); do \
300                 $(INSTALL_DATA) $$p $(DESTDIR)$(prefix)/share/doc/pspp/pspp.html/screenshots ;\
301         done
302         $(INSTALL_DATA) ${top_srcdir}/doc/pspp-manual.css $(DESTDIR)$(prefix)/share/doc/pspp/pspp.html
303
304 \f
305
306 desktopdir = $(datadir)/applications
307
308 doc/org.gnu.pspp.metainfo.xml: doc/org.gnu.pspp.metainfo.xml.in $(POFILES)
309         $(AM_V_GEN)$(MSGFMT) --xml --template $< -o $@ -d $(top_srcdir)/po || \
310           $(MSGFMT) -L appdata --xml --template $< -o $@ -d $(top_srcdir)/po
311
312 doc/org.gnu.pspp.desktop: doc/org.gnu.pspp.desktop.in $(POFILES)
313         $(AM_V_GEN)$(MSGFMT) --desktop --template $< -o $@ -d $(top_srcdir)/po
314
315 CLEANFILES+=doc/org.gnu.pspp.desktop \
316             doc/org.gnu.pspp.metainfo.xml
317
318 desktop_DATA = doc/org.gnu.pspp.desktop
319
320 appdatadir = $(datadir)/metainfo
321 dist_appdata_DATA = doc/org.gnu.pspp.metainfo.xml
322
323 EXTRA_DIST += doc/org.gnu.pspp.metainfo.xml.in \
324         doc/org.gnu.pspp.desktop.in
325
326 \f
327
328 SCREENSHOTS = \
329 $(top_srcdir)/doc/screenshots/autorecode.grab \
330 $(top_srcdir)/doc/screenshots/chisquare.grab \
331 $(top_srcdir)/doc/screenshots/count.grab \
332 $(top_srcdir)/doc/screenshots/count-define.grab \
333 $(top_srcdir)/doc/screenshots/compute.grab \
334 $(top_srcdir)/doc/screenshots/crosstabs.grab \
335 $(top_srcdir)/doc/screenshots/descriptives.grab \
336 $(top_srcdir)/doc/screenshots/one-sample-t.grab \
337 $(top_srcdir)/doc/screenshots/independent-samples-t.grab \
338 $(top_srcdir)/doc/screenshots/define-groups-t.grab \
339 $(top_srcdir)/doc/screenshots/frequencies.grab \
340 $(top_srcdir)/doc/screenshots/reliability.grab \
341 $(top_srcdir)/doc/screenshots/split-status-bar.grab \
342 $(top_srcdir)/doc/screenshots/sort-simple.grab \
343 $(top_srcdir)/doc/screenshots/sort.grab
344
345
346 PDF_SCREENSHOTS =  $(SCREENSHOTS:.grab=-hc.png)
347 EPS_SCREENSHOTS =  $(SCREENSHOTS:.grab=-hc.eps)
348 HTML_SCREENSHOTS = $(SCREENSHOTS:.grab=-ad.png)
349 INFO_SCREENSHOTS = $(SCREENSHOTS:.grab=-ad.png)
350
351 doc-make: doc/doc-make.in Makefile
352         $(SED) -e 's|%top_srcdir%|@top_srcdir@|g' \
353         -e 's|%abs_builddir%|@abs_builddir@|g' \
354         -e 's|%MKDIR_P%|@MKDIR_P@|g' \
355         -e 's|%src_ui_gui_psppiredir%|$(src_ui_gui_psppiredir)|g' \
356         -e 's|%UI_FILES%|$(UI_FILES)|g' \
357         -e 's|%IMAGES%|$(INFO_SCREENSHOTS) $(HTML_SCREENSHOTS) $(EPS_SCREENSHOTS) $(PDF_SCREENSHOTS)|g' \
358         $< > $@
359
360
361 # Install all the PNG files so that info readers can recognise them
362 install-info-local: $(FIGURE_PNGS)
363         $(MKDIR_P) $(DESTDIR)$(infodir)/screenshots
364         for p in $(INFO_SCREENSHOTS); do \
365                 $(INSTALL_DATA) $$p $(DESTDIR)$(infodir)/screenshots ;\
366         done
367         $(INSTALL) -d $(DESTDIR)$(infodir)/pspp-figures
368         for p in $(FIGURE_PNGS); do \
369                 $(INSTALL_DATA) $$p $(DESTDIR)$(infodir)/pspp-figures ;\
370         done
371
372 uninstall-local:
373         for p in $(INFO_SCREENSHOTS); do \
374                 f=`basename $$p ` ; \
375                 rm -f $(DESTDIR)$(infodir)/screenshots/$$f ; \
376         done
377         for p in $(FIGURE_PNGS); do \
378                 f=`basename $$p ` ; \
379                 rm -f $(DESTDIR)$(infodir)/pspp-figures/$$f ; \
380         done
381
382 EXTRA_DIST+= $(SCREENSHOTS) doc/doc-make.in doc/screengrab
383
384 EXTRA_DIST+= $(EPS_SCREENSHOTS) $(PDF_SCREENSHOTS) $(INFO_SCREENSHOTS)