diff make/make.sh @ 38:841aab0fd204

Add version info to menuconfig html, and genericize make with environment vars for paths and such.
author Rob Landley <rob@landley.net>
date Tue, 11 Sep 2007 16:12:06 -0500
parents 9a5ef2d1264e
children 17389c66eb02
line wrap: on
line diff
--- a/make/make.sh	Mon Sep 10 12:35:28 2007 -0500
+++ b/make/make.sh	Tue Sep 11 16:12:06 2007 -0500
@@ -1,63 +1,81 @@
 #!/bin/bash
 
+[ -z "$WEBDIR" ] && WEBDIR=~/www/kdocs
+[ -z "$LNXDIR" ] && LNXDIR=~/linux
 
-# mkdir -p ~/linux
-# cd ~/linux
-# hg clone http://kernel.org/hg/linux-2.6 hg
+echo $WEBDIR
+
+echo "Update master index."
 
-echo Update master index.
-~/www/kdocs/make/indexsections.py -i ~/www/kdocs/master.idx > ~/www/kdocs/master.html || exit 1
-~/www/kdocs/make/indexsections.py ~/www/kdocs/master.idx >> ~/www/kdocs/master.html || exit 1
+( $WEBDIR/make/indexsections.py -i $WEBDIR/master.idx &&
+  echo "<hr>" &&
+  $WEBDIR/make/indexsections.py $WEBDIR/master.idx
+) >> $WEBDIR/master.html || exit 1
+
+echo "Update Linux kernel from kernel.org"
 
-echo Update linux kernel from kernel.org Mercurial repository
-
-# Update kernel mercurial repository.
+if [ ! -d "$LNXDIR" ]
+then
+  # Clone repository if we haven't got one yet.
+  mkdir -p "$LNXDIR"/hg &&
+  cd "$LNXDIR"/hg &&
+  hg clone http://kernel.org/hg/linux-2.6 hg
+else
+  # Update kernel mercurial repository.
+  cd "$LNXDIR"/hg &&
+  hg pull -u
+fi
 
-cd ~/linux/hg
-hg pull -u
+[ $? -ne 0 ] && exit 1
+
+echo -n "Grab version number..."
+
+LNXTAG="$(hg tags | head -n 2 | tail -n 1 | awk '{print $1}')"
 
-echo Copying readme files
-rm -rf ~/www/kdocs/readme
-mkdir ~/www/kdocs/readme
+echo $LNXTAG
+
+echo Copy readme files from Linux kernel
+
+rm -rf $WEBDIR/readme
+mkdir $WEBDIR/readme
 for i in $(find . -name "*[Rr][Ee][Aa][Dd][Mm][Ee]*" | grep -v "Documentation/")
 do
   OUT=$(echo $i | sed -e 's@\./@@' -e 's@/@-@g')
-  cp $i ~/www/kdocs/readme/$OUT
+  cp $i $WEBDIR/readme/$OUT
 done
-make help > ~/www/kdocs/makehelp.txt
+make help > $WEBDIR/makehelp.txt
 
 echo Convert kconfig to html for all architectures
 
-rm -rf ~/www/kdocs/menuconfig/
-mkdir -p ~/www/kdocs/menuconfig
-echo "<html>Menuconfig docs for kernel $(make kernelversion)</html><body><ul>" > ~/www/kdocs/menuconfig/index.html
+echo $WEBDIR/menuconfig/
+rm -rf $WEBDIR/menuconfig/
+mkdir -p $WEBDIR/menuconfig
+echo "<html><title>Menuconfig docs for Linux $LNXTAG</title><body><ul>" > $WEBDIR/menuconfig/index.html
 for i in $(find arch -maxdepth 2 -name Kconfig | sort)
 do
   echo Converting "$i"
   ARCH=$(echo $i | sed -r 's@.*/(.*)/.*@\1@')
-  echo "<li><a href=${ARCH}.html>${ARCH}</a></li>" >> ~/www/kdocs/menuconfig/index.html
-  echo ~/www/kdocs/make/menuconfig2html.py $i ~/www/kdocs/menuconfig # $ARCH.html
-
-  ~/www/kdocs/make/menuconfig2html.py $i ~/www/kdocs/menuconfig > ~/www/kdocs/menuconfig/$ARCH.html
+  echo "<li><a href=${ARCH}.html>${ARCH}</a></li>" >> $WEBDIR/menuconfig/index.html
+  $WEBDIR/make/menuconfig2html.py $i $WEBDIR/menuconfig "$LNXTAG" > $WEBDIR/menuconfig/$ARCH.html
 done
-echo "</ul></body></html>" >> ~/www/kdocs/menuconfig/index.html
+echo "</ul></body></html>" >> $WEBDIR/menuconfig/index.html
 
 echo Install updated Documentation
 
-rm -rf ~/www/kdocs/Documentation/
-cp -a ~/linux/hg/Documentation ~/www/kdocs/Documentation
+rm -rf $WEBDIR/Documentation/
+cp -a $LNXDIR/hg/Documentation $WEBDIR/Documentation
 
 echo Build htmldocs and xhtml-nochunks
 
-rm -rf ~/linux/temp
-cd ~/linux/hg
-mkdir ~/linux/temp
-make allnoconfig O=~/linux/temp
+rm -rf $LNXDIR/temp
+cd $LNXDIR/hg
+mkdir $LNXDIR/temp
+make allnoconfig O=$LNXDIR/temp
 
 # I have a dual processor laptop, so overlap work here.  Generate the xml
 # first, then have make htmldocs produce split-up versions in the background
 # while a script produces nochunks versions in the foreground.
-cd ~/linux/temp
+cd $LNXDIR/temp
 make -j 2 xmldocs
 make -j 2 htmldocs &
 cd Documentation/DocBook
@@ -79,9 +97,9 @@
 
 echo Install htmldocs and update index
 
-rm -rf ~/www/kdocs/htmldocs
-cp -a ~/linux/temp/Documentation/DocBook ~/www/kdocs/htmldocs
-cd ~/www/kdocs/htmldocs
+rm -rf $WEBDIR/htmldocs
+cp -a $LNXDIR/temp/Documentation/DocBook $WEBDIR/htmldocs
+cd $WEBDIR/htmldocs
 # Work around a bug in xmlto: it puts an incorrect code page into the converted
 # html documents, which produces line noise in the output.
 find . -name "*.html" | xargs sed -i -e 's/.*ISO-8859-1.*//'