THRIFT-4717: fix up make clean with autoconf
diff --git a/lib/erl/Makefile.am b/lib/erl/Makefile.am
index 06323b4..fdfc9eb 100644
--- a/lib/erl/Makefile.am
+++ b/lib/erl/Makefile.am
@@ -67,16 +67,26 @@
 	done
 
 uninstall:
-	rm -rf $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)
+	$(RM) -rf $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)
 
-clean:
-	rm -f .generated
-	rm -rf test/gen-erl/
-	rm -f $(THRIFT_OMIT_FILE)
+clean-local:
 	$(REBAR) clean
+	$(RM)    .generated
+	$(RM) -r .rebar/
+	$(RM) -r deps/
+	$(RM) -r test/gen-erl/
+	$(RM)    $(THRIFT_OMIT_FILE)
 
 maintainer-clean-local:
-	rm -rf ebin
+	$(RM) -r ebin/
+
+dist-hook:
+	$(RM)    $(distdir)/.generated
+	$(RM) -r $(distdir)/.rebar/
+	$(RM) -r $(distdir)/deps/
+	$(RM) -r $(distdir)/ebin/
+	$(RM) -r $(distdir)/test/gen-erl/
+	$(RM)    $(distdir)/$(THRIFT_OMIT_FILE)
 
 EXTRA_DIST = \
 	include \