diff --git a/winsup/doc/.cvsignore b/winsup/doc/.cvsignore index 30b46cf7f..288848833 100644 --- a/winsup/doc/.cvsignore +++ b/winsup/doc/.cvsignore @@ -1,4 +1,5 @@ Makefile +Makefile.dep autom4te.cache config.log diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog index e930a0d01..3d0c05035 100644 --- a/winsup/doc/ChangeLog +++ b/winsup/doc/ChangeLog @@ -1,3 +1,11 @@ +2013-05-23 Warren Young + + * xidepend: New script, generates Makefile.dep from top-level XML + * .cvsignore: Ignoring Makefile.dep output + * Makefile: Creating Makefile.dep if it doesn't exist, including it + if it does, and removing it on 'make clean' + * Wishlist: Knocked autodependency generation off the list + 2013-05-23 Corinna Vinschen * cygwinenv.xml (cygwinenv-implemented-options): Explain new diff --git a/winsup/doc/Makefile.in b/winsup/doc/Makefile.in index de02df45c..35b33fa40 100644 --- a/winsup/doc/Makefile.in +++ b/winsup/doc/Makefile.in @@ -21,6 +21,7 @@ exeext:=@build_exeext@ XMLTO:=xmlto --skip-validation --with-dblatex include $(srcdir)/../Makefile.common +-include $(srcdir)/Makefile.dep FAQ_SOURCES:= $(wildcard ${srcdir}/faq*.xml) @@ -29,7 +30,7 @@ FAQ_SOURCES:= $(wildcard ${srcdir}/faq*.xml) .html.body: $(srcdir)/bodysnatcher.pl $< -all: Makefile \ +all: Makefile Makefile.dep \ cygwin-ug-net/cygwin-ug-net.html \ cygwin-ug-net/cygwin-ug-net-nochunks.html.gz \ cygwin-api/cygwin-api.html \ @@ -38,6 +39,7 @@ all: Makefile \ cygwin-api/cygwin-api.pdf clean: + rm -f Makefile.dep rm -f doctool.exe doctool.o rm -f cygwin-api.xml rm -f *.html *.html.gz @@ -84,3 +86,6 @@ TBDEPS = cygwin-ug-net/cygwin-ug-net.html cygwin-api/cygwin-api.html tarball : cygwin-docs.tar.bz2 cygwin-docs.tar.bz2 : $(TBFILES) $(TBDEPS) find $(TBFILES) $(TBDIRS) \! -type d | sort | tar -T - -cf - | bzip2 > cygwin-docs.tar.bz2 + +Makefile.dep: cygwin-ug-net.xml faq.xml + $(srcdir)/xidepend $^ > $@ diff --git a/winsup/doc/xidepend b/winsup/doc/xidepend new file mode 100755 index 000000000..0704a7f28 --- /dev/null +++ b/winsup/doc/xidepend @@ -0,0 +1,34 @@ +#!/bin/sh +if [ "$1" = "-r" ] +then + # We're being called recursively by another xidepend instance, so + # suppress outputs that only happen at the top level. + shift + subproc=1 +else + subproc=0 +fi + +for f in "$@" +do + if fgrep -q 'xi:include' "$f" + then + # This file uses XIncludes. Let's chase its deps recursively. + base=`echo $f | sed -e s/\.xml//` + if [ $subproc -eq 0 ] ; then echo -n "$base/$base.html:" ; fi + + deps=`grep 'xi:include.*href' "$f" | cut -f2 -d\" | tr '\n' ' '` + echo -n " $deps" + for d in $deps + do + # Call ourselves recursively to continue to collect deps. + # The -r flag tells our subprocess that it is merely + # contributing to a dependency line in progress. + $0 -r $d + done + + # If we're at the top recursion level, we have nothing else to + # add to this dependency line other than the newline. + if [ $subproc -eq 0 ] ; then echo ; fi + fi +done