- added the html man pages to the default target

- fixed the making of the html man pages so that they only happen
  when they're actually required.
This commit is contained in:
gdr 1997-11-24 05:46:29 +00:00
parent 71090e862f
commit c2951e680e
3 changed files with 57 additions and 8 deletions

View File

@ -5,7 +5,7 @@
#
# Devin Reade, 1997.
#
# $Id: Makefile,v 1.1 1997/11/24 05:07:26 gdr Exp $
# $Id: Makefile,v 1.2 1997/11/24 05:46:28 gdr Exp $
#
# Set this to 'true' (without the quotes) for local links (used
@ -96,7 +96,7 @@ UPLOADS = htmld.tar.gz \
#
# targets
#
all: h dvi ps
all: h dvi ps man
dvi: $(DVI)
ps: $(PS)
h: $(HTML) $(HTMLD)/index.html $(HTMLD)/unaval.html top.html cleanhtml
@ -141,16 +141,18 @@ top.html:
# This target creates the html versions of all the current man pages,
# plus the chapter index pages. Unfortunately, this target rebuilds
# _all_ of it's files, not just those that are out of date.
man:
man: mansetup
@GNOROOT=../.. MANHTML=$(MANHTML) NAME="$(NAME)" \
ADDR="$(ADDRESS)" MKSO="$(MKSO)" HTMLROOT="$(HTML_ROOT)" \
./mkhtmlman
mansetup: newer
clean:
-rm -rf *~ $(TEX_GARBAGE) $(DVIPS_GARBAGE) $(UPLOADS)
clobber: clean
-rm -rf $(MANUAL_GARBAGE) $(HTMLD) $(PSD) $(DVID)
-rm -rf $(MANUAL_GARBAGE) $(HTMLD) $(PSD) $(DVID) newer
#
# default rules

View File

@ -2,7 +2,7 @@
#
# Devin Reade, November 1997.
#
# $Id: mkhtmlman,v 1.1 1997/11/24 05:07:27 gdr Exp $
# $Id: mkhtmlman,v 1.2 1997/11/24 05:46:29 gdr Exp $
man2html=/usr/local/bin/man2html
TMPDIR=${TMPDIR:-/tmp}
@ -26,6 +26,10 @@ if [ -z "$ADDR" ]; then
echo "ADDR variable not set"
exit 1
fi
if [ ! -x ./newer ]; then
echo "./newer does not exist"
exit 1
fi
set +e
listfile=$TMPDIR/mkhtmlman.1.$$
@ -42,13 +46,16 @@ for section in 1 2 3 4 5 6 7 8; do
| grep -v libcurses/PSD.doc`; do
[ "$F" = 00.DUMMY ] && continue;
f=`basename $F`
echo "creating $dest/$f.html"
echo "$f" >> $listfile
nroff -man $F | $man2html -nodepage | \
perl -p -e \
if ! ./newer $dest/$f.html $F; then
echo "creating $dest/$f.html"
nroff -man $F | $man2html -nodepage | \
perl -p -e \
's/<BODY>/<title>GNO: '"$f($section)"'<\/title><body bgcolor=\#ffffff>/;' \
> $dest/$f.html
fi
done
echo "creating $dest/00.index.html"
sort $listfile | \
./mkmandex -s$section -name="$NAME" -addr="$ADDR" -mkso="$MKSO" \
-hroot="$HTMLROOT" > $dest/00.index.html

40
doc/refs/newer.c Normal file
View File

@ -0,0 +1,40 @@
/*
* Usage: newer file1 file2
*
* Returns zero if both files exist and file1 is newer than file1, otherwise
* returns 1. If file2 does not exist, an error message is printed
* as well.
*
* Devin Reade, November 1997
*
* $Id: newer.c,v 1.1 1997/11/24 05:46:29 gdr Exp $
*/
#include <stdio.h>
#include <sys/stat.h>
#include <errno.h>
#include <string.h>
int
main (int argc, char **argv) {
struct stat sbuf1, sbuf2;
char *file1, *file2;
if (argc != 3) {
fprintf(stderr, "Usage: %s file1 file2\n", argv[0]);
return 1;
}
file1 = argv[1];
file2 = argv[2];
if (stat(file2, &sbuf2) < 0) {
fprintf(stderr, "couldn't stat %s: %s\n", file2, strerror(errno));
return 1;
}
if (stat(file1, &sbuf1) < 0) {
return 1;
}
return (sbuf1.st_mtime > sbuf2.st_mtime) ? 0 : 1;
}