From d3900dea28f9ab8207c35365b5fee2058b68fe91 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 11 Sep 2013 10:48:19 +0100 Subject: docs: fix documentation index for hypercalls This was broken by 118104e5eaf2 "docs: Build docs for ARM as well as x86_64". Move docs to hypercall/ARCH instead of hypercall-ARCH. Support mulitple levels of subdirectories in gen-html-index tool. This removes the need for a symlink hypercall->hypercall-x86_64 since there is now a proper index at hypercall/index.html. Update INDEX to human readable names for the architecture specific hypercalls. Signed-off-by: Ian Campbell --- docs/INDEX | 5 ++++- docs/Makefile | 12 ++++-------- docs/gen-html-index | 33 ++++++++++++++++++++++++--------- 3 files changed, 32 insertions(+), 18 deletions(-) (limited to 'docs') diff --git a/docs/INDEX b/docs/INDEX index f5ccae23c4..fdf0ad82df 100644 --- a/docs/INDEX +++ b/docs/INDEX @@ -1,4 +1,7 @@ -hypercall/index Hypercall Interfaces +hypercall Hypercall Interfaces +hypercall/arm/index ARM +hypercall/x86_32/index x86_32 +hypercall/x86_64/index x86_64 man Man Pages diff --git a/docs/Makefile b/docs/Makefile index f4801716b3..8d5d48e355 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -15,8 +15,7 @@ DOC_HTML := $(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)) \ - html/hypercall/index.html \ - $(patsubst %,html/hypercall-%/index.html,$(DOC_ARCHES)) + $(patsubst %,html/hypercall/%/index.html,$(DOC_ARCHES)) 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)) \ @@ -125,9 +124,9 @@ else endif # For non-x86 arches exclude the subarch whole x86 arch. -$(foreach i,$(filter-out x86_32 x86_64,$(DOC_ARCHES)),html/hypercall-$(i)/index.html): EXTRA_EXCLUDE := -X arch-x86 +$(foreach i,$(filter-out x86_32 x86_64,$(DOC_ARCHES)),html/hypercall/$(i)/index.html): EXTRA_EXCLUDE := -X arch-x86 -html/hypercall-%/index.html: $(CURDIR)/xen-headers Makefile +html/hypercall/%/index.html: $(CURDIR)/xen-headers Makefile rm -rf $(@D) $(INSTALL_DIR) $(@D) $(PERL) -w $(CURDIR)/xen-headers -O $(@D) \ @@ -137,10 +136,7 @@ html/hypercall-%/index.html: $(CURDIR)/xen-headers Makefile $(EXTRA_EXCLUDE) \ $(XEN_ROOT)/xen include/public include/xen/errno.h -html/hypercall/index.html: html/hypercall-x86_64/index.html - ln -nfs hypercall-x86_64 html/hypercall - --include $(wildcard html/hypercall-*/.deps) +-include $(wildcard html/hypercall/*/.deps) txt/%.txt: %.txt $(INSTALL_DIR) $(@D) diff --git a/docs/gen-html-index b/docs/gen-html-index index 7b36a191e3..e9792bf937 100644 --- a/docs/gen-html-index +++ b/docs/gen-html-index @@ -71,16 +71,16 @@ sub make_link ($$) { my ($ref,$base) = @_; my $txt = make_linktext($ref); - $ref = basename($ref) if $base; + $ref =~ s,^$base/,, if $base; #/ return "
  • $txt
  • \n"; } -sub make_links ($$@) { - my ($dir,$base,@docs) = @_; +sub make_links ($@) { + my ($dir,@docs) = @_; my $idx = ''; foreach my $of (sort { make_linktext($a) cmp make_linktext($b) } @docs) { - $idx .= make_link($of,$base); + $idx .= make_link($of,$dir); } return $idx; } @@ -103,22 +103,37 @@ sub uniq (@) { foreach (@_) { $h{$_} = 1; } return keys %h; } - + for (@docs) { s,^\Q$outdir\E/,, } @docs = grep { -e "$outdir/$_" && (make_linktext($_) ne "NO-INDEX") } @docs; my $top = ''; -foreach my $od (sort { $a cmp $b } uniq map { dirname($_) } @docs) { +# Return a list of all directories leading to $path +sub dirs($) +{ + my ($path) = @_; + my @dirs; + while ( $path =~ m,/, ) + { + $path =~ m,/([^/]+)$,; + push @dirs, $`;#` + $path = $`;#` + } + return @dirs; +} + +foreach my $od (sort { $a cmp $b } uniq map { dirs($_) } @docs) { my @d = (grep /^\Q$od\E/, @docs); if ( @d == 1 and $d[0] eq "$od/index.html" ) { + next if $d[0] =~ m,/,;#/ linked to from the subdirectory entry. $top .= make_link("$od/index.html", 0); } else { - my $links = make_links($od,0,@d); + my $links = make_links(undef,@d); my $secttitle = make_linktext($od); $top .= <$secttitle @@ -127,8 +142,8 @@ $links END - $links = make_links($od,1,@d); - my $idx = ''; + $links = make_links($od,@d); + my $idx = ''; $idx .= <$secttitle
      -- cgit v1.2.3