THRIFT-4717: fix up make clean with autoconf
diff --git a/lib/json/Makefile.am b/lib/json/Makefile.am
index 1051b9b..6c8c0ce 100644
--- a/lib/json/Makefile.am
+++ b/lib/json/Makefile.am
@@ -17,13 +17,17 @@
 # under the License.
 #
 
-SUBDIRS =
-
 if WITH_JAVA
 # Schema validation test depends on java
-SUBDIRS += test
+SUBDIRS = test
 endif
 
+clean-local:
+	$(RM) -r test/build/
+
+dist-hook:
+	$(RM) -r $(distdir)/test/build/
+
 EXTRA_DIST = \
     schema.json \
     test