]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - manual/libc-texinfo.sh
powerpc: Refactor powerpc64 lround/lroundf/llround/llroundf
[thirdparty/glibc.git] / manual / libc-texinfo.sh
index 321b9554ad2026808d4b678dfb1c0e6ec492bbf9..aea27f9e94c4f0f512fdd8eeebfc28f462b874d1 100644 (file)
@@ -1,10 +1,13 @@
-#! /bin/sh
+#!/bin/sh
+
+OUTDIR=$1
+shift
 
 # Create libc.texinfo from the chapter files.
 
-trap "rm -f *.$$; exit 1" 1 2 15
+trap "rm -f ${OUTDIR}*.$$; exit 1" 1 2 15
 
-exec 3>incl.$$ 4>smenu.$$ 5>lmenu.$$
+exec 3>${OUTDIR}incl.$$ 4>${OUTDIR}smenu.$$ 5>${OUTDIR}lmenu.$$
 
 build_menu () {
   while IFS=: read file node; do
@@ -25,27 +28,18 @@ collect_nodes () {
        END  { for (x in file)
                 if (file[x] != "")
                   print file[x] ":" x, file[nnode[x]] ":" nnode[x] }' |
-  tsort | sed 's/_/ /g; $d'
+  $AWK -f tsort.awk | sed 's/_/ /g'
 }
 
 collect_nodes $1 | build_menu
 
-if [ -n "$2" ]; then
-
-  { echo; echo 'Add-ons'; echo; } >&4
-
-  egrep '^(@c )?@node.*Top' `echo $2 /dev/null | tr ' ' '\n' | sort` |
-  cut -d, -f1 | sed 's/@c //;s/@node //' | build_menu
-
-fi
-
 { echo; echo 'Appendices'; echo; } >&4
 
-collect_nodes $3 | build_menu
+collect_nodes $2 | build_menu
 
 exec 3>&- 4>&- 5>&-
 
-mv -f incl.$$ chapters.texi
+mv -f ${OUTDIR}incl.$$ ${OUTDIR}chapters.texi
 
 {
  echo '@menu'
@@ -66,10 +60,13 @@ mv -f incl.$$ chapters.texi
   }
 
   !/^\*/ { print; }
- ' smenu.$$
+ ' ${OUTDIR}smenu.$$
  cat <<EOF
-* Copying::                      The GNU Library General Public License says
+* Free Manuals::                Free Software Needs Free Documentation.
+* Copying::                      The GNU Lesser General Public License says
                                   how you can copy and share the GNU C Library.
+* Documentation License::        This manual is under the GNU Free
+                                  Documentation License.
 
 Indices
 
@@ -79,10 +76,12 @@ Indices
 * Variable Index::               Index of variables and variable-like macros.
 * File Index::                   Index of programs and files.
 
+ @detailmenu
  --- The Detailed Node Listing ---
 EOF
- cat lmenu.$$
- echo '@end menu'; } >top-menu.texi.$$
-mv -f top-menu.texi.$$ top-menu.texi
+ cat ${OUTDIR}lmenu.$$
+ echo '@end detailmenu'
+ echo '@end menu'; } >${OUTDIR}top-menu.texi.$$
+mv -f ${OUTDIR}top-menu.texi.$$ ${OUTDIR}top-menu.texi
 
-rm -f *.$$
+rm -f ${OUTDIR}*.$$