#!/bin/bash ####################### Linux Kernel Documentation Project ####################### # # Usage: cook -o -i -n # # if -o is not mentioned, default is pdf # -i does not require a parameter # ################################################################################### BOOK=`basename \`pwd\`` EBB=0 LATEX=latex MAKEINDEX=makeindex PDF_CMD=dvipdfm PS_CMD=dvips HTML_CMD=latex2html HTML_OPTS="-nomath -html_version 4 -bottom_navigation -antialias -antialias_text -mkdir" INDEX=0 RUNS=0 OP=pdf TEMP=`getopt -o o:n:i -n 'cook' -- "$@"` if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi eval set -- "$TEMP" while true ; do case "$1" in -i) echo "Index" INDEX=1 shift ;; -o) OP=$2 shift 2 ;; -n) RUNS=$2 shift 2 ;; --) shift ; break ;; *) echo "Internal error!" ; exit 1 ;; esac done function core() { if [ $EBB != 0 ] then cd graphics ebb * cd .. fi if [ $RUNS != 0 ] then echo IN RUNS for (( i = 0; $i < $RUNS ; i++ )) do $LATEX $BOOK done elif [ -e $BOOK.toc ] then $LATEX $BOOK $LATEX $BOOK else $LATEX $BOOK $LATEX $BOOK $LATEX $BOOK fi if [ $INDEX == 1 ] then $MAKEINDEX $BOOK $LATEX $BOOK fi } case $OP in html) core $HTML_CMD $HTML_OPTS $BOOK echo html;; ps) core $PS_CMD $BOOK echo ps;; clean) rm -f *.aux *.log *.toc *.i* *.out echo Cleaned;; pdf) core $PDF_CMD $BOOK;; esac