$NetBSD: patch-ae,v 1.2 2006/06/26 08:56:37 rillig Exp $

- destdir support
- use install -c

--- Makefile.orig	1997-02-05 13:12:18.000000000 +0000
+++ Makefile
@@ -10,32 +10,15 @@ include Makeflags
 
 
 install: $(MAELSTROM)
-	@if [ "$(LIBDIR)" = "." ]; then \
-		echo "	Nothing to do!  (Install to current directory)"; \
-		exit 1; \
-	fi
-	@if [ ! -d "$(BINDIR)" ]; then mkdir $(BINDIR); fi
-	@echo "Installing binaries in $(BINDIR)..."
+	@echo "Installing binaries in $(DESTDIR)$(BINDIR)..."
 	@for i in $(MAELSTROM) ; do \
 		strip $$i; \
-		$(INSTALL) -m 755 $$i $(BINDIR); \
+		$(INSTALL) -c -m 755 $$i $(DESTDIR)$(BINDIR); \
 	done
-	@if [ ! -d $(LIBDIR) ]; then \
-		mkdir $(LIBDIR); chmod 755 $(LIBDIR); \
-	fi
-	@echo "Installing data files in $(LIBDIR) ..."
-	@tar cf - $(DATAFILES) | (cd $(LIBDIR); tar xvf -)
-	@chmod -R +r $(LIBDIR)
-	@if [ ! -f "$(LIBDIR)/Maelstrom-Scores" ]; then \
-		echo "Installing Maelstrom high-scores file"; \
-		$(INSTALL) -m 666 Maelstrom-Scores  $(LIBDIR); \
-		chmod 666 $(LIBDIR)/Maelstrom-Scores; \
-	fi
-	@-if [ "$(SYSTEM)" = "Linux" ]; then \
-		echo "Fixing permissions for Maelstrom (set-uid root)"; \
-		chown root $(BINDIR)/Maelstrom && \
-					chmod u+s $(BINDIR)/Maelstrom; \
-	fi
+	@echo "Installing data files in $(DESTDIR)$(LIBDIR) ..."
+	@(umask 022; tar cf - $(DATAFILES) | (cd $(DESTDIR)$(LIBDIR); tar xvf -))
+	@chmod -R +r $(DESTDIR)$(LIBDIR)
+	${BSD_INSTALL_DATA} Maelstrom-Scores $(DESTDIR)$(PREFIX)/share/maelstrom
 	@echo "Maelstrom installed!"
 	@echo ""
 	@echo "Make sure that $(BINDIR) is in your execution path"
@@ -107,7 +90,7 @@ clobber: spotless
 
 Maelstrom_Globals.h: Mac_Resource.h sound.h fontserv.h framebuf.h \
                      x11_framebuf.h vga_framebuf.h dga_framebuf.h \
-                     			Maelstrom.h Maelstrom_Inline.h
+                     Maelstrom.h Maelstrom_Inline.h
 	@if [ -f "$@" ]; then touch "$@"; fi
 
 # DO NOT DELETE
