Generate text documentation from the troff source files.

This is done by make, in the 'docs' target, which is now part of the
normal build process.

Unfortunately, not all the games include troff sources.  Getting decent
HTML output from groff is still a difficult process which will not be
attempted at this time.  There are a few bugs in the 'install' and
'uninstall' rules.

Not to mention that the documentation is sometimes inaccurate.
This commit is contained in:
John "Elwin" Edwards 2016-02-21 20:47:12 -05:00
parent eab5aa2ec4
commit c6f7d67623
16 changed files with 133 additions and 2801 deletions

View file

@ -39,6 +39,7 @@ CFILES= vers.c armor.c chase.c command.c daemon.c daemons.c disply.c encumb.c \
rings.c rip.c rooms.c save.c scrolls.c state.c sticks.c things.c \
trader.c weapons.c wizard.c xcrypt.c
DOCS= $(PROGRAM).doc
MISC= Makefile LICENSE.TXT rogue.nr
CC = gcc
@ -48,6 +49,12 @@ CRLIB = @LIBS@
RM = rm -f
TAR = tar
INSTALL=@INSTALL@
GROFF=@GROFF@
NROFF=@NROFF@
COLCRT=@COLCRT@
TBL=@TBL@
all: $(PROGRAM) docs
$(PROGRAM): $(HDRS) $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(CRLIB) -o $@
@ -62,7 +69,16 @@ lint:
clean:
rm -f $(OBJS) core
rm -f $(PROGRAM) $(PROGRAM).exe $(PROGRAM) $(PROGRAM).exe $(PROGRAM).tar $(PROGRAM).tar.gz $(PROGRAM).doc
rm -f $(PROGRAM) $(PROGRAM).exe $(PROGRAM) $(PROGRAM).exe $(PROGRAM).tar $(PROGRAM).tar.gz $(DOCS)
docs: $(DOCS)
$(PROGRAM).doc: rogue.nr
if test "x$(GROFF)" != "x" ; then \
$(GROFF) -P-c -P-b -P-u -t -mm -Tascii rogue.nr >$(PROGRAM).doc ;\
elif test "x$(NROFF)" != "x" -a "x$(TBL)" != "x" -a "x$(COLCRT)" != "x" ; then \
$(TBL) rogue.nr | $(NROFF) -mm | $(COLCRT) - > $(PROGRAM).doc ;\
fi
install: $(PROGRAM)
-touch test
@ -87,12 +103,14 @@ install: $(PROGRAM)
then mkdir -p $(DESTDIR)$(docdir) ; fi
-$(INSTALL) -m 0644 LICENSE.TXT $(DESTDIR)$(docdir)/LICENSE.TXT
-$(INSTALL) -m 0644 rogue.nr $(DESTDIR)$(docdir)/$(PROGRAM).nr
-$(INSTALL) -m 0644 $(PROGRAM).doc $(DESTDIR)$(docdir)/$(PROGRAM).doc
-$(RM) test
uninstall:
-$(RM) $(DESTDIR)$(bindir)/$(PROGRAM)
-$(RM) $(DESTDIR)$(docdir)/LICENSE.TXT
-$(RM) $(DESTDIR)$(docdir)/$(PROGRAM).nr
-$(RM) $(DESTDIR)$(docdir)/$(PROGRAM).doc
-rmdir $(DESTDIR)$(docdir)
reinstall: uninstall install

View file

@ -27,6 +27,11 @@ AC_FUNC_VPRINTF
AC_CHECK_FUNCS([erasechar killchar alarm getpass memset setenv strchr nlist _spawnl spawnl getpwuid loadav getloadavg strerror setgid setuid getuid getgid lrand48 random srand48 srandom])
AC_PROG_INSTALL
AC_CHECK_PROG([NROFF], [nroff], [nroff],)
AC_CHECK_PROG([GROFF], [groff], [groff],)
AC_CHECK_PROG([COLCRT], [colcrt], [colcrt],)
AC_CHECK_PROG([TBL], [tbl], [tbl],)
AC_ARG_WITH(program-name, AC_HELP_STRING([--with-program-name=NAME],[alternate executable name]),[progname="$withval" ], [progname="srogue"] )
PROGRAM=$progname
AC_SUBST(PROGRAM)