diff urogue/Makefile.in @ 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 fe6b7a1a6dfc
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: