blob: bfb1d00529efc865f26bbbbc58e60f12850d0a7f [file] [log] [blame]
David Reissea2cba82009-03-30 21:35:00 +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
David Reissc0cce962008-06-10 22:58:58 +000020GENDIR=gen
21GEN_INCLUDEDIR=$(GENDIR)/include
22GEN_SRCDIR=$(GENDIR)/src
23GEN_TARGETDIR=$(GENDIR)/ebin
24
25INCLUDEDIR=include
26TARGETDIR=ebin
27SRCDIR=src
28
David Reiss9f2a5d72008-06-11 01:15:45 +000029ALL_INCLUDEDIR=$(GEN_INCLUDEDIR) $(INCLUDEDIR) ../../lib/erl/include
David Reissc0cce962008-06-10 22:58:58 +000030INCLUDEFLAGS=$(patsubst %,-I%, ${ALL_INCLUDEDIR})
31
Anthony F. Molinaroe49a44a2011-06-18 06:04:01 +000032MODULES = stress_server test_server test_client test_disklog test_membuffer test_thrift_1151
David Reissc0cce962008-06-10 22:58:58 +000033
34INCLUDES =
35TARGETS = $(patsubst %,${TARGETDIR}/%.beam,${MODULES})
36HEADERS = $(patsubst %,${INCLUDEDIR}/%.hrl,${INCLUDES})
37
38all: ${GEN_TARGETDIR}/ ${TARGETS}
39
David Reiss60b50cf2008-06-10 22:59:10 +000040TEST_RPCFILE = ../ThriftTest.thrift
41STRESS_RPCFILE = ../StressTest.thrift
Anthony F. Molinaroe49a44a2011-06-18 06:04:01 +000042THRIFT_1151_FILE = src/Thrift1151.thrift
David Reissc0cce962008-06-10 22:58:58 +000043THRIFT = ../../compiler/cpp/thrift
44
45${GENDIR}/: ${RPCFILE}
46 rm -rf ${GENDIR}
David Reissb139f642009-02-17 20:28:46 +000047 ${THRIFT} --gen erl ${TEST_RPCFILE}
48 ${THRIFT} --gen erl ${STRESS_RPCFILE}
Anthony F. Molinaroe49a44a2011-06-18 06:04:01 +000049 ${THRIFT} --gen erl ${THRIFT_1151_FILE}
David Reissc0cce962008-06-10 22:58:58 +000050 mkdir -p ${GEN_INCLUDEDIR}
51 mkdir -p ${GEN_SRCDIR}
52 mkdir -p ${GEN_TARGETDIR}
Anthony F. Molinaro5a9ca882011-03-24 16:46:22 +000053 mv gen-erl/*.hrl ${GEN_INCLUDEDIR}
54 mv gen-erl/*.erl ${GEN_SRCDIR}
David Reissc0cce962008-06-10 22:58:58 +000055 rm -rf gen-erl
56
57${GEN_TARGETDIR}/: ${GENDIR}/
58 rm -rf ${GEN_TARGETDIR}
59 mkdir -p ${GEN_TARGETDIR}
David Reissbf2b9782010-08-30 22:05:04 +000060 erlc ${ERLC_FLAGS} ${INCLUDEFLAGS} -o ${GEN_TARGETDIR} ${GEN_SRCDIR}/*.erl
David Reissc0cce962008-06-10 22:58:58 +000061
62$(TARGETS): ${TARGETDIR}/%.beam: ${SRCDIR}/%.erl ${GEN_INCLUDEDIR}/ ${HEADERS}
David Reissc85a6952008-06-11 00:56:55 +000063 mkdir -p ${TARGETDIR}
David Reissbf2b9782010-08-30 22:05:04 +000064 erlc ${ERLC_FLAGS} ${INCLUDEFLAGS} -o ${TARGETDIR} $<
David Reissc0cce962008-06-10 22:58:58 +000065
66clean:
67 rm -f ${TARGETDIR}/*.beam
68 rm -rf ${GENDIR}