diff rogue5/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 71cb5b647f2b
children 4d0f53998e8a
line wrap: on
line diff
--- a/rogue5/Makefile.in	Fri Feb 12 15:12:37 2016 -0500
+++ b/rogue5/Makefile.in	Sun Feb 21 20:47:12 2016 -0500
@@ -46,9 +46,6 @@
 #COLCRT=colcrt
 COLCRT = @COLCRT@
 
-#SED=sed
-SED   = @SED@
-
 #SCOREFILE=rogue54.scr
 SCOREFILE = @SCOREFILE@
 
@@ -119,11 +116,10 @@
            rooms.c save.c scrolls.c state.c sticks.c things.c \
            weapons.c wizard.c xcrypt.c
 MISC_C   = findpw.c scedit.c scmisc.c
-DOCSRC   = rogue.me.in rogue.6.in rogue.doc.in rogue.html.in rogue.cat.in
-DOCS     = $(PROGRAM).doc $(PROGRAM).html $(PROGRAM).cat $(PROGRAM).me \
-           $(PROGRAM).6
+DOCSRC   = rogue.me.in rogue.6.in rogue.html.in
+DOCS     = $(PROGRAM).doc $(PROGRAM).cat
 AFILES   = configure Makefile.in configure.ac config.h.in config.sub config.guess \
-           install-sh rogue.6.in rogue.me.in rogue.html.in rogue.doc.in rogue.cat.in
+           install-sh rogue.6.in rogue.me.in rogue.html.in
 MISC     = Makefile.std LICENSE.TXT rogue54.sln rogue54.vcproj rogue.spec \
            rogue.png rogue.desktop
 
@@ -134,6 +130,8 @@
     
 .c.o:
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $*.c
+
+all: $(PROGRAM) docs
     
 $(PROGRAM): $(HDRS) $(OBJS)
 	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
@@ -143,6 +141,7 @@
 	$(RM) $(OBJS2)
 	$(RM) core a.exe a.out a.exe.stackdump $(PROGRAM) $(PROGRAM).exe
 	$(RM) $(PROGRAM).tar $(PROGRAM).tar.gz $(PROGRAM).zip 
+	$(RM) $(DOCS)
 	$(RM) $(DISTNAME)/*
 	-rmdir $(DISTNAME)
     
@@ -154,6 +153,8 @@
 	$(RM) config.log
 	$(RM) $(PROGRAM).scr $(PROGRAM).lck
 
+docs: $(DOCS)
+
 stddocs:
 	sed -e 's/@PROGRAM@/rogue/' -e 's/@SCOREFILE@/rogue.scr/' rogue.6.in > rogue.6
 	sed -e 's/@PROGRAM@/rogue/' -e 's/@SCOREFILE@/rogue.scr/' rogue.me.in > rogue.me
@@ -179,16 +180,21 @@
 	$(CC) -O -c $(SF) $*.c
 
 $(PROGRAM).doc: rogue.me
-	if test "x$(GROFF)" != "x" -a "x$(SED)" != "x" ; then \
-	$(GROFF) -P-c -t -me -Tascii rogue.me | $(SED) -e 's/.\x08//g' > $(PROGRAM).doc ;\
+	if test "x$(GROFF)" != "x" ; then \
+	$(GROFF) -P-c -P-b -P-u -t -me -Tutf8 rogue.me > $(PROGRAM).doc ;\
 	elif test "x$(NROFF)" != "x" -a "x$(TBL)" != "x" -a "x$(COLCRT)" != "x" ; then \
         tbl rogue.me | $(NROFF) -me | colcrt - > $(PROGRAM).doc ;\
 	fi
 
+#$(PROGRAM).html: rogue.me
+#	if test "x$(GROFF)" != "x" ; then \
+#	$(GROFF) -t -me -Thtml -P-l rogue.me > $(PROGRAM).html ;\
+#	fi
+
 $(PROGRAM).cat: rogue.6
-	if test "x$(GROFF)" != "x" -a "x$(SED)" != "x" ; then \
-	$(GROFF) -Tascii -man rogue.6 | $(SED) -e 's/.\x08//g' > $(PROGRAM).cat ;\
-	elif test "x$(NROFF)" != "x" -a "x$(TBL)" != "x" -a "x$(COLCRT)" != "x" ; then \
+	if test "x$(GROFF)" != "x" ; then \
+	$(GROFF) -P-c -P-b -P-u -Tascii -man rogue.6 > $(PROGRAM).cat ;\
+	elif test "x$(NROFF)" != "x" -a "x$(COLCRT)" != "x" ; then \
 	$(NROFF) -man rogue.6 | $(COLCRT) - > $(PROGRAM).cat ;\
 	fi
 
@@ -196,7 +202,7 @@
 	tar cf $(DISTFILE).tar $(PROGRAM) LICENSE.TXT $(DOCS)
 	gzip -f $(DISTFILE).tar
 
-install: $(PROGRAM)
+install: all
 	-$(TOUCH) test
 	-if test ! -f $(DESTDIR)$(SCOREFILE) ; then $(INSTALL) -m 0664 test $(DESTDIR)$(SCOREFILE) ; fi
 	-if test "x$(LOGFILE)" != "x" && test ! -f $(DESTDIR)$(LOGFILE) ; then \
@@ -216,9 +222,9 @@
          fi
 	-if test -d $(DESTDIR)$(man6dir) ; then $(INSTALL) -m 0644 rogue.6 $(DESTDIR)$(man6dir)/$(PROGRAM).6 ; fi
 	-if test ! -d $(DESTDIR)$(man6dir) ; then $(INSTALL) -m 0644 rogue.6 $(DESTDIR)$(mandir)/$(PROGRAM).6 ; fi
-	-$(INSTALL) -m 0644 rogue.doc $(DESTDIR)$(docdir)/$(PROGRAM).doc
+	-$(INSTALL) -m 0644 $(PROGRAM).doc $(DESTDIR)$(docdir)/$(PROGRAM).doc
 	-$(INSTALL) -m 0644 rogue.html $(DESTDIR)$(docdir)/$(PROGRAM).html
-	-$(INSTALL) -m 0644 rogue.cat $(DESTDIR)$(docdir)/$(PROGRAM).cat
+	-$(INSTALL) -m 0644 $(PROGRAM).cat $(DESTDIR)$(docdir)/$(PROGRAM).cat
 	-$(INSTALL) -m 0644 LICENSE.TXT $(DESTDIR)$(docdir)/LICENSE.TXT
 	-$(INSTALL) -m 0644 rogue.me $(DESTDIR)$(docdir)/$(PROGRAM).me
 	-if test "x$(LOCKFILE)" != "x" && test ! -f $(DESTDIR)$(LOCKFILE) ; then \
@@ -230,7 +236,10 @@
 uninstall:	
 	-$(RM) $(DESTDIR)$(bindir)/$(PROGRAM)
 	-$(RM) $(DESTDIR)$(man6dir)/$(PROGRAM).6
-	-$(RM) $(DESTDIR)$(docdir)$(PROGRAM)/$(PROGRAM).doc
+	-$(RM) $(DESTDIR)$(docdir)/$(PROGRAM).doc
+	-$(RM) $(DESTDIR)$(docdir)/$(PROGRAM).cat
+	-$(RM) $(DESTDIR)$(docdir)/$(PROGRAM).me
+	-$(RM) $(DESTDIR)$(docdir)/$(PROGRAM).html
 	-$(RM) $(DESTDIR)$(LOCKFILE)
 	-$(RMDIR) $(DESTDIR)$(docdir)$(PROGRAM)