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
20DESTDIR ?= /
21
22if WITH_PY3
23py3-build:
24	$(PYTHON3) setup.py build
25py3-test: py3-build
26	$(PYTHON3) test/thrift_json.py
27	$(PYTHON3) test/thrift_transport.py
28	$(PYTHON3) test/test_sslsocket.py
29	$(PYTHON3) test/thrift_TBinaryProtocol.py
30	$(PYTHON3) test/thrift_TZlibTransport.py
31	$(PYTHON3) test/thrift_TCompactProtocol.py
32	$(PYTHON3) test/thrift_TNonblockingServer.py
33	$(PYTHON3) test/thrift_TSerializer.py
34else
35py3-build:
36py3-test:
37endif
38
39all-local: py3-build
40	$(PYTHON) setup.py build
41	${THRIFT} --gen py test/test_thrift_file/TestServer.thrift
42
43# We're ignoring prefix here because site-packages seems to be
44# the equivalent of /usr/local/lib in Python land.
45# Old version (can't put inline because it's not portable).
46#$(PYTHON) setup.py install --prefix=$(prefix) --root=$(DESTDIR) $(PYTHON_SETUPUTIL_ARGS)
47install-exec-hook:
48	$(PYTHON) setup.py install --root=$(DESTDIR) --prefix=$(PY_PREFIX) $(PYTHON_SETUPUTIL_ARGS)
49
50check-local: all py3-test
51	$(PYTHON) test/thrift_json.py
52	$(PYTHON) test/thrift_transport.py
53	$(PYTHON) test/test_sslsocket.py
54	$(PYTHON) test/test_socket.py
55	$(PYTHON) test/thrift_TBinaryProtocol.py
56	$(PYTHON) test/thrift_TZlibTransport.py
57	$(PYTHON) test/thrift_TCompactProtocol.py
58	$(PYTHON) test/thrift_TNonblockingServer.py
59	$(PYTHON) test/thrift_TSerializer.py
60
61
62clean-local:
63	$(RM) -r build
64	$(RM) -r gen-py
65	find . -type f \( -iname "*.pyc" \) | xargs rm -f
66	find . -type d \( -iname "__pycache__" -or -iname "_trial_temp" \) | xargs rm -rf
67
68dist-hook:
69	find $(distdir) -type f \( -iname "*.pyc" \) | xargs rm -f
70	find $(distdir) -type d \( -iname "__pycache__" -or -iname "_trial_temp" \) | xargs rm -rf
71
72EXTRA_DIST = \
73	CMakeLists.txt \
74	MANIFEST.in \
75	coding_standards.md \
76	compat \
77	setup.py \
78	setup.cfg \
79	src \
80	test \
81	README.md
82