]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Generate intermediate files instead of data on the fly, so that it becomes easier...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 15 Mar 2006 03:05:03 +0000 (03:05 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 15 Mar 2006 03:05:03 +0000 (03:05 +0000)
git-svn-id: https://svn.dealii.org/trunk@12588 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/tutorial/chapter-2.step-by-step/Makefile
deal.II/doc/tutorial/chapter-2.step-by-step/generated/.cvsignore [new file with mode: 0644]
deal.II/doc/tutorial/chapter-2.step-by-step/head.html

index 774e27615696c22ed7547209479d95c05ba9bdd2..0e62b32e52a89f36cf024cc024c24abd95fec29c 100644 (file)
@@ -4,79 +4,94 @@
 # include paths and global variables
 include ../../../common/Make.global_options
 
-example-directories = $(shell echo $D/examples/step-? $D/examples/step-??)
-example-names       = $(notdir $(example-directories))
+
+# plain names of those files that we shall treat
+example-names = $(notdir $(shell echo $D/examples/step-? \
+                                      $D/examples/step-??))
+
+# prefix names for generated intermediate files
+gen-example-names = $(addprefix generated/, $(example-names))
+
+# names of commented program files, plain files, and tocs for the commented
+# and commented and plain versions of the program as well as a combined one
+example-commprogs  = $(addsuffix _prog.html,$(gen-example-names))
+example-plainprogs = $(addsuffix _plain.html,$(gen-example-names))
+example-toc-prog   = $(addsuffix _toc.prog,$(gen-example-names))
+example-toc-plain  = $(addsuffix _toc.plain,$(gen-example-names))
+example-toc        = $(addsuffix _toc.combined,$(gen-example-names))
+
 example-htmls       = $(addsuffix .html,$(example-names))
-example-sgmls       = $(addsuffix .sgml,$(example-names))
+
+
+# a makefile command that extracts the base name of a program
+get_basename = $(shell echo $(1) | $(PERL) -pi -e 's/generated.//g; s/\..*//g; s/_(prog|plain|toc.*)//g;')
+
+
 
 all: $(example-htmls)
 
+test:
+       echo $(example-commprogs)
 
-$(example-htmls):
-       @echo ================== Assembling $@
-       @TOC=`cat $D/examples/$(@:.html=)/$(@:.html=.cc) \
-         | $(PERL) program2toc \
-         | $(PERL) -pi -e 's/\"/\\\"/g;'` ; \
-        plainTOC=`echo $$TOC | $(PERL) -pi -e 's/href=.../href=\\\"\#plain-/g;'` ; \
-        cat head.html \
-         | $(PERL) -pi -e '$$step="$@";                     \
-                         $$step=~s/step-(\d+).html/$$1/g; \
-                         s/step xxx/step $$step/g;'       \
-         | $(PERL) -pi -e "s!commentedTOC!$$TOC!g;" \
-         | $(PERL) -pi -e "s!plainTOC!$$plainTOC!g;" \
-         > $@
-       @cat $(@:.html=.data/intro.html) >> $@
-       @cat $D/examples/$(@:.html=)/$(@:.html=.cc) \
+$(example-commprogs):
+       @echo ================== Making $@
+       @cat $D/examples/$(call get_basename, $@)/*.cc \
          | $(PERL) program2html \
-         >> $@
-       @cat $(@:.html=.data/results.html) >> $@
-       @cat $D/examples/$(@:.html=)/$(@:.html=.cc) \
+         > $@
+
+
+$(example-plainprogs):
+       @echo ================== Making $@
+       @cat $D/examples/$(call get_basename, $@)/*.cc \
          | $(PERL) program2plain \
-         | $(PERL) -e '$$path="$D/examples/$(@:.html=)/$(@:.html=.cc)"; \
+         | $(PERL) -e '$$path="$D/examples/$(call get_basename,$@)/*.cc)"; \
                         $$path =~ s!/! /!g; \
                        while (<>) { s!PROGRAMPATH!$$path!g; print; };' \
-         >> $@
-       @cat foot.html >> $@
+         > $@
+
+
+$(example-toc-prog):
+       @echo ================== Making $@
+       @cat $D/examples/$(call get_basename, $@)/*.cc \
+         | $(PERL) program2toc \
+         > $@
+
+
+$(example-toc-plain): $(example-toc-prog)
+       @echo ================== Making $@
+       @cat generated/$(call get_basename, $@)_toc.prog \
+         | $(PERL) -pi -e 's/href=\"\#/href=\"\#plain-/g;' \
+         > $@
+
+
+$(example-toc): $(example-toc-prog) $(example-toc-plain)
+       @echo ================== Making $@
+       @echo "<table class=\"tutorial\">  <tr>    <td>" > $@
+       @echo "<ol>" >> $@
+       @echo "  <li> <a href=\"#Intro\" class=bold>Introduction</a>" >> $@
+       @echo "  <li> <a href=\"#CommProg\" class=bold>The commented program</a>" >> $@
+       @cat generated/$(call get_basename, $@)_toc.prog >> $@
+       @echo "  <li> <a href=\"#Results\" class=bold>Results</a>" >> $@
+       @echo "  <li> <a href=\"#PlainProg\" class=bold>The plain program</a>" >> $@
+       @cat generated/$(call get_basename, $@)_toc.plain >> $@
+       @echo "</ol> </td> </tr> </table>" >> $@
 
 
-# Note: SGML support is very preliminary and not very functional at present!
-$(example-sgmls):
+
+
+$(example-htmls): $(example-commprogs) $(example-plainprogs) \
+                 $(example-toc)
        @echo ================== Assembling $@
-       @cat $(@:.sgml=.data/intro.html) >> $@
-       @echo "</sect2>" >> $@
-       @cat $D/examples/$(@:.sgml=)/$(@:.sgml=.cc) \
-         | $(PERL) program2html \
-         >> $@
-       @echo "</sect2>" >> $@
-       @cat $(@:.sgml=.data/results.html) >> $@
-       @echo "</sect2>" >> $@
-       @cat $D/examples/$(@:.sgml=)/$(@:.sgml=.cc) \
-         | $(PERL) program2plain \
-         | $(PERL) -e '$$path="$D/examples/$(@:.sgml=)/$(@:.sgml=.cc)"; \
-                        $$path =~ s!/! /!g; \
-                       while (<>) { s!PROGRAMPATH!$$path!g; print; };' \
-         >> $@
-       @echo "</sect2>" >> $@
-       @$(PERL) -pi -e 's!<a .*</a>!!gi;       \
-                         s!<h1>(.*)</h1>!<sect2><title>$$1</title>!gi; \
-                         s!<p>!\n<para>!gi;                            \
-                         s!</p>!</para>!gi;                            \
-                         s!<pre><code>!<programlisting>!gi;            \
-                         s!</code></pre>!</programlisting>!gi; ' $@
-
-step-by-step.sgml: $(example-sgmls)
-       @echo ================== Concating $@
-       @cat step-by-step.header.sgml          \
-             | $(PERL) -pi -e 's/TODAY/$(shell date)/;'   \
-             > $@
-       @for step in $(example-names) ; do      \
-            echo "<sect1><title>$$step</title>" >> $@ ; \
-            cat $$step.sgml     >> $@ ; \
-            echo "</sect1>"   >> $@ ; \
-        done
-       @echo "</chapter>" >> $@
-       @echo "</book>" >> $@
-       @rm $(example-sgmls)
+       @cat head.html > $@
+       @echo "<h2>Overview of $(call get_basename,$@)</h2>" >> $@
+       @cat generated/$(call get_basename, $@)_toc.combined  \
+            $(call get_basename, $@).data/intro.html  \
+            generated/$(call get_basename, $@)_prog.html   \
+            $(call get_basename, $@).data/results.html\
+            generated/$(call get_basename, $@)_plain.html  \
+            foot.html                                 >> $@
+
+
 
 
 validate-xrefs:
@@ -87,8 +102,12 @@ validate-xrefs:
 
 clean:
        -rm -f $(example-htmls)
+       -rm -f $(example-commprogs) $(example-plainprogs) $(example-toc)
 
 
 # mark the output files as phony, i.e. generate them every time
-.PHONY: $(example-htmls) validate-xrefs clean
+.PHONY: $(example-htmls) $(example-commprogs) \
+        $(example-plainprogs) $(example-toc) \
+       $(example-toc-prog)  $(example-toc-plain) \
+       validate-xrefs clean
 
diff --git a/deal.II/doc/tutorial/chapter-2.step-by-step/generated/.cvsignore b/deal.II/doc/tutorial/chapter-2.step-by-step/generated/.cvsignore
new file mode 100644 (file)
index 0000000..72e8ffc
--- /dev/null
@@ -0,0 +1 @@
+*
index 90d79bfcea3465bddd803e17f79c56f1bf3fed33..2aa6827ca6af8f59c3f957e2b273d74bd29f1d92 100644 (file)
 <!-- Page Body -->
 <body lang="en">
 
-<h2>Overview of step xxx</h2>
-
-
-<table class='tutorial'>  <tr>    <td>
-<ol>
-  <li> <a href="#Intro" class=bold>Introduction</a>
-  <li> <a href="#CommProg" class=bold>The commented program</a>
-commentedTOC
-  <li> <a href="#Results" class=bold>Results</a>
-  <li> <a href="#PlainProg" class=bold>The plain program</a>
-plainTOC
-</ol>
-
-</td> </tr> </table>
-

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.