changeset 275:aa0eefcd7df6

UltraRogue: build and install documentation in the Makefile.
author John "Elwin" Edwards
date Sat, 09 Sep 2017 07:25:23 -0400
parents 603e8a99c859
children 4573b355cdc1 c222f9d56776
files urogue/Makefile.in urogue/configure.ac
diffstat 2 files changed, 33 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/urogue/Makefile.in	Tue Sep 05 21:03:26 2017 -0400
+++ b/urogue/Makefile.in	Sat Sep 09 07:25:23 2017 -0400
@@ -9,6 +9,7 @@
 #
 
 DISTNAME=urogue1.0.7
+PACKAGE_TARNAME=@PACKAGE_TARNAME@
 
 HDRS		  = dict.h dictutil.h rogue.h
 OBJS		  = armor.o \
@@ -110,6 +111,8 @@
 		xcrypt.c
 
 MISC=           Makefile README LICENSE.TXT history.txt TODO
+DOCS = $(PROGRAM).cat
+RAWDOCS = README LICENSE.TXT history.txt TODO
 
 CC    = @CC@
 CPPFLAGS=@DEFS@
@@ -117,6 +120,9 @@
 CRLIB = @LIBS@
 RM    = rm -f
 TAR   = tar
+GROFF=@GROFF@
+NROFF=@NROFF@
+COLCRT=@COLCRT@
 INSTALL=@INSTALL@
 
 SCOREFILE=@SCOREFILE@
@@ -128,18 +134,33 @@
 DESTDIR=
 prefix=@prefix@
 exec_prefix=@exec_prefix@
+datarootdir=@datarootdir@
 bindir=@bindir@
+docdir=@docdir@
+mandir=@mandir@
+man6dir=$(mandir)/man6
 
 .c.o:
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $*.o $*.c
 
+all: $(PROGRAM) docs
+
 $(PROGRAM):	$(OBJS) $(MAKEFILE)
 	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(CRLIB) -o $@
 
 clean:		
-	rm -f $(OBJS) urogue a.out core *.map urogue.exe urogue.cat 
+	rm -f $(OBJS) urogue a.out core *.map urogue.exe $(PROGRAM).cat 
+
+docs: $(DOCS)
 
-install: $(PROGRAM)
+$(PROGRAM).cat: urogue.6
+	if test "x$(GROFF)" != "x" ; then \
+	$(GROFF) -P-c -P-b -P-u -Tascii -man urogue.6 > $(PROGRAM).cat ;\
+	elif test "x$(NROFF)" != "x" && test "x$(COLCRT)" != "x" ; then \
+	$(NROFF) -man urogue.6 | $(COLCRT) - > $(PROGRAM).cat ;\
+	fi
+
+install: all
 	touch test
 	if test ! -f $(DESTDIR)$(SCOREFILE) ; then \
 	    mkdir -p `dirname $(DESTDIR)$(SCOREFILE)` ; \
@@ -165,11 +186,17 @@
 	    chmod 0775 $(DESTDIR)$(SAVEDIR) ; \
 	    chmod 0775 $(DESTDIR)$(CHARDIR) ; \
         fi
+	mkdir -p $(DESTDIR)$(man6dir)
+	$(INSTALL) -m 0644 urogue.6 $(DESTDIR)$(man6dir)/$(PROGRAM).6
+	mkdir -p $(DESTDIR)$(docdir)
+	$(INSTALL) -m 0644 $(DOCS) $(RAWDOCS) $(DESTDIR)$(docdir)
 	$(RM) test
 
 uninstall:	
 	$(RM) $(DESTDIR)$(bindir)/$(PROGRAM)
-    
+	$(RM) $(DESTDIR)$(man6dir)/$(PROGRAM).6
+	$(RM) -r $(DESTDIR)$(docdir)
+
 reinstall: uninstall install
 
 dist.src:
--- a/urogue/configure.ac	Tue Sep 05 21:03:26 2017 -0400
+++ b/urogue/configure.ac	Sat Sep 09 07:25:23 2017 -0400
@@ -30,10 +30,9 @@
 AC_PROG_INSTALL
 
 # Programs to process the documentation
-#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_CHECK_PROG([NROFF], [nroff], [nroff],)
+AC_CHECK_PROG([GROFF], [groff], [groff],)
+AC_CHECK_PROG([COLCRT], [colcrt], [colcrt],)
 
 AC_ARG_WITH(program-name, AC_HELP_STRING([--with-program-name=NAME],[alternate executable name]),[progname="$withval" ], [progname="urogue"] )
 PROGRAM=$progname