blob: 17e30da6fa0caa051c6a556d79f5c3abec334852 [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
David Reissbfc57a02009-03-30 20:46:37 +000032MODULES = stress_server test_server test_disklog test_membuffer
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
David Reissc0cce962008-06-10 22:58:58 +000042THRIFT = ../../compiler/cpp/thrift
43
44${GENDIR}/: ${RPCFILE}
45 rm -rf ${GENDIR}
David Reissb139f642009-02-17 20:28:46 +000046 ${THRIFT} --gen erl ${TEST_RPCFILE}
47 ${THRIFT} --gen erl ${STRESS_RPCFILE}
David Reissc0cce962008-06-10 22:58:58 +000048 mkdir -p ${GEN_INCLUDEDIR}
49 mkdir -p ${GEN_SRCDIR}
50 mkdir -p ${GEN_TARGETDIR}
51 mv -t ${GEN_INCLUDEDIR} gen-erl/*.hrl
52 mv -t ${GEN_SRCDIR} gen-erl/*.erl
53 rm -rf gen-erl
54
55${GEN_TARGETDIR}/: ${GENDIR}/
56 rm -rf ${GEN_TARGETDIR}
57 mkdir -p ${GEN_TARGETDIR}
58 erlc ${INCLUDEFLAGS} -o ${GEN_TARGETDIR} ${GEN_SRCDIR}/*.erl
59
60$(TARGETS): ${TARGETDIR}/%.beam: ${SRCDIR}/%.erl ${GEN_INCLUDEDIR}/ ${HEADERS}
David Reissc85a6952008-06-11 00:56:55 +000061 mkdir -p ${TARGETDIR}
David Reissc0cce962008-06-10 22:58:58 +000062 erlc ${INCLUDEFLAGS} -o ${TARGETDIR} $<
63
64clean:
65 rm -f ${TARGETDIR}/*.beam
66 rm -rf ${GENDIR}