THRIFT-3400 Add Erlang to cross test
Client: Test, Erlang
Patch: Nobuaki Sukegawa
diff --git a/lib/erl/Makefile.am b/lib/erl/Makefile.am
index f577a63..21d21bf 100644
--- a/lib/erl/Makefile.am
+++ b/lib/erl/Makefile.am
@@ -19,21 +19,26 @@
 
 THRIFT = ../../compiler/cpp/thrift
 THRIFT_FILES = $(wildcard test/*.thrift) \
+		  ../../test/NameConflictTest.thrift \
 		  ../../test/ThriftTest.thrift
 
 if ERLANG_OTP16
-.generated: $(THRIFT) $(THRIFT_FILES)
-	for f in $(THRIFT_FILES) ; do \
-		$(THRIFT) --gen erl:otp16 -o test $$f ; \
-	done ;
+ERL_FLAG = erl:otp16
+ERL_FLAG_LEGACY = erl:otp16,legacynames
+# otp16 + maps does not make sense. We need to generate it anyway to avoid include error.
+ERL_FLAG_MAPS = erl:otp16
 else
+ERL_FLAG = erl
+ERL_FLAG_LEGACY = erl:legacynames
+ERL_FLAG_MAPS = erl:maps
+endif
 .generated: $(THRIFT) $(THRIFT_FILES)
 	for f in $(THRIFT_FILES) ; do \
-		$(THRIFT) --gen erl -o test $$f ; \
-	done ; \
-	$(THRIFT) --gen erl:maps -o test test/Thrift3214.thrift ; \
+		$(THRIFT) --gen $(ERL_FLAG) -o test $$f ; \
+	done
+	$(THRIFT) --gen $(ERL_FLAG_LEGACY) -o test test/flags/LegacyNames.thrift
+	$(THRIFT) --gen $(ERL_FLAG_MAPS) -o test test/flags/Thrift3214.thrift
 	touch .generated
-endif
 
 all: .generated
 	./rebar get-deps