THRIFT-3742 haxe php cli support
Client: Haxe
Patch: Oleksii Prudkyi + minor changes from Jens Geyer

This closes #950
diff --git a/tutorial/haxe/Makefile.am b/tutorial/haxe/Makefile.am
index c3c5204..139bccb 100644
--- a/tutorial/haxe/Makefile.am
+++ b/tutorial/haxe/Makefile.am
@@ -18,11 +18,13 @@
 #
 
 THRIFT = $(top_builddir)/compiler/cpp/thrift
+BIN_PHP = bin/php/Main-debug.php
+
 
 gen-haxe/tutorial/calculator.hx gen-haxe/shared/shared_service.hx: $(top_srcdir)/tutorial/tutorial.thrift
 	$(THRIFT) --gen haxe -r $<
 
-all-local: bin/Main-debug
+all-local: bin/Main-debug $(BIN_PHP)
 
 check: gen-haxe/tutorial/calculator.hx
 
@@ -32,18 +34,36 @@
 		gen-haxe/tutorial/calculator.hx
 	$(HAXE) --cwd .  cpp.hxml
 
+$(BIN_PHP): \
+		src/*.hx \
+		../../lib/haxe/src/org/apache/thrift/**/*.hx \
+		gen-haxe/tutorial/calculator.hx
+	$(HAXE) --cwd .  php.hxml
+
 tutorialserver: all
 	bin/Main-debug server
 
+tutorialserver_php: all
+	php -f $(BIN_PHP) server
+
 tutorialclient: all
 	bin/Main-debug
 
+tutorialclient_php: all
+	php -f $(BIN_PHP) 
+
 tutorialsecureserver: all
 	bin/Main-debug server secure
 
+tutorialsecureserver_php: all
+	php -f $(BIN_PHP) server secure
+
 tutorialsecureclient: all
 	bin/Main-debug secure
 
+tutorialsecureclient_php: all
+	php -f $(BIN_PHP) secure
+
 clean-local:
 	$(RM) -r gen-haxe bin
 
diff --git a/tutorial/haxe/php.hxml b/tutorial/haxe/php.hxml
index 1eaac8b..c2f6887 100644
--- a/tutorial/haxe/php.hxml
+++ b/tutorial/haxe/php.hxml
@@ -26,7 +26,8 @@
 -main Main
 
 #PHP target
--php bin/Tutorial.php
+-php bin/php/
+--php-front Main-debug.php
 
 #Add debug information
 -debug
@@ -35,4 +36,4 @@
 #"-dce no" : do not remove unused code
 #"-dce std" : remove unused code in the std lib (default)
 #"-dce full" : remove all unused code
--dce full
\ No newline at end of file
+-dce full