David Reiss | ea2cba8 | 2009-03-30 21:35:00 +0000 | [diff] [blame] | 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 | |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 20 | GENDIR=gen |
| 21 | GEN_INCLUDEDIR=$(GENDIR)/include |
| 22 | GEN_SRCDIR=$(GENDIR)/src |
| 23 | GEN_TARGETDIR=$(GENDIR)/ebin |
| 24 | |
| 25 | INCLUDEDIR=include |
| 26 | TARGETDIR=ebin |
| 27 | SRCDIR=src |
| 28 | |
David Reiss | 9f2a5d7 | 2008-06-11 01:15:45 +0000 | [diff] [blame] | 29 | ALL_INCLUDEDIR=$(GEN_INCLUDEDIR) $(INCLUDEDIR) ../../lib/erl/include |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 30 | INCLUDEFLAGS=$(patsubst %,-I%, ${ALL_INCLUDEDIR}) |
| 31 | |
Anthony F. Molinaro | e49a44a | 2011-06-18 06:04:01 +0000 | [diff] [blame] | 32 | MODULES = stress_server test_server test_client test_disklog test_membuffer test_thrift_1151 |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 33 | |
| 34 | INCLUDES = |
| 35 | TARGETS = $(patsubst %,${TARGETDIR}/%.beam,${MODULES}) |
| 36 | HEADERS = $(patsubst %,${INCLUDEDIR}/%.hrl,${INCLUDES}) |
| 37 | |
| 38 | all: ${GEN_TARGETDIR}/ ${TARGETS} |
| 39 | |
David Reiss | 60b50cf | 2008-06-10 22:59:10 +0000 | [diff] [blame] | 40 | TEST_RPCFILE = ../ThriftTest.thrift |
| 41 | STRESS_RPCFILE = ../StressTest.thrift |
Anthony F. Molinaro | e49a44a | 2011-06-18 06:04:01 +0000 | [diff] [blame] | 42 | THRIFT_1151_FILE = src/Thrift1151.thrift |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 43 | THRIFT = ../../compiler/cpp/thrift |
| 44 | |
| 45 | ${GENDIR}/: ${RPCFILE} |
| 46 | rm -rf ${GENDIR} |
David Reiss | b139f64 | 2009-02-17 20:28:46 +0000 | [diff] [blame] | 47 | ${THRIFT} --gen erl ${TEST_RPCFILE} |
| 48 | ${THRIFT} --gen erl ${STRESS_RPCFILE} |
Anthony F. Molinaro | e49a44a | 2011-06-18 06:04:01 +0000 | [diff] [blame] | 49 | ${THRIFT} --gen erl ${THRIFT_1151_FILE} |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 50 | mkdir -p ${GEN_INCLUDEDIR} |
| 51 | mkdir -p ${GEN_SRCDIR} |
| 52 | mkdir -p ${GEN_TARGETDIR} |
Anthony F. Molinaro | 5a9ca88 | 2011-03-24 16:46:22 +0000 | [diff] [blame] | 53 | mv gen-erl/*.hrl ${GEN_INCLUDEDIR} |
| 54 | mv gen-erl/*.erl ${GEN_SRCDIR} |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 55 | rm -rf gen-erl |
| 56 | |
| 57 | ${GEN_TARGETDIR}/: ${GENDIR}/ |
| 58 | rm -rf ${GEN_TARGETDIR} |
| 59 | mkdir -p ${GEN_TARGETDIR} |
David Reiss | bf2b978 | 2010-08-30 22:05:04 +0000 | [diff] [blame] | 60 | erlc ${ERLC_FLAGS} ${INCLUDEFLAGS} -o ${GEN_TARGETDIR} ${GEN_SRCDIR}/*.erl |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 61 | |
| 62 | $(TARGETS): ${TARGETDIR}/%.beam: ${SRCDIR}/%.erl ${GEN_INCLUDEDIR}/ ${HEADERS} |
David Reiss | c85a695 | 2008-06-11 00:56:55 +0000 | [diff] [blame] | 63 | mkdir -p ${TARGETDIR} |
David Reiss | bf2b978 | 2010-08-30 22:05:04 +0000 | [diff] [blame] | 64 | erlc ${ERLC_FLAGS} ${INCLUDEFLAGS} -o ${TARGETDIR} $< |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 65 | |
| 66 | clean: |
| 67 | rm -f ${TARGETDIR}/*.beam |
| 68 | rm -rf ${GENDIR} |