--- Makefile.orig	2008-03-16 23:23:22.000000000 +0900
+++ Makefile	2012-07-12 22:47:37.000000000 +0900
@@ -1,26 +1,26 @@
 
-DESTDIR=/usr/local
-PREFIX=xyssl_
+PREFIX?=/usr/local
+DESTDIR=${PREFIX}
 
 .SILENT:
 
 all:
-	cd library  && make all && cd ..
-	cd programs && make all && cd ..
+	cd library  && $(MAKE) all && cd ..
+	cd programs && $(MAKE) all && cd ..
 
 install:
 	mkdir -p $(DESTDIR)/include/xyssl
-	cp -r include/xyssl $(DESTDIR)/include
-	
+	${BSD_INSTALL_DATA} include/xyssl/*.h $(DESTDIR)/include/xyssl
+
 	mkdir -p $(DESTDIR)/lib
-	cp library/libxyssl.* $(DESTDIR)/lib
-	
+	${BSD_INSTALL_DATA} library/libxyssl.* $(DESTDIR)/lib
+
 	mkdir -p $(DESTDIR)/bin
 	for p in programs/*/* ; do              \
 	    if [ -x $$p ] && [ ! -d $$p ] ;     \
 	    then                                \
-	        f=$(PREFIX)`basename $$p` ;     \
-	        cp $$p $(DESTDIR)/bin/$$f ;     \
+	        f=xyssl_`basename $$p` ;     \
+	        ${BSD_INSTALL_PROGRAM} $$p $(DESTDIR)/bin/$$f ;     \
 	    fi                                  \
 	done
 
