blob: 92e2204f67615161051cb0974dc9a9bd7e94d034 [file] [log] [blame]
Bryan Duxbury7173bd92010-05-02 22:54:22 +00001#
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
Anthony F. Molinaro917d8982011-06-21 06:20:18 +000020THRIFT = ../../compiler/cpp/thrift
alisdair sullivan06d0fa02014-08-05 19:54:57 -070021THRIFT_FILES = $(wildcard test/*.thrift) \
David Hullec2a2522017-07-28 02:09:42 +020022 ../../test/ConstantsDemo.thrift \
Nobuaki Sukegawa826ea992015-10-28 22:19:45 +090023 ../../test/NameConflictTest.thrift \
Jens Geyer79f988c2014-10-03 20:42:54 +020024 ../../test/ThriftTest.thrift
Anthony F. Molinaro917d8982011-06-21 06:20:18 +000025
Jens Geyer57ac33e2015-07-28 23:12:10 +020026if ERLANG_OTP16
Nobuaki Sukegawa826ea992015-10-28 22:19:45 +090027ERL_FLAG = erl:otp16
28ERL_FLAG_LEGACY = erl:otp16,legacynames
29# otp16 + maps does not make sense. We need to generate it anyway to avoid include error.
30ERL_FLAG_MAPS = erl:otp16
Jens Geyer57ac33e2015-07-28 23:12:10 +020031else
Nobuaki Sukegawa826ea992015-10-28 22:19:45 +090032ERL_FLAG = erl
33ERL_FLAG_LEGACY = erl:legacynames
34ERL_FLAG_MAPS = erl:maps
35endif
Jens Geyer57ac33e2015-07-28 23:12:10 +020036.generated: $(THRIFT) $(THRIFT_FILES)
37 for f in $(THRIFT_FILES) ; do \
Nobuaki Sukegawa826ea992015-10-28 22:19:45 +090038 $(THRIFT) --gen $(ERL_FLAG) -o test $$f ; \
39 done
40 $(THRIFT) --gen $(ERL_FLAG_LEGACY) -o test test/flags/LegacyNames.thrift
41 $(THRIFT) --gen $(ERL_FLAG_MAPS) -o test test/flags/Thrift3214.thrift
Jens Geyer79f988c2014-10-03 20:42:54 +020042 touch .generated
Anthony F. Molinaro917d8982011-06-21 06:20:18 +000043
44all: .generated
Roger Meierc7b30862015-11-14 10:08:33 +010045 $(REBAR) get-deps
46 $(REBAR) compile
Anthony F. Molinaro917d8982011-06-21 06:20:18 +000047
48check: .generated
Roger Meierc7b30862015-11-14 10:08:33 +010049 $(REBAR) -C rebar.test.config get-deps
50 $(REBAR) -C rebar.test.config compile
51 $(REBAR) -C rebar.test.config skip_deps=true eunit
Bryan Duxbury7173bd92010-05-02 22:54:22 +000052
Bryan Duxbury7173bd92010-05-02 22:54:22 +000053install: all
Jens Geyer79f988c2014-10-03 20:42:54 +020054 mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift) ; \
55 mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/ebin ; \
56 mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/include ; \
57 mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/src ; \
58 for p in ebin/*.app* ebin/*.beam include/*.hrl src/*.erl ; \
59 do $(INSTALL) $$p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/$$p ; \
60 done
Bryan Duxbury7173bd92010-05-02 22:54:22 +000061
62uninstall:
Jens Geyer79f988c2014-10-03 20:42:54 +020063 rm -rf $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)
Bryan Duxbury7173bd92010-05-02 22:54:22 +000064
Anthony F. Molinaro917d8982011-06-21 06:20:18 +000065clean:
Jens Geyer79f988c2014-10-03 20:42:54 +020066 rm -f .generated
67 rm -rf test/gen-erl/
Roger Meierc7b30862015-11-14 10:08:33 +010068 $(REBAR) clean
Anthony F. Molinaroa6530672011-09-18 04:57:50 +000069
70maintainer-clean-local:
Jens Geyer79f988c2014-10-03 20:42:54 +020071 rm -rf ebin
Bryan Duxbury7173bd92010-05-02 22:54:22 +000072
jfarrell8fd8c632014-07-10 09:14:51 -040073EXTRA_DIST = \
Jens Geyer79f988c2014-10-03 20:42:54 +020074 include \
75 src \
jfarrellf13e4312015-08-25 00:39:29 -040076 coding_standards.md \
Jens Geyer79f988c2014-10-03 20:42:54 +020077 rebar.config \
Nobuaki Sukegawae134cbc2016-03-18 15:13:36 +090078 rebar.test.config \
Jens Geyer79f988c2014-10-03 20:42:54 +020079 test \
80 README.md
David Reiss653eada2010-10-05 02:38:58 +000081
Bryan Duxbury7173bd92010-05-02 22:54:22 +000082MAINTAINERCLEANFILES = Makefile.in