1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
#!/bin/sh
set -eu
#
# Simple script to repopulate the 'doc' tree from
# the mdoc man pages stored in each project.
#
script_dir=`dirname $0`
cd "$script_dir"
# Collect list of man pages, relative to my subdirs
test -d man || mkdir man
cd man
MANPAGES=`for d in libarchive tar cpio;do ls ../../$d/*.[135];done | grep -v '\.so\.'`
cd ..
# Build Makefile in 'man' directory
cd man
chmod +w .
rm -f *.[135] Makefile
echo > Makefile
echo "default: all" >>Makefile
echo >>Makefile
all="all:"
for f in $MANPAGES; do
outname="`basename $f`"
echo >> Makefile
echo $outname: ../mdoc2man.awk $f >> Makefile
echo " awk -f ../mdoc2man.awk < $f > $outname" >> Makefile
all="$all $outname"
done
echo $all >>Makefile
cd ..
# Rebuild Makefile in 'text' directory
test -d text || mkdir text
cd text
chmod +w .
rm -f *.txt Makefile
echo > Makefile
echo "default: all" >>Makefile
echo >>Makefile
all="all:"
for f in $MANPAGES; do
outname="`basename $f`.txt"
echo >> Makefile
echo $outname: $f >> Makefile
echo " nroff -mdoc $f | col -b > $outname" >> Makefile
all="$all $outname"
done
echo $all >>Makefile
cd ..
# Rebuild Makefile in 'pdf' directory
test -d pdf || mkdir pdf
cd pdf
chmod +w .
rm -f *.pdf Makefile
echo > Makefile
echo "default: all" >>Makefile
echo >>Makefile
all="all:"
for f in $MANPAGES; do
outname="`basename $f`.pdf"
echo >> Makefile
echo $outname: $f >> Makefile
echo " groff -mdoc -T ps $f | ps2pdf - - > $outname" >> Makefile
all="$all $outname"
done
echo $all >>Makefile
cd ..
# Build Makefile in 'html' directory
test -d html || mkdir html
cd html
chmod +w .
rm -f *.html Makefile
echo > Makefile
echo "default: all" >>Makefile
echo >>Makefile
all="all:"
for f in $MANPAGES; do
outname="`basename $f`.html"
echo >> Makefile
echo $outname: $f >> Makefile
echo " groff -mdoc -T html $f > $outname" >> Makefile
all="$all $outname"
done
echo $all >>Makefile
cd ..
# Build Makefile in 'wiki' directory
test -d wiki || mkdir wiki
cd wiki
chmod +w .
rm -f *.wiki Makefile
echo > Makefile
echo "default: all" >>Makefile
echo >>Makefile
all="all:"
for f in $MANPAGES; do
outname="`basename $f | awk '{ac=split($0,a,"[_.-]");o="ManPage";for(w=0;w<=ac;++w){o=o toupper(substr(a[w],1,1)) substr(a[w],2)};print o}'`.wiki"
echo >> Makefile
echo $outname: ../mdoc2wiki.awk $f >> Makefile
echo " awk -f ../mdoc2wiki.awk < $f > $outname" >> Makefile
all="$all $outname"
done
echo $all >>Makefile
cd ..
# Convert all of the manpages to -man format
(cd man && make)
# Format all of the manpages to text
(cd text && make)
# Format all of the manpages to PDF
(cd pdf && make)
# Format all of the manpages to HTML
(cd html && make)
# Format all of the manpages to wiki syntax
(cd wiki && make)
|