THRIFT-784. erl: Fix two problems with "make install"

- Support DESTDIR.
- Pass proper arguments to install.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@945898 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/erl/Makefile.am b/lib/erl/Makefile.am
index a7ed477..33761a1 100644
--- a/lib/erl/Makefile.am
+++ b/lib/erl/Makefile.am
@@ -26,16 +26,16 @@
 	done
 
 install: all
-	mkdir -p $(ERLANG_INSTALL_LIB_DIR_thrift) ; \
-	mkdir -p $(ERLANG_INSTALL_LIB_DIR_thrift)/ebin ; \
-	mkdir -p $(ERLANG_INSTALL_LIB_DIR_thrift)/include ; \
-	mkdir -p $(ERLANG_INSTALL_LIB_DIR_thrift)/src ; \
-	for i in ebin/*.app* ebin/*.beam include/*.hrl src/*.erl ; \
-		do $(INSTALL) $$p $(ERLANG_INSTALL_LIB_DIR_thrift)/$$p ; \
+	mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift) ; \
+	mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/ebin ; \
+	mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/include ; \
+	mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/src ; \
+	for p in ebin/*.app* ebin/*.beam include/*.hrl src/*.erl ; \
+		do $(INSTALL) $$p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/$$p ; \
 	done
 
 uninstall:
-	rm -rf $(ERLANG_INSTALL_LIB_DIR_thrift)
+	rm -rf $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)
 
 
 maintainer-clean-local: