THRIFT-2693 Erlang test leaves a lot of generated files

Patch: Roger Meier
diff --git a/lib/erl/Makefile.am b/lib/erl/Makefile.am
index cdac926..60c7e5a 100644
--- a/lib/erl/Makefile.am
+++ b/lib/erl/Makefile.am
@@ -23,7 +23,7 @@
 
 .generated: $(THRIFT_FILES)
 	for f in $(THRIFT_FILES) ; do \
-	  $(THRIFT) --gen erl -out test $$f ; \
+	  $(THRIFT) --gen erl -o test $$f ; \
 	done ; \
 	touch .generated
 
@@ -48,19 +48,7 @@
 
 clean:
 	rm -f .generated
-	rm -f test/thrift1151_types.erl \
-		  test/thrift1151_types.hrl \
-		  test/thrift1151_constants.hrl \
-		  test/thrift1475_types.erl \
-		  test/thrift1475_types.hrl \
-		  test/thrift1475_constants.hrl \
-		  test/thriftTest_types.erl \
-		  test/thriftTest_types.hrl \
-		  test/thriftTest_constants.hrl \
-		  test/thriftTest_thrift.erl \
-		  test/thriftTest_thrift.hrl \
-		  test/secondService_thrift.erl \
-		  test/secondService_thrift.hrl
+	rm -rf test/gen-erl/
 	./rebar clean
 
 maintainer-clean-local:
diff --git a/lib/erl/test/test_client.erl b/lib/erl/test/test_client.erl
index 59f596d..79708ca 100644
--- a/lib/erl/test/test_client.erl
+++ b/lib/erl/test/test_client.erl
@@ -21,7 +21,7 @@
 
 -export([start/0, start/1]).
 
--include("thriftTest_types.hrl").
+-include("gen-erl/thriftTest_types.hrl").
 
 -record(options, {port = 9090,
                   client_opts = []}).
diff --git a/lib/erl/test/test_membuffer.erl b/lib/erl/test/test_membuffer.erl
index 7a01143..8892df0 100644
--- a/lib/erl/test/test_membuffer.erl
+++ b/lib/erl/test/test_membuffer.erl
@@ -22,7 +22,7 @@
 -ifdef(TEST).
 -include_lib("eunit/include/eunit.hrl").
 
--include("thriftTest_types.hrl").
+-include("gen-erl/thriftTest_types.hrl").
 
 test_data() ->
   #xtruct {
diff --git a/lib/erl/test/test_server.erl b/lib/erl/test/test_server.erl
index 63f7b08..8cabd6f 100644
--- a/lib/erl/test/test_server.erl
+++ b/lib/erl/test/test_server.erl
@@ -21,7 +21,7 @@
 
 -export([go/0, go/1, start_link/2, handle_function/2]).
 
--include("thriftTest_types.hrl").
+-include("gen-erl/thriftTest_types.hrl").
 
 -record(options, {port = 9090,
                   server_opts = []}).
diff --git a/lib/erl/test/test_thrift_1151.erl b/lib/erl/test/test_thrift_1151.erl
index 9cee486..8b1d937 100644
--- a/lib/erl/test/test_thrift_1151.erl
+++ b/lib/erl/test/test_thrift_1151.erl
@@ -1,6 +1,6 @@
 -module(test_thrift_1151).
 
--include("thrift1151_types.hrl").
+-include("gen-erl/thrift1151_types.hrl").
 
 -ifdef(TEST).
 -include_lib("eunit/include/eunit.hrl").