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
20ACLOCAL_AMFLAGS = -I ./aclocal
21
22SUBDIRS = compiler/cpp lib
23
24if WITH_TESTS
25SUBDIRS += test
26endif
27
28if WITH_TUTORIAL
29SUBDIRS += tutorial
30endif
31
32clean-local:
33	$(RM) -r vendor/
34
35distclean-local:
36	$(RM) -r .dub/
37	$(RM) -r autom4te.cache/
38
39CLEANFILES = \
40	composer.lock \
41	dub.selections.json
42
43DISTCLEANFILES = \
44	Makefile \
45	Makefile.in \
46	aclocal.m4 \
47	apache-thrift-test-library \
48	autoscan.log \
49	compile \
50	config.guess \
51	config.hin \
52	config.hin~ \
53	config.log \
54	config.status \
55	config.sub \
56	configure \
57	configure.scan \
58    debcomp \
59    install-sh \
60    ltmain.sh \
61    missing \
62    ylwrap
63
64dist-hook:
65	find $(distdir) -type f \( -iname ".DS_Store" -or -iname "._*" -or -iname ".gitignore" \) | xargs rm -f
66	find $(distdir) -type d \( -iname ".deps" -or -iname ".libs" \) | xargs rm -rf
67	find $(distdir) -type d \( -iname ".svn" -or -iname ".git" \) | xargs rm -rf
68
69print-version:
70	@echo $(PACKAGE_VERSION)
71
72.PHONY: precross cross
73precross-%: all
74	$(MAKE) -C $* precross
75precross: all precross-test precross-lib
76
77empty :=
78space := $(empty) $(empty)
79comma := ,
80
81CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_CL@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@ @MAYBE_RS@ @MAYBE_NETSTD@ @MAYBE_NODETS@ @MAYBE_KOTLIN@ @MAYBE_SWIFT@
82CROSS_LANGS_COMMA_SEPARATED = $(subst $(space),$(comma),$(CROSS_LANGS))
83
84if WITH_PY3
85CROSS_PY=$(PYTHON3)
86else
87CROSS_PY=$(PYTHON)
88endif
89
90if WITH_PYTHON
91crossfeature: precross
92	$(CROSS_PY) test/test.py --retry-count 5 --features .* --skip-known-failures --server $(CROSS_LANGS_COMMA_SEPARATED)
93else
94# feature test needs python build
95crossfeature:
96endif
97
98cross-%: precross crossfeature
99	$(CROSS_PY) test/test.py --retry-count 5 --skip-known-failures --server $(CROSS_LANGS_COMMA_SEPARATED) --client $(CROSS_LANGS_COMMA_SEPARATED) --regex "$*"
100
101cross: cross-.*
102
103TIMES = 1 2 3
104fail: precross
105	$(CROSS_PY) test/test.py || true
106	$(CROSS_PY) test/test.py --update-expected-failures=overwrite
107	$(foreach var,$(TIMES),test/test.py -s || true;test/test.py --update-expected-failures=merge;)
108
109codespell_skip_files = \
110	*.jar \
111	*.class \
112	*.so \
113	*.a \
114	*.la \
115	*.o \
116	*.p12 \
117	*OCamlMakefile \
118	.keystore \
119	.truststore \
120	CHANGES \
121	config.sub \
122	configure \
123	depcomp \
124	libtool.m4 \
125	output.* \
126	rebar \
127	thrift
128
129skipped_files = $(subst $(space),$(comma),$(codespell_skip_files))
130
131style-local:
132	codespell --write-changes --skip=$(skipped_files) --disable-colors
133
134EXTRA_DIST = \
135	.asf.yaml \
136	.clang-format \
137	.dockerignore \
138	.editorconfig \
139	.eslintignore \
140	.eslintrc.json \
141	.flake8 \
142	.gitattributes \
143	.gitignore \
144	.travis.yml \
145	ApacheThrift.nuspec \
146	appveyor.yml \
147	bootstrap.sh \
148	bower.json \
149	build \
150	CHANGES.md \
151	CMakeLists.txt \
152	composer.json \
153	contrib \
154	CONTRIBUTING.md \
155	debian \
156	doap.rdf \
157	doc \
158	dub.json \
159	go.mod \
160	jitpack.yml \
161	LANGUAGES.md \
162	LICENSE \
163	NOTICE \
164	package.json \
165	package-lock.json \
166	phpcs.xml.dist \
167	README.md \
168	rust-toolchain \
169	sonar-project.properties \
170	Thrift.podspec
171