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#
19AUTOMAKE_OPTIONS = serial-tests
20
21py_unit_tests = RunClientServer.py
22
23thrift_gen =                                    \
24        gen-py/ThriftTest/__init__.py           \
25        gen-py/DebugProtoTest/__init__.py \
26        gen-py/DoubleConstantsTest/__init__.py \
27        gen-py/Recursive/__init__.py \
28        gen-py-default/ThriftTest/__init__.py           \
29        gen-py-default/DebugProtoTest/__init__.py \
30        gen-py-default/DoubleConstantsTest/__init__.py \
31        gen-py-default/Recursive/__init__.py \
32        gen-py-slots/ThriftTest/__init__.py           \
33        gen-py-slots/DebugProtoTest/__init__.py \
34        gen-py-slots/DoubleConstantsTest/__init__.py \
35        gen-py-slots/Recursive/__init__.py \
36        gen-py-oldstyle/ThriftTest/__init__.py \
37        gen-py-oldstyle/DebugProtoTest/__init__.py \
38        gen-py-oldstyle/DoubleConstantsTest/__init__.py \
39        gen-py-oldstyle/Recursive/__init__.py \
40        gen-py-no_utf8strings/ThriftTest/__init__.py \
41        gen-py-no_utf8strings/DebugProtoTest/__init__.py \
42        gen-py-no_utf8strings/DoubleConstantsTest/__init__.py \
43        gen-py-no_utf8strings/Recursive/__init__.py \
44        gen-py-dynamic/ThriftTest/__init__.py           \
45        gen-py-dynamic/DebugProtoTest/__init__.py \
46        gen-py-dynamic/DoubleConstantsTest/__init__.py \
47        gen-py-dynamic/Recursive/__init__.py \
48        gen-py-dynamicslots/ThriftTest/__init__.py           \
49        gen-py-dynamicslots/DebugProtoTest/__init__.py \
50        gen-py-dynamicslots/DoubleConstantsTest/__init__.py \
51        gen-py-dynamicslots/Recursive/__init__.py
52
53
54precross: $(thrift_gen)
55BUILT_SOURCES = $(thrift_gen)
56
57helper_scripts=                                 \
58        TestClient.py                           \
59        TestServer.py
60
61check_SCRIPTS=                                  \
62        $(thrift_gen) \
63        $(py_unit_tests)                        \
64        $(helper_scripts)
65
66TESTS= $(py_unit_tests)
67
68
69gen-py/%/__init__.py: ../%.thrift $(THRIFT)
70	$(THRIFT) --gen py  $<
71
72gen-py-default/%/__init__.py: ../%.thrift $(THRIFT)
73	test -d gen-py-default || $(MKDIR_P) gen-py-default
74	$(THRIFT) --gen py -out gen-py-default $<
75
76gen-py-slots/%/__init__.py: ../%.thrift $(THRIFT)
77	test -d gen-py-slots || $(MKDIR_P) gen-py-slots
78	$(THRIFT) --gen py:slots -out gen-py-slots $<
79
80gen-py-oldstyle/%/__init__.py: ../%.thrift $(THRIFT)
81	test -d gen-py-oldstyle || $(MKDIR_P) gen-py-oldstyle
82	$(THRIFT) --gen py:old_style -out gen-py-oldstyle $<
83
84gen-py-no_utf8strings/%/__init__.py: ../%.thrift $(THRIFT)
85	test -d gen-py-no_utf8strings || $(MKDIR_P) gen-py-no_utf8strings
86	$(THRIFT) --gen py:no_utf8strings -out gen-py-no_utf8strings $<
87
88gen-py-dynamic/%/__init__.py: ../%.thrift $(THRIFT)
89	test -d gen-py-dynamic || $(MKDIR_P) gen-py-dynamic
90	$(THRIFT) --gen py:dynamic -out gen-py-dynamic $<
91
92gen-py-dynamicslots/%/__init__.py: ../%.thrift $(THRIFT)
93	test -d gen-py-dynamicslots || $(MKDIR_P) gen-py-dynamicslots
94	$(THRIFT) --gen py:dynamic,slots -out gen-py-dynamicslots $<
95
96clean-local:
97	$(RM) -r build
98	find . -type f \( -iname "*.pyc" \) | xargs rm -f
99	find . -type d \( -iname "__pycache__" -or -iname "_trial_temp" \) | xargs rm -rf
100	$(RM) -r gen-py*/
101
102dist-hook:
103	find $(distdir) -type f \( -iname "*.pyc" \) | xargs rm -f
104	find $(distdir) -type d \( -iname "__pycache__" -or -iname "_trial_temp" \) | xargs rm -rf
105	$(RM) -r $(distdir)/gen-py*/
106