--- Makefile	2010-06-24 22:57:53.000000000 +0200
+++ Makefile	2012-01-04 11:10:24.000000000 +0100
@@ -22,26 +22,26 @@
 
 #install with ocaml-findlib
 install: install_opt
-	install -D --mode=755 dypgen/dypgen $(BINDIR)
-	install -D --mode=755 dyp2gram.pl $(BINDIR)/dyp2gram
-	install -D --mode=644 doc/dypgen.1 $(MANDIR)/dypgen.1
-	install -D --mode=644 doc/dypgen.1 $(MANDIR)/dypgen.opt.1
-	install -D --mode=644 doc/dypgen.1 $(MANDIR)/dyp2gram.1
+	install -m 755 dypgen/dypgen $(DESTDIR)$(BINDIR)
+	install -m 755 dyp2gram.pl $(DESTDIR)$(BINDIR)/dyp2gram
+	install -m 644 doc/dypgen.1 $(DESTDIR)$(MANDIR)/dypgen.1
+	install -m 644 doc/dypgen.1 $(DESTDIR)$(MANDIR)/dypgen.opt.1
+	install -m 644 doc/dypgen.1 $(DESTDIR)$(MANDIR)/dyp2gram.1
 	cd dyplib; $(MAKE) install
 
 #install without ocaml-findlib
 install2: install_opt
-	install -D --mode=755 dypgen/dypgen $(BINDIR)
-	install -D --mode=755 dyp2gram.pl $(BINDIR)/dyp2gram
-	install -D --mode=644 doc/dypgen.1 $(MANDIR)/dypgen.1
-	install -D --mode=644 doc/dypgen.1 $(MANDIR)/dypgen.opt.1
-	install -D --mode=644 doc/dypgen.1 $(MANDIR)/dyp2gram.1
+	install -m 755 dypgen/dypgen $(DESTDIR)$(BINDIR)
+	install -m 755 dyp2gram.pl $(DESTDIR)$(BINDIR)/dyp2gram
+	install -m 644 doc/dypgen.1 $(DESTDIR)$(MANDIR)/dypgen.1
+	install -m 644 doc/dypgen.1 $(DESTDIR)$(MANDIR)/dypgen.opt.1
+	install -m 644 doc/dypgen.1 $(DESTDIR)$(MANDIR)/dyp2gram.1
 	cd dyplib; $(MAKE) install2
 
 ifdef CAMLOPT
 install_opt:
-	mkdir -p $(BINDIR)
-	cp dypgen/dypgen.opt $(BINDIR)
+	mkdir -p $(DESTDIR)$(BINDIR)
+	cp dypgen/dypgen.opt $(DESTDIR)$(BINDIR)
 else
 install_opt:
 endif
