diff srogue/Makefile.in @ 223:0e99eade579c

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.
author John "Elwin" Edwards
date Sun, 21 Feb 2016 20:47:12 -0500
parents a666e4a034ed
children 4d0f53998e8a
line wrap: on
line diff
--- a/srogue/Makefile.in	Fri Feb 12 15:12:37 2016 -0500
+++ b/srogue/Makefile.in	Sun Feb 21 20:47:12 2016 -0500
@@ -39,6 +39,7 @@
       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 @@
 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 @@
 
 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 @@
 	    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