THRIFT-4717: fix up make clean with autoconf
diff --git a/lib/php/Makefile.am b/lib/php/Makefile.am
index 8d9050a..7fdebe1 100755
--- a/lib/php/Makefile.am
+++ b/lib/php/Makefile.am
@@ -33,6 +33,7 @@
 phpmodule_SCRIPTS = src/ext/thrift_protocol/modules/thrift_protocol.so
 
 distclean-local:
+	if [ -f src/ext/thrift_protocol/Makefile ]; then cd src/ext/thrift_protocol/ && $(MAKE) distclean; fi
 	cd $(phpmodule_SCRIPTS) && $(PHPIZE) --clean
 
 endif
@@ -128,6 +129,10 @@
   lib/Type/TType.php \
   lib/Type/TConstant.php
 
+clean-local:
+	if [ -f src/ext/thrift_protocol/Makefile ]; then cd src/ext/thrift_protocol/ && $(MAKE) clean; fi
+
+
 EXTRA_DIST = \
   lib \
   src/autoload.php \
@@ -144,6 +149,5 @@
   README.md
 
 MAINTAINERCLEANFILES = \
-  Makefile \
   Makefile.in
 
diff --git a/lib/php/test/Makefile.am b/lib/php/test/Makefile.am
index 4824688..6f4e50a 100755
--- a/lib/php/test/Makefile.am
+++ b/lib/php/test/Makefile.am
@@ -48,6 +48,8 @@
   check-validator \
   check-json-serializer
 
+distclean-local:
+
 clean-local:
 	$(RM) -r ./packages
 	$(RM) TEST-*.xml