THRIFT-4717: fix up make clean with autoconf
diff --git a/tutorial/d/Makefile.am b/tutorial/d/Makefile.am
index d8c8b29..358294c 100644
--- a/tutorial/d/Makefile.am
+++ b/tutorial/d/Makefile.am
@@ -44,3 +44,10 @@
 
 clean:
 	$(RM) -f $(PROGS)
+	$(RM) -r gen-d/
+	find . -type f -name '*.o' | xargs rm -f
+
+dist-hook:
+	$(RM) -f $(distdir)/$(PROGS)
+	$(RM) -r $(distdir)/gen-d/
+	find $(destdir) -type f -name '*.o' | xargs rm -f
diff --git a/tutorial/dart/Makefile.am b/tutorial/dart/Makefile.am
index 0495aca..0b93ac8 100644
--- a/tutorial/dart/Makefile.am
+++ b/tutorial/dart/Makefile.am
@@ -25,11 +25,19 @@
 all-local: gen-dart/tutorial/lib/tutorial.dart pub-get
 
 clean-local:
-	$(RM) -r gen-*
+	$(RM) -r gen-*/
+	find . -type d -name ".dart_tool" | xargs $(RM) -r
 	find . -type d -name "packages" | xargs $(RM) -r
 	find . -type f -name ".packages" | xargs $(RM)
 	find . -type f -name "pubspec.lock" | xargs $(RM)
 
+dist-hook:
+	$(RM) -r $(distdir)/gen-*/
+	find $(distdir) -type d -name ".dart_tool" | xargs $(RM) -r
+	find $(distdir) -type d -name "packages" | xargs $(RM) -r
+	find $(distdir) -type f -name ".packages" | xargs $(RM)
+	find $(distdir) -type f -name "pubspec.lock" | xargs $(RM)
+
 pub-get: pub-get-gen pub-get-client pub-get-console-client pub-get-server
 
 pub-get-gen: pub-get-tutorial pub-get-shared
diff --git a/tutorial/hs/Makefile.am b/tutorial/hs/Makefile.am
index a3eccc2..9c6fd83 100755
--- a/tutorial/hs/Makefile.am
+++ b/tutorial/hs/Makefile.am
@@ -27,7 +27,12 @@
 # Make sure this doesn't fail if Haskell is not configured.
 clean-local:
 	$(CABAL) clean
-	$(RM) -r gen-*
+	$(RM) -r dist/
+	$(RM) -r gen-*/
+
+dist-hook:
+	$(RM) -r $(distdir)/dist/
+	$(RM) -r $(distdir)/gen-*/
 
 check-local:
 	$(CABAL) check
diff --git a/tutorial/netcore/Makefile.am b/tutorial/netcore/Makefile.am
index e305556..bd19dfe 100644
--- a/tutorial/netcore/Makefile.am
+++ b/tutorial/netcore/Makefile.am
@@ -31,6 +31,15 @@
 	$(RM) -r Interfaces/bin
 	$(RM) -r Interfaces/obj
 
+dist-hook:
+	$(RM) $(distdir)/Interfaces.dll
+	$(RM) -r $(distdir)/Client/bin
+	$(RM) -r $(distdir)/Client/obj
+	$(RM) -r $(distdir)/Server/bin
+	$(RM) -r $(distdir)/Server/obj
+	$(RM) -r $(distdir)/Interfaces/bin
+	$(RM) -r $(distdir)/Interfaces/obj
+
 EXTRA_DIST = \
 	Client \
 	Interfaces \