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 20THRIFT = ../../compiler/cpp/thrift 21THRIFT_OMIT_FILE = test/Thrift_omit_without.thrift 22THRIFT_FILES = $(wildcard test/*.thrift) \ 23 $(THRIFT_OMIT_FILE) \ 24 ../../test/ConstantsDemo.thrift \ 25 ../../test/NameConflictTest.thrift \ 26 ../../test/DoubleConstantsTest.thrift \ 27 ../../test/ThriftTest.thrift 28 29if ERLANG_OTP16 30ERL_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 34else 35ERL_FLAG = erl 36ERL_FLAG_LEGACY = erl:legacynames 37ERL_FLAG_MAPS = erl:maps 38endif 39 40$(THRIFT_OMIT_FILE): test/Thrift_omit_with.thrift 41 grep -v omit $< >$@ 42 43.generated: $(THRIFT) $(THRIFT_FILES) 44 for f in $(THRIFT_FILES) ; do \ 45 $(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 49 touch .generated 50 51all: .generated 52 $(REBAR) get-deps 53 $(REBAR) compile 54 55check: .generated 56 $(REBAR) -C rebar.test.config get-deps 57 $(REBAR) -C rebar.test.config compile 58 $(REBAR) -C rebar.test.config skip_deps=true eunit 59 60install: all 61 mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift) ; \ 62 mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/ebin ; \ 63 mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/include ; \ 64 mkdir -p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/src ; \ 65 for p in ebin/*.app* ebin/*.beam include/*.hrl src/*.erl ; \ 66 do $(INSTALL) $$p $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift)/$$p ; \ 67 done 68 69uninstall: 70 rm -rf $(DESTDIR)$(ERLANG_INSTALL_LIB_DIR_thrift) 71 72clean: 73 rm -f .generated 74 rm -rf test/gen-erl/ 75 rm -f $(THRIFT_OMIT_FILE) 76 $(REBAR) clean 77 78maintainer-clean-local: 79 rm -rf ebin 80 81EXTRA_DIST = \ 82 include \ 83 src \ 84 coding_standards.md \ 85 rebar.config \ 86 rebar.config.script \ 87 rebar.test.config \ 88 test \ 89 README.md 90 91MAINTAINERCLEANFILES = Makefile.in 92