1#
2# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10#   http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
18#
19
20THRIFTCMD = $(THRIFT) --gen haxe -r
21THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift
22
23BIN_CPP = bin/Main-debug
24BIN_PHP = bin/php/Main-debug.php
25BIN_PHP_WEB = bin/php-web-server/Main-debug.php
26
27gen-haxe/thrift/test/ThriftTest.hx: $(THRIFTTEST)
28	$(THRIFTCMD) $(THRIFTTEST)
29
30all-local: $(BIN_CPP) $(BIN_PHP) $(BIN_PHP_WEB)
31
32$(BIN_CPP): \
33		src/*.hx \
34		../../lib/haxe/src/org/apache/thrift/**/*.hx \
35		gen-haxe/thrift/test/ThriftTest.hx
36	$(HAXE) --cwd .  cpp.hxml
37
38$(BIN_PHP): \
39		src/*.hx \
40		../../lib/haxe/src/org/apache/thrift/**/*.hx \
41		gen-haxe/thrift/test/ThriftTest.hx
42	$(HAXE) --cwd .  php.hxml
43
44$(BIN_PHP_WEB): \
45		src/*.hx \
46		../../lib/haxe/src/org/apache/thrift/**/*.hx \
47		gen-haxe/thrift/test/ThriftTest.hx
48	$(HAXE) --cwd .  php-web-server.hxml
49
50
51
52#TODO: other haxe targets
53#    $(HAXE)  --cwd .  csharp
54#    $(HAXE)  --cwd .  flash
55#    $(HAXE)  --cwd .  java
56#    $(HAXE)  --cwd .  javascript
57#    $(HAXE)  --cwd .  neko
58#    $(HAXE)  --cwd .  python  # needs Haxe 3.2.0
59
60
61clean-local:
62	$(RM) -r gen-haxe bin
63
64.NOTPARALLEL:
65
66check: check_cpp \
67	check_php \
68	check_php_web
69
70check_cpp: $(BIN_CPP)
71	timeout 20 $(BIN_CPP) server &
72	sleep 1
73	$(BIN_CPP) client
74	sleep 10
75
76check_php: $(BIN_PHP)
77	timeout 20 php -f $(BIN_PHP) server &
78	sleep 1
79	php -f $(BIN_PHP) client
80	sleep 10
81
82check_php_web: $(BIN_PHP_WEB) $(BIN_CPP)
83	timeout 20 php -S 127.0.0.1:9090 router.php &
84	sleep 1
85	$(BIN_CPP) client --transport http
86	sleep 10
87
88
89EXTRA_DIST = \
90	src \
91	cpp.hxml \
92	csharp.hxml \
93	flash.hxml \
94	java.hxml \
95	javascript.hxml \
96	neko.hxml \
97	php.hxml \
98	python.hxml \
99	router.php \
100	project.hide \
101	php-web-server.hxml \
102	TestClientServer.hxproj \
103	make_all.bat \
104	make_all.sh
105