--- Makefile.orig	2004-09-27 03:59:48.000000000 -0400
+++ Makefile	2014-09-08 12:19:12.246360998 -0400
@@ -58,10 +58,10 @@
 	$(CPP) -o envtest envtest.o gracetmpl.o
 
 install: all
-	install -D -m 644 gracetmpl.h $(INC_PREFIX)/gracetmpl.h
-	install -D -m 644 gracetmpl.a $(LIB_PREFIX)/gracetmpl.a
-	install -D -m 755 gracetmpldemo $(BIN_PREFIX)/gracetmpldemo
-	install -D -m 755 gracetmpl-config $(BIN_PREFIX)/gracetmpl-config
+	${BSD_INSTALL_DATA} gracetmpl.h $(DESTDIR)$(INC_PREFIX)/gracetmpl.h
+	${BSD_INSTALL_DATA} gracetmpl.a $(DESTDIR)$(LIB_PREFIX)/libgracetmpl.a
+	${BSD_INSTALL_PROGRAM} gracetmpldemo $(DESTDIR)$(BIN_PREFIX)/gracetmpldemo
+	${BSD_INSTALL_SCRIPT} gracetmpl-config $(DESTDIR)$(BIN_PREFIX)/gracetmpl-config
 
 gracetmpl-config: gracetmpl-config.in Makefile.defs
 	sed -e 's!__PREFIX__!$(PREFIX)!g' \
@@ -78,16 +78,16 @@
 	rm -f *~ \#*\#
 
 pythonwrap:
-	@if python python/prereq.py 2>/dev/null; then \
-	  (cd python; make); \
+	@if $(PYTHON) python/prereq.py 2>/dev/null; then \
+	  (cd python; $(MAKE)); \
 	else \
 	  echo missing python numarray extension.; \
 	  echo not building python stuff; \
 	fi
 
 pythonwrap_install:
-	@if python python/prereq.py 2>/dev/null; then \
-	  (cd python; make install); \
+	@if $(PYTHON) python/prereq.py 2>/dev/null; then \
+	  (cd python; $(MAKE) install); \
 	else \
 	  echo not installing python stuff; \
 	fi
@@ -121,10 +121,10 @@
 	rm -fr doc/html
 
 test: gracetmpldemo pythonwrap
-	@cd tests; make
+	@cd tests; $(MAKE)
 
 testpics: gracetmpldemo pythonwrap
-	@cd tests; make pics
+	@cd tests; $(MAKE) pics
 
 web: doc
 	(cd doc/html; tar cvhzf ../../web-`date +%s`.tgz .)
