doc: Move output examples from "examples" to "pspp-figures".
[pspp] / doc / automake.mk
index 0c5493f685e7e1ac11bce75decb7ed15df2a1772..37a62153cb53c02e65b055ecb104d2b0116a0328 100644 (file)
@@ -59,6 +59,7 @@ doc_pspp_dev_TEXINFOS = doc/version-dev.texi \
        doc/dev/pc+-file-format.texi \
        doc/dev/portable-file-format.texi \
        doc/dev/spv-file-format.texi \
+       doc/dev/tlo-file-format.texi \
        doc/dev/encrypted-file-wrappers.texi \
        doc/dev/q2c.texi
 
@@ -70,11 +71,9 @@ EXTRA_DIST += doc/get-commands.pl \
               doc/prepdoc.sh
 
 $(srcdir)/doc/ni.texi: $(top_srcdir)/src/language/command.def doc/get-commands.pl
-       @$(MKDIR_P)  doc
        $(AM_V_GEN)$(PERL) $(top_srcdir)/doc/get-commands.pl $(top_srcdir)/src/language/command.def > $@
 
 $(srcdir)/doc/tut.texi:
-       @$(MKDIR_P) doc
        $(AM_V_GEN)echo "@set example-dir $(examplesdir)" > $@
 
 
@@ -82,7 +81,6 @@ doc/pspp.xml: doc/pspp.texi $(doc_pspp_TEXINFOS) doc/help-pages-list
 if BROKEN_DOCBOOK_XML
        touch $@
 else
-       @$(MKDIR_P)  doc
        $(AM_V_GEN)$(MAKEINFO) $(AM_MAKEINFOFLAGS) --docbook -I $(top_srcdir) \
                $< -o $@
 endif
@@ -109,70 +107,104 @@ EXTRA_DIST += \
        doc/pspp-manual.css
 
 
-AM_MAKEINFOFLAGS=-I $(top_srcdir)/doc/examples -I $(top_builddir)/doc/examples
-am__TEXINFO_TEX_DIR=:$(top_srcdir)/doc/examples:$(top_builddir)/doc/examples
+AM_MAKEINFOFLAGS=-I $(top_srcdir)/doc/pspp-figures -I $(top_builddir)/doc/pspp-figures
+am__TEXINFO_TEX_DIR=:$(top_srcdir)/doc/pspp-figures:$(top_builddir)/doc/pspp-figures
 
 ################# Example programs ##############################
 
-EXAMPLE_SYNTAX = \
- doc/examples/autorecode.sps \
- doc/examples/chisquare.sps \
- doc/examples/compute.sps \
- doc/examples/count.sps \
- doc/examples/descriptives.sps \
- doc/examples/flip.sps \
- doc/examples/frequencies.sps \
- doc/examples/means.sps \
- doc/examples/one-sample-t.sps \
- doc/examples/independent-samples-t.sps \
- doc/examples/reliability.sps \
- doc/examples/split.sps \
- doc/examples/weight.sps
-
-
-EXTRA_DIST += $(EXAMPLE_SYNTAX)
-
-EXAMPLE_OUTPUTS = $(EXAMPLE_SYNTAX:.sps=.out)
-EXAMPLE_HTML = $(EXAMPLE_SYNTAX:.sps=.html)
-
-$(top_builddir)/doc/pspp.info:  $(EXAMPLE_OUTPUTS)
-$(top_builddir)/doc/pspp.ps:    $(EXAMPLE_OUTPUTS)
-$(top_builddir)/doc/pspp.dvi:   $(EXAMPLE_OUTPUTS)
-$(top_builddir)/doc/pspp.html:  $(EXAMPLE_HTML)
-$(top_builddir)/doc/pspp.pdf:   $(EXAMPLE_OUTPUTS)
-$(top_builddir)/doc/pspp.xml:   $(EXAMPLE_OUTPUTS)
-
-# The examples cannot be built until the binary has been built
-$(EXAMPLE_OUTPUTS): $(top_builddir)/src/ui/terminal/pspp
-$(EXAMPLE_HTML): $(top_builddir)/src/ui/terminal/pspp
-
-CLEANFILES += $(EXAMPLE_OUTPUTS)
-
-SUFFIXES: .sps
-
-# use pspp to process a syntax file and reap the output into a text file
-.sps.out:
-       $(MKDIR_P) $(@D)
-       where=$$PWD ; \
-       (cd $(top_srcdir)/examples; ${abs_builddir}/src/ui/terminal/pspp $(abs_srcdir)/doc/examples/$(<F) -o $$where/$@)
-
-# Use pspp to process a syntax file and reap the output into a html file
-# Then, use sed to delete everything up to and including <body> and
-# everything after and including </body>
-.sps.html:
-       $(MKDIR_P) $(@D)
-       where=$$PWD ; \
-       (cd $(top_srcdir)/examples; ${abs_builddir}/src/ui/terminal/pspp $(abs_srcdir)/doc/examples/$(<F) -o $$where/$@,x -O format=html)
-       $(SED) -e '\%</body%,$$d' -e '0,/<body/d' $@,x > $@
-
-# Insert the link tag for the cascading style sheet.
-# But make sure these operations are idempotent.
+FIGURE_SYNTAX = \
+ doc/pspp-figures/autorecode.sps \
+ doc/pspp-figures/chisquare.sps \
+ doc/pspp-figures/compute.sps \
+ doc/pspp-figures/count.sps \
+ doc/pspp-figures/descriptives.sps \
+ doc/pspp-figures/flip.sps \
+ doc/pspp-figures/frequencies.sps \
+ doc/pspp-figures/means.sps \
+ doc/pspp-figures/one-sample-t.sps \
+ doc/pspp-figures/independent-samples-t.sps \
+ doc/pspp-figures/reliability.sps \
+ doc/pspp-figures/split.sps \
+ doc/pspp-figures/tutorial1.sps \
+ doc/pspp-figures/tutorial2.sps \
+ doc/pspp-figures/tutorial3.sps \
+ doc/pspp-figures/tutorial4.sps \
+ doc/pspp-figures/tutorial5.sps \
+ doc/pspp-figures/tutorial6.sps \
+ doc/pspp-figures/tutorial7.sps \
+ doc/pspp-figures/weight.sps
+
+
+EXTRA_DIST += $(FIGURE_SYNTAX)
+
+FIGURE_SPVS = $(FIGURE_SYNTAX:.sps=.spv) \
+       doc/pspp-figures/tutorial2a.spv \
+       doc/pspp-figures/tutorial2b.spv \
+       doc/pspp-figures/tutorial5a.spv \
+       doc/pspp-figures/tutorial5b.spv \
+       doc/pspp-figures/tutorial7a.spv \
+       doc/pspp-figures/tutorial7b.spv
+FIGURE_TXTS = $(FIGURE_SPVS:.spv=.txt)
+FIGURE_TEXIS = $(FIGURE_TXTS:.txt=.texi)
+FIGURE_HTML = $(FIGURE_SPVS:.spv=.html)
+FIGURE_PDF = $(FIGURE_SPVS:.spv=.pdf)
+
+figure-spv: $(FIGURE_SPVS)
+figure-txts: $(FIGURE_TXTS)
+figure-texis: $(FIGURE_TEXIS)
+figure-html: $(FIGURE_HTML)
+figure-pdf: $(FIGURE_PDF)
+PHONY += figure-spv figure-txts figure-texis figure-html figure-pdf
+
+$(top_builddir)/doc/pspp.info:  $(FIGURE_TEXIS)
+$(top_builddir)/doc/pspp.ps:    $(FIGURE_TEXIS)
+$(top_builddir)/doc/pspp.dvi:   $(FIGURE_TEXIS)
+$(top_builddir)/doc/pspp.html:  $(FIGURE_HTML)
+$(top_builddir)/doc/pspp.pdf:   $(FIGURE_TEXIS)
+$(top_builddir)/doc/pspp.xml:   $(FIGURE_TEXIS)
+
+CLEANFILES += $(FIGURE_TXTS) $(FIGURE_SPVS) $(FIGURE_TEXIS) $(FIGURE_HTML)
+SUFFIXES += .sps .spv .txt .html .texi .pdf
+
+# Use pspp to process a syntax file into an output file.
+pspp = src/ui/terminal/pspp
+$(FIGURE_SPVS): $(pspp)$(EXEEXT)
+.sps.spv:
+       $(AM_V_GEN)(cd $(top_srcdir)/examples \
+         && $(abs_top_builddir)/$(pspp) ../doc/pspp-figures/$(<F) -o - -O format=spv) > $@.tmp
+       $(AM_V_at)mv $@.tmp $@
+
+# In some cases, the tutorial only wants some parts of the output.
+pspp_output = utilities/pspp-output
+convert = $(AM_V_GEN)$(pspp_output) convert $< $@
+doc/pspp-figures/tutorial2a.spv: doc/pspp-figures/tutorial2.spv $(pspp_output)
+       $(convert) --command='Descriptives'
+doc/pspp-figures/tutorial2b.spv: doc/pspp-figures/tutorial2.spv $(pspp_output)
+       $(convert) --label='Extreme Values'
+doc/pspp-figures/tutorial5a.spv: doc/pspp-figures/tutorial5.spv $(pspp_output)
+       $(convert) --commands=examine --nth-command=1 --labels=descriptives
+doc/pspp-figures/tutorial5b.spv: doc/pspp-figures/tutorial5.spv $(pspp_output)
+       $(convert) --commands=examine --nth-command=2 --labels=descriptives
+doc/pspp-figures/tutorial7a.spv: doc/pspp-figures/tutorial7.spv $(pspp_output)
+       $(convert) --commands=regression --nth-command=1 --subtypes=coefficients
+doc/pspp-figures/tutorial7b.spv: doc/pspp-figures/tutorial7.spv $(pspp_output)
+       $(convert) --commands=regression --nth-command=2 --subtypes=coefficients
+
+# Convert an output file into a text file or HTML file.
+$(FIGURE_TXTS) $(FIGURE_HTML): $(pspp_output)
+.spv.txt:
+       $(AM_V_GEN)utilities/pspp-output convert $< $@
+.spv.pdf:
+       $(AM_V_GEN)utilities/pspp-output convert $< $@ -O left-margin=0pt -O right-margin=0pt -O top-margin=0pt -O bottom-margin=0pt -O paper-size=6x20in -O font-size=12000 --table-look=$(HOME)/pspp/spss15/Looks/report.tlo
+.spv.html:
+       $(AM_V_GEN)utilities/pspp-output convert $< $@ -O format=html -O bare=true
+
+# Convert a text file into a Texinfo file.
+.txt.texi:
+       $(AM_V_GEN)$(SED) -e 's/@/@@/g' $< > $@
+
+AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) --css-ref=pspp-manual.css
 html-local:
-       for h in doc/pspp.html/*.html; do \
-               if grep -Fq '<link rel="stylesheet"' $$h; then continue; fi ; \
-               $(SED) -i -e '/^<\/head>/i \\\
-<link rel="stylesheet" href="pspp-manual.css">' $$h; \
-       done
 
 install-html-local: html-local
        $(MKDIR_P) $(DESTDIR)$(prefix)/share/doc/pspp/pspp.html