blob: d4544a3392a67706d08ac470524ea196d71298ba [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
David Hulle544a892017-07-27 02:15:00 +020021THRIFT_OMIT_FILE = test/Thrift_omit_without.thrift
alisdair sullivan06d0fa02014-08-05 19:54:57 -070022THRIFT_FILES = $(wildcard test/*.thrift) \
David Hulle544a892017-07-27 02:15:00 +020023 $(THRIFT_OMIT_FILE) \
David Hullec2a2522017-07-28 02:09:42 +020024 ../../test/ConstantsDemo.thrift \
Nobuaki Sukegawa826ea992015-10-28 22:19:45 +090025 ../../test/NameConflictTest.thrift \
Ozan Can Altioke46419b2018-03-20 15:02:28 +030026 ../../test/DoubleConstantsTest.thrift \
Jens Geyer79f988c2014-10-03 20:42:54 +020027 ../../test/ThriftTest.thrift
Anthony F. Molinaro917d8982011-06-21 06:20:18 +000028
Jens Geyer57ac33e2015-07-28 23:12:10 +020029if ERLANG_OTP16
Nobuaki Sukegawa826ea992015-10-28 22:19:45 +090030ERL_FLAG = erl:otp16
31ERL_FLAG_LEGACY = erl:otp16,legacynames
32# otp16 + maps does not make sense. We need to generate it anyway to avoid include error.
33ERL_FLAG_MAPS = erl:otp16
Jens Geyer57ac33e2015-07-28 23:12:10 +020034else
Nobuaki Sukegawa826ea992015-10-28 22:19:45 +090035ERL_FLAG = erl
36ERL_FLAG_LEGACY = erl:legacynames
37ERL_FLAG_MAPS = erl:maps
38endif
David Hulle544a892017-07-27 02:15:00 +020039
40$(THRIFT_OMIT_FILE): test/Thrift_omit_with.thrift
41 grep -v omit $< >$@
42
Jens Geyer57ac33e2015-07-28 23:12:10 +020043.generated: $(THRIFT) $(THRIFT_FILES)
44 for f in $(THRIFT_FILES) ; do \
Nobuaki Sukegawa826ea992015-10-28 22:19:45 +090045 $(THRIFT) --gen $(ERL_FLAG) -o test $$f ; \
46 done
47 $(THRIFT) --gen $(ERL_FLAG_LEGACY) -o test test/flags/LegacyNames.thrift
48 $(THRIFT) --gen $(ERL_FLAG_MAPS) -o test test/flags/Thrift3214.thrift
Jens Geyer79f988c2014-10-03 20:42:54 +020049 touch .generated
Anthony F. Molinaro917d8982011-06-21 06:20:18 +000050
51all: .generated
Roger Meierc7b30862015-11-14 10:08:33 +010052 $(REBAR) compile
Anthony F. Molinaro917d8982011-06-21 06:20:18 +000053
54check: .generated
Sergey Yelin4ffe7632019-04-18 17:27:46 +030055 $(REBAR) eunit
Bryan Duxbury7173bd92010-05-02 22:54:22 +000056
Bryan Duxbury7173bd92010-05-02 22:54:22 +000057install: all
Jens Geyer79f988c2014-10-03 20:42:54 +020058 mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift) ; \
59 mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/ebin ; \
60 mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/include ; \
61 mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/src ; \
62 for p in ebin/*.app* ebin/*.beam include/*.hrl src/*.erl ; \
63 do $(INSTALL) $$p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/$$p ; \
64 done
Bryan Duxbury7173bd92010-05-02 22:54:22 +000065
66uninstall:
James E. King IIIb96c4382019-01-24 17:45:07 -050067 $(RM) -rf $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)
Bryan Duxbury7173bd92010-05-02 22:54:22 +000068
James E. King IIIb96c4382019-01-24 17:45:07 -050069clean-local:
Roger Meierc7b30862015-11-14 10:08:33 +010070 $(REBAR) clean
James E. King IIIb96c4382019-01-24 17:45:07 -050071 $(RM) .generated
72 $(RM) -r .rebar/
Sergey Yelin4ffe7632019-04-18 17:27:46 +030073 $(RM) -r _build/
James E. King IIIb96c4382019-01-24 17:45:07 -050074 $(RM) -r test/gen-erl/
75 $(RM) $(THRIFT_OMIT_FILE)
Anthony F. Molinaroa6530672011-09-18 04:57:50 +000076
77maintainer-clean-local:
James E. King IIIb96c4382019-01-24 17:45:07 -050078 $(RM) -r ebin/
79
80dist-hook:
81 $(RM) $(distdir)/.generated
82 $(RM) -r $(distdir)/.rebar/
Sergey Yelin4ffe7632019-04-18 17:27:46 +030083 $(RM) -r $(distdir)/_build/
James E. King IIIb96c4382019-01-24 17:45:07 -050084 $(RM) -r $(distdir)/ebin/
85 $(RM) -r $(distdir)/test/gen-erl/
86 $(RM) $(distdir)/$(THRIFT_OMIT_FILE)
Bryan Duxbury7173bd92010-05-02 22:54:22 +000087
jfarrell8fd8c632014-07-10 09:14:51 -040088EXTRA_DIST = \
Jens Geyer79f988c2014-10-03 20:42:54 +020089 include \
90 src \
jfarrellf13e4312015-08-25 00:39:29 -040091 coding_standards.md \
Jens Geyer79f988c2014-10-03 20:42:54 +020092 rebar.config \
Jens Geyerf3a29742017-11-30 22:30:03 +010093 rebar.config.script \
Jens Geyer79f988c2014-10-03 20:42:54 +020094 test \
95 README.md
David Reiss653eada2010-10-05 02:38:58 +000096
Bryan Duxbury7173bd92010-05-02 22:54:22 +000097MAINTAINERCLEANFILES = Makefile.in