docs/html/: Arrange for automatic build of hypercall docs
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 29 Nov 2011 15:48:08 +0000 (15:48 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Tue, 29 Nov 2011 15:48:08 +0000 (15:48 +0000)
- Use index.html rather than a stamp file.
- Automatically generate dependencies.
- Wire into the docs build system

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
docs/Makefile
docs/xen-headers

index ace60bacda93ed79f802f55628c31b649f8870d9..28a5b10917233d6f3c6985e3414e102df9a46e6f 100644 (file)
@@ -18,7 +18,8 @@ DOC_HTML      := $(patsubst src/%.tex,html/reference/%/index.html,$(DOC_TEX)) \
                   $(patsubst %.markdown,html/%.html,$(DOC_MARKDOWN)) \
                   $(patsubst man/%.pod.1,html/man/%.1.html,$(DOC_MAN1SRC)) \
                   $(patsubst man/%.pod.5,html/man/%.5.html,$(DOC_MAN5SRC)) \
-                  $(patsubst %.txt,html/%.txt,$(wildcard misc/*.txt))
+                  $(patsubst %.txt,html/%.txt,$(wildcard misc/*.txt)) \
+                  html/hypercall/index.html
 DOC_TXT         := $(patsubst %.txt,txt/%.txt,$(wildcard misc/*.txt)) \
                   $(patsubst %.markdown,txt/%.txt,$(DOC_MARKDOWN)) \
                   $(patsubst man/%.pod.1,txt/man/%.1.txt,$(DOC_MAN1SRC)) \
@@ -154,13 +155,15 @@ html/man/%.5.html: man/%.pod.5 Makefile
        $(POD2HTML) --infile=$< --outfile=$@.tmp
        $(call move-if-changed,$@.tmp,$@)
 
-html/hypercall/stamp:
+html/hypercall/index.html: ./xen-headers
+       rm -rf $(@D)
        @$(INSTALL_DIR) $(@D)
        ./xen-headers -O $(@D) \
                -T 'arch-x86_64 - Xen public headers' \
                -X arch-ia64 -X arch-x86_32 -X xen-x86_32 \
                ../xen include/public include/xen/errno.h
-       touch $@
+
+-include html/hypercall/.deps
 
 txt/%.txt: %.txt
        $(INSTALL_DIR) $(@D)
index 5a62622a238bca15da6e8092abca27fa22a43548..08fd7f3462a240be1fccbca0cbef491bc415f06f 100755 (executable)
@@ -325,6 +325,12 @@ END
 }
 
 foreach $pass (qw(1 2)) {
+    my $depspath = "$outdir/.deps";
+    my $depsout;
+    if ($pass==2) {
+       $depsout = new IO::File "$depspath.new", 'w' or die $!;
+    }
+
     find({ wanted => 
               sub {
                   return unless m/\.h$/;
@@ -341,11 +347,19 @@ foreach $pass (qw(1 2)) {
                   $leaf_opath = $leaf;
                   $leaf_opath =~ s#/#,#g;
                   $leaf_opath .= ".html";
+                  print $depsout "$outdir/index.html: $File::Find::name\n"
+                      or die $!
+                      if $pass==2;
                   process_file($File::Find::name, $outdir.'/'.$leaf_opath);
           },
           no_chdir => 1,
         },
         map { "$basedir/$_" } @indirs);
+
+    if ($pass==2) {
+       close $depsout or die $!;
+       rename "$depspath.new", "$depspath" or die $!;
+    }
 }
 
 output_index();