Makefile.in: Added target for makeyodldocs - not used by default.
[samba.git] / source / script / makeyodldocs.sh
1 #!/bin/sh
2 SRCDIR=$1/
3
4 YODLDIR=$SRCDIR/../docs/yodldocs
5 MANPAGEDIR=$SRCDIR/../docs/manpages
6 HTMLDIR=$SRCDIR/../docs/htmldocs
7
8 echo "Re-creating man pages and HTML pages from YODL sources..."
9
10 if [ ! -d $MANPAGEDIR ]; then
11   echo "directory $MANPAGEDIR does not exist, are we in the right place?"
12   exit 1
13 fi
14
15 if [ ! -d $HTMLDIR ]; then
16   echo "directory $HTMLDIR does not exist, are we in the right place?"
17   exit 1
18 fi
19
20 if [ ! -d $YODLDIR ]; then
21   echo "directory $YODLDIR does not exist, are we in the right place?"
22   exit 1
23 fi
24
25 cd $YODLDIR
26
27 for d in *.yo
28 do
29
30 #
31 # Create the basename from the YODL manpage
32 #
33     bn=`echo $d | sed -e 's/\.yo//`
34
35         case "$d"
36         in
37                 *.[0-9].yo)
38                         echo "Creating man pages..."
39                         echo $d
40                         rm -f $bn.man
41                         yodl2man $d
42                         if [ ! -f $bn.man ]; then
43                                 echo "Failed to make man page for $d"
44                                 exit 1
45                         fi
46                         cp $bn.man ../manpages/$bn || echo "Cannot create $YODLDIR/../manpages/$bn"
47                         rm -f $bn.man
48
49                         echo "Creating html versions of man pages..."
50                         echo $d
51                         rm -f $bn.html
52                         yodl2html $d
53                         if [ ! -f $bn.html ]; then
54                                 echo "Failed to make html page for $d"
55                                 exit 1
56                         fi
57                         cp $bn.html ../htmldocs || echo "Cannot create $YODLDIR/../htmldocs/$bn.html"
58                         rm -f $bn.html
59                         ;;
60                 *)
61 #
62 # Non man-page YODL docs - just make html.
63 #
64                         echo $d
65                         rm -f $bn.html
66                         yodl2html $d
67                         if [ ! -f $bn.html ]; then
68                 echo "Failed to make html page for $d"
69                 exit 1
70             fi
71                         cp $bn.html ../htmldocs || echo "Cannot create $YODLDIR/../htmldocs/$bn.html"
72                         rm -f $bn.html
73                 ;;
74         esac
75 done
76
77 echo "Remember to CVS check in your changes..."
78 exit 0