From cee6a1a6de00f1fa079c26c9a03fbc86b62cf9ca Mon Sep 17 00:00:00 2001 From: wolf Date: Wed, 15 Mar 2006 03:05:03 +0000 Subject: [PATCH] Generate intermediate files instead of data on the fly, so that it becomes easier to concatenate everything. Simplify a lot of the rules that are used here. git-svn-id: https://svn.dealii.org/trunk@12588 0785d39b-7218-0410-832d-ea1e28bc413d --- .../tutorial/chapter-2.step-by-step/Makefile | 143 ++++++++++-------- .../generated/.cvsignore | 1 + .../tutorial/chapter-2.step-by-step/head.html | 15 -- 3 files changed, 82 insertions(+), 77 deletions(-) create mode 100644 deal.II/doc/tutorial/chapter-2.step-by-step/generated/.cvsignore diff --git a/deal.II/doc/tutorial/chapter-2.step-by-step/Makefile b/deal.II/doc/tutorial/chapter-2.step-by-step/Makefile index 774e276156..0e62b32e52 100644 --- a/deal.II/doc/tutorial/chapter-2.step-by-step/Makefile +++ b/deal.II/doc/tutorial/chapter-2.step-by-step/Makefile @@ -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 "
" > $@ + @echo "
    " >> $@ + @echo "
  1. Introduction" >> $@ + @echo "
  2. The commented program" >> $@ + @cat generated/$(call get_basename, $@)_toc.prog >> $@ + @echo "
  3. Results" >> $@ + @echo "
  4. The plain program" >> $@ + @cat generated/$(call get_basename, $@)_toc.plain >> $@ + @echo "
" >> $@ -# 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 "" >> $@ - @cat $D/examples/$(@:.sgml=)/$(@:.sgml=.cc) \ - | $(PERL) program2html \ - >> $@ - @echo "" >> $@ - @cat $(@:.sgml=.data/results.html) >> $@ - @echo "" >> $@ - @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 "" >> $@ - @$(PERL) -pi -e 's!!!gi; \ - s!

(.*)

!$$1!gi; \ - s!

!\n!gi; \ - s!

!!gi; \ - s!
!!gi;            \
-                         s!
!!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 "$$step" >> $@ ; \ - cat $$step.sgml >> $@ ; \ - echo "" >> $@ ; \ - done - @echo "" >> $@ - @echo "" >> $@ - @rm $(example-sgmls) + @cat head.html > $@ + @echo "

Overview of $(call get_basename,$@)

" >> $@ + @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 index 0000000000..72e8ffc0db --- /dev/null +++ b/deal.II/doc/tutorial/chapter-2.step-by-step/generated/.cvsignore @@ -0,0 +1 @@ +* diff --git a/deal.II/doc/tutorial/chapter-2.step-by-step/head.html b/deal.II/doc/tutorial/chapter-2.step-by-step/head.html index 90d79bfcea..2aa6827ca6 100644 --- a/deal.II/doc/tutorial/chapter-2.step-by-step/head.html +++ b/deal.II/doc/tutorial/chapter-2.step-by-step/head.html @@ -16,18 +16,3 @@ -

Overview of step xxx

- - -
-
    -
  1. Introduction -
  2. The commented program -commentedTOC -
  3. Results -
  4. The plain program -plainTOC -
- -
- -- 2.39.5