* doc/Makefile.am ($(srcdir)/split-outputs.mk): New rule.
(regen-split-outputs-mk): New (phony) target.
($(srcdir)/split-outputs.stamp): Remove rule.
(refman_dependencies)
(tutorial_dependencies)
(ref_guide_dependencies)
(EXTRA_DIST, MAINTAINERCLEANFILES):
Remove $(srcdir)/split-outputs.stamp
Add $(SPLIT_OUTPUTS).
(regen-am): Remake regen-split-outputs-mk.
* doc/gen-split-outputs-mk: New script.
Use it to generate...
* doc/split-outputs.mk: ...this (new) Make helper.
---
milena/ChangeLog | 18 ++++++
milena/doc/Makefile.am | 38 ++++++------
milena/doc/gen-split-examples-mk | 2 +
...{gen-split-examples-mk => gen-split-outputs-mk} | 24 +++++---
milena/doc/split-outputs.mk | 60 ++++++++++++++++++++
5 files changed, 114 insertions(+), 28 deletions(-)
copy milena/doc/{gen-split-examples-mk => gen-split-outputs-mk} (82%)
create mode 100644 milena/doc/split-outputs.mk
diff --git a/milena/ChangeLog b/milena/ChangeLog
index f52482d..7b7982d 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,23 @@
2010-03-18 Roland Levillain <roland(a)lrde.epita.fr>
+ Generate the list of split outputs in the documentation.
+
+ * doc/Makefile.am ($(srcdir)/split-outputs.mk): New rule.
+ (regen-split-outputs-mk): New (phony) target.
+ ($(srcdir)/split-outputs.stamp): Remove rule.
+ (refman_dependencies)
+ (tutorial_dependencies)
+ (ref_guide_dependencies)
+ (EXTRA_DIST, MAINTAINERCLEANFILES):
+ Remove $(srcdir)/split-outputs.stamp
+ Add $(SPLIT_OUTPUTS).
+ (regen-am): Remake regen-split-outputs-mk.
+ * doc/gen-split-outputs-mk: New script.
+ Use it to generate...
+ * doc/split-outputs.mk: ...this (new) Make helper.
+
+2010-03-18 Roland Levillain <roland(a)lrde.epita.fr>
+
Prepare doc source files for the automation of output splitting.
* doc/examples/tuto3/println.cc,
diff --git a/milena/doc/Makefile.am b/milena/doc/Makefile.am
index f40cd4b..d2b6300 100644
--- a/milena/doc/Makefile.am
+++ b/milena/doc/Makefile.am
@@ -244,7 +244,7 @@ regen-split-examples-mk:
# corresponding to a bunch of files.
refman_dependencies = \
$(SPLIT_EXAMPLES) \
- $(srcdir)/split-outputs.stamp \
+ $(SPLIT_OUTPUTS) \
$(PNG_FIGURES) \
$(srcdir)/tutorial/tutorial.hh \
$(srcdir)/ref_guide/ref_guide.hh
@@ -534,7 +534,7 @@ tutorial_dir = $(doc_dir)/tutorial
# corresponding to a bunch of files.
tutorial_dependencies = \
$(SPLIT_EXAMPLES) \
- $(doc_dir)/split-outputs.stamp \
+ $(SPLIT_OUTPUTS) \
$(PNG_FIGURES) \
$(DOC_PACKAGES)
@@ -732,7 +732,7 @@ ref_guide_dir = $(doc_dir)/ref_guide
# corresponding to a bunch of files.
ref_guide_dependencies = \
$(SPLIT_EXAMPLES) \
- $(doc_dir)/split-outputs.stamp \
+ $(SPLIT_OUTPUTS) \
$(PNG_FIGURES) \
$(DOC_PACKAGES)
@@ -909,22 +909,21 @@ include $(srcdir)/figures.mk
## Split outputs. ##
## --------------- ##
-EXTRA_DIST += $(srcdir)/split-outputs.stamp
-MAINTAINERCLEANFILES += $(srcdir)/split-outputs.stamp
-# FIXME: Loops are bad, as they prevent parallelism. And we prefer
-# data-driven actions anyway. This would imply that we know in
-# advance the list out outputs (here, split outputs). Maybe we can
-# infer it from the LaTeX document.
-$(srcdir)/split-outputs.stamp: $(OUTPUTS)
- @rm -f $@.tmp
- @touch $@.tmp
- failcom='exit 1'; \
- for file in $(OUTPUTS); do \
- $(DOC_SRCDIR)/tools/split_sample.sh \
- $$file txt "" $(SPLIT_OUTPUTS_SRCDIR) \
- || eval $$failcom; \
- done
- @mv -f $@.tmp $@
+$(srcdir)/split-outputs.mk: $(srcdir)/gen-split-outputs-mk
+ rm -f $@.tmp
+ cd $(srcdir) && ./gen-split-outputs-mk >split-outputs.mk.tmp
+ mv -f $@.tmp $@
+ chmod -w $@
+include $(srcdir)/split-outputs.mk
+EXTRA_DIST += $(SPLIT_OUTPUTS)
+MAINTAINERCLEANFILES += $(SPLIT_OUTPUTS)
+
+.PHONY: regen-split-outputs-mk
+regen-split-outputs-mk:
+ rm -f $(srcdir)/split-outputs.mk.tmp
+ cd $(srcdir) && ./gen-split-outputs-mk >split-outputs.mk.tmp
+ mv -f $(srcdir)/split-outputs.mk.tmp $(srcdir)/split-outputs.mk
+ chmod -w $(srcdir)/split-outputs.mk
## -------------- ##
@@ -942,6 +941,7 @@ regen-am:
$(MAKE) $(AM_MAKEFLAGS) regen-split-examples-mk
$(MAKE) $(AM_MAKEFLAGS) regen-outputs-mk
$(MAKE) $(AM_MAKEFLAGS) regen-examples-outputs-mk
+ $(MAKE) $(AM_MAKEFLAGS) regen-split-outputs-mk
## -------------- ##
diff --git a/milena/doc/gen-split-examples-mk b/milena/doc/gen-split-examples-mk
index fb29a02..a049c46 100755
--- a/milena/doc/gen-split-examples-mk
+++ b/milena/doc/gen-split-examples-mk
@@ -18,6 +18,8 @@
# To be used from milena/doc/'s source directory.
+# FIXME: Factor gen-split-examples-mk and gen-split-outputs-mk.
+
me=`basename $0`
die ()
diff --git a/milena/doc/gen-split-examples-mk b/milena/doc/gen-split-outputs-mk
similarity index 82%
copy from milena/doc/gen-split-examples-mk
copy to milena/doc/gen-split-outputs-mk
index fb29a02..22d0a71 100755
--- a/milena/doc/gen-split-examples-mk
+++ b/milena/doc/gen-split-outputs-mk
@@ -18,6 +18,8 @@
# To be used from milena/doc/'s source directory.
+# FIXME: Factor gen-split-examples-mk and gen-split-outputs-mk.
+
me=`basename $0`
die ()
@@ -44,10 +46,11 @@ backslashify()
# Get this list as argument?
inputs()
{
+ # FIXME: Or « find examples -name \*.cc -a \! -path examples/trash/\* » ?
find examples -name \*.cc
}
-output_dir=examples/split
+output_dir=outputs/split
# Use a temporary file to dump rules at the end of the output.
tempfile=`mktemp`
@@ -63,11 +66,12 @@ EOF
# Output target names in a variable.
{
- echo "SPLIT_EXAMPLES ="
+ echo "SPLIT_OUTPUTS ="
inputs | while read file; do
+
# Count the number of opening and closing marks.
- nopening=`grep -c '// *\\\{' "$file"`
- nclosing=`grep -c '// *\\\}' "$file"`
+ nopening=`grep -c 'doc::begin_output' "$file"`
+ nclosing=`grep -c 'doc::end_output' "$file"`
test "$nopening" -eq "$nclosing" \
|| die "Unbalanced marks in $file ($nopening vs $nclosing)"
@@ -81,15 +85,17 @@ EOF
| sed -e 's,examples/,,' \
-e 'y,/,_,' \
-e 's,\.cc$,,'`
- # Timestamp split examples (outputs) depend on.
- timestamp="\$(srcdir)/$output_dir/$canonical_name.cc.stamp"
+ # Output file to be split.
+ output="\$(srcdir)/outputs/$canonical_name.txt"
+ # Timestamp split outputs depend on.
+ timestamp="\$(srcdir)/$output_dir/$canonical_name.txt.stamp"
# List of targets associated to FILE.
targets=
{
i=1
while test "$i" -le "$nopening"; do
# i-th part of the split file.
- part="\$(srcdir)/$output_dir/$canonical_name-$i.cc.raw"
+ part="\$(srcdir)/$output_dir/$canonical_name-$i.txt"
if test -z "$targets"; then
targets="$part"
@@ -104,10 +110,10 @@ EOF
cat >>"$tempfile" <<EOF
-$timestamp: \$(srcdir)/$file
+$timestamp: $output
@rm -f \$@.tmp
@touch \$@.tmp
- \$(srcdir)/tools/split_sample.sh \$< cc raw \$(srcdir)/$output_dir
+ \$(srcdir)/tools/split_sample.sh \$< txt "" \$(srcdir)/$output_dir
@mv -f \$@.tmp \$@
EXTRA_DIST += $timestamp
MAINTAINERCLEANFILES += $timestamp
diff --git a/milena/doc/split-outputs.mk b/milena/doc/split-outputs.mk
new file mode 100644
index 0000000..417c25d
--- /dev/null
+++ b/milena/doc/split-outputs.mk
@@ -0,0 +1,60 @@
+## Generated by gen-split-outputs-mk. Do not edit by hand.
+
+SPLIT_OUTPUTS = \
+ $(srcdir)/outputs/split/graph-iter-1.txt \
+ $(srcdir)/outputs/split/graph-iter-2.txt \
+ $(srcdir)/outputs/split/graph-iter-3.txt \
+ $(srcdir)/outputs/split/graph-iter-4.txt \
+ $(srcdir)/outputs/split/tuto3_println-1.txt \
+ $(srcdir)/outputs/split/tuto3_println-2.txt \
+ $(srcdir)/outputs/split/tuto4_site_set_create-1.txt \
+ $(srcdir)/outputs/split/tuto4_site_set_create-2.txt \
+ $(srcdir)/outputs/split/tuto4_site_set_create-3.txt
+
+
+$(srcdir)/outputs/split/graph-iter.txt.stamp: $(srcdir)/outputs/graph-iter.txt
+ @rm -f $@.tmp
+ @touch $@.tmp
+ $(srcdir)/tools/split_sample.sh $< txt "" $(srcdir)/outputs/split
+ @mv -f $@.tmp $@
+EXTRA_DIST += $(srcdir)/outputs/split/graph-iter.txt.stamp
+MAINTAINERCLEANFILES += $(srcdir)/outputs/split/graph-iter.txt.stamp
+
+$(srcdir)/outputs/split/graph-iter-1.txt $(srcdir)/outputs/split/graph-iter-2.txt
$(srcdir)/outputs/split/graph-iter-3.txt $(srcdir)/outputs/split/graph-iter-4.txt:
$(srcdir)/outputs/split/graph-iter.txt.stamp
+## Recover from the removal of $@
+ @if test -f $@; then :; else \
+ rm -f $<; \
+ $(MAKE) $(AM_MAKEFLAGS) $<; \
+ fi
+
+
+$(srcdir)/outputs/split/tuto3_println.txt.stamp: $(srcdir)/outputs/tuto3_println.txt
+ @rm -f $@.tmp
+ @touch $@.tmp
+ $(srcdir)/tools/split_sample.sh $< txt "" $(srcdir)/outputs/split
+ @mv -f $@.tmp $@
+EXTRA_DIST += $(srcdir)/outputs/split/tuto3_println.txt.stamp
+MAINTAINERCLEANFILES += $(srcdir)/outputs/split/tuto3_println.txt.stamp
+
+$(srcdir)/outputs/split/tuto3_println-1.txt $(srcdir)/outputs/split/tuto3_println-2.txt:
$(srcdir)/outputs/split/tuto3_println.txt.stamp
+## Recover from the removal of $@
+ @if test -f $@; then :; else \
+ rm -f $<; \
+ $(MAKE) $(AM_MAKEFLAGS) $<; \
+ fi
+
+
+$(srcdir)/outputs/split/tuto4_site_set_create.txt.stamp:
$(srcdir)/outputs/tuto4_site_set_create.txt
+ @rm -f $@.tmp
+ @touch $@.tmp
+ $(srcdir)/tools/split_sample.sh $< txt "" $(srcdir)/outputs/split
+ @mv -f $@.tmp $@
+EXTRA_DIST += $(srcdir)/outputs/split/tuto4_site_set_create.txt.stamp
+MAINTAINERCLEANFILES += $(srcdir)/outputs/split/tuto4_site_set_create.txt.stamp
+
+$(srcdir)/outputs/split/tuto4_site_set_create-1.txt
$(srcdir)/outputs/split/tuto4_site_set_create-2.txt
$(srcdir)/outputs/split/tuto4_site_set_create-3.txt:
$(srcdir)/outputs/split/tuto4_site_set_create.txt.stamp
+## Recover from the removal of $@
+ @if test -f $@; then :; else \
+ rm -f $<; \
+ $(MAKE) $(AM_MAKEFLAGS) $<; \
+ fi
--
1.5.6.5
Show replies by date