changeset 102:1906d183f1f5

srogue: add install and uninstall targets to Makefile
author John "Elwin" Edwards
date Mon, 02 Sep 2013 15:47:37 -0700
parents 15f8229f38c1
children 00baf21eb047
files srogue/Makefile.in
diffstat 1 files changed, 48 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/srogue/Makefile.in	Sun Sep 01 20:50:52 2013 -0700
+++ b/srogue/Makefile.in	Mon Sep 02 15:47:37 2013 -0700
@@ -11,9 +11,22 @@
 #
 # See the file LICENSE.TXT for full copyright and licensing information.
 
-DISTNAME=srogue9.0-1
+DISTNAME=@PACKAGE_TARNAME@@PACKAGE_VERSION@
+PACKAGE_TARNAME=@PACKAGE_TARNAME@-@PACKAGE_VERSION@
 PROGRAM=@PROGRAM@
 
+SCOREFILE=@SCOREFILE@
+LOGFILE=@LOGFILE@
+SAVEDIR=@SAVEDIR@
+GROUPOWNER=@GROUPOWNER@
+
+DESTDIR=
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+datarootdir=@datarootdir@
+bindir=@bindir@
+docdir=@docdir@
+
 HDRS= bob.h cx.h ncx.h rdk.h rogue.h 
 OBJS= vers.o armor.o chase.o command.o daemon.o daemons.o disply.o encumb.o \
       fight.o global.o init.o io.o list.o main.o mdport.o misc.o monsters.o \
@@ -34,6 +47,7 @@
 CRLIB = -lcurses
 RM    = rm -f
 TAR   = tar
+INSTALL=@INSTALL@
 
 $(PROGRAM): $(HDRS) $(OBJS)
 	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(CRLIB) -o $@
@@ -50,6 +64,39 @@
 	rm -f $(OBJS) core 
 	rm -f $(PROGRAM) $(PROGRAM).exe $(PROGRAM) $(PROGRAM).exe $(PROGRAM).tar $(PROGRAM).tar.gz $(PROGRAM).doc
 
+install: $(PROGRAM)
+	-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 \
+	$(INSTALL) -m 0664 test $(DESTDIR)$(LOGFILE) ; fi
+	-if test "x$(SAVEDIR)" != "x" && test ! -d $(DESTDIR)$(SAVEDIR) ; then \
+	mkdir -p $(DESTDIR)$(SAVEDIR) ; fi
+	-$(INSTALL) -m 0755 $(PROGRAM) $(DESTDIR)$(bindir)/$(PROGRAM)
+	-if test "x$(GROUPOWNER)" != "x" ; then \
+	    chgrp $(GROUPOWNER) $(DESTDIR)$(SCOREFILE) ; \
+	    chgrp $(GROUPOWNER) $(DESTDIR)$(LOGFILE) ; \
+	    chgrp $(GROUPOWNER) $(DESTDIR)$(bindir)/$(PROGRAM) ; \
+	    chgrp $(GROUPOWNER) $(DESTDIR)$(SAVEDIR) ; \
+	    chmod 02755 $(DESTDIR)$(bindir)/$(PROGRAM) ; \
+	    chmod 0464 $(DESTDIR)$(SCOREFILE) ; \
+	    chmod 0464 $(DESTDIR)$(LOGFILE) ; \
+	    chmod 0775 $(DESTDIR)$(SAVEDIR) ; \
+         fi
+	-if test ! -d $(DESTDIR)$(docdir) ; \
+	    then mkdir -p $(DESTDIR)$(docdir) ; fi
+	-$(INSTALL) -m 0644 LICENSE.TXT $(DESTDIR)$(docdir)/LICENSE.TXT
+	-$(INSTALL) -m 0644 rogue.nr $(DESTDIR)$(docdir)/$(PROGRAM).nr
+	-$(RM) test
+
+uninstall:	
+	-$(RM) $(DESTDIR)$(bindir)/$(PROGRAM)
+	-$(RM) $(DESTDIR)$(docdir)/LICENSE.TXT
+	-$(RM) $(DESTDIR)$(docdir)/$(PROGRAM).nr
+	-rmdir $(DESTDIR)$(docdir)
+    
+reinstall: uninstall install
+
 count:
 	wc -l $(HDRS) $(CFILES)