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 | |
David Reiss | 2c8d228 | 2010-08-30 22:05:39 +0000 | [diff] [blame] | 32 | MODULES = stress_server test_server test_client test_disklog test_membuffer |
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 |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 42 | THRIFT = ../../compiler/cpp/thrift |
| 43 | |
| 44 | ${GENDIR}/: ${RPCFILE} |
| 45 | rm -rf ${GENDIR} |
David Reiss | b139f64 | 2009-02-17 20:28:46 +0000 | [diff] [blame] | 46 | ${THRIFT} --gen erl ${TEST_RPCFILE} |
| 47 | ${THRIFT} --gen erl ${STRESS_RPCFILE} |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 48 | 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} |
David Reiss | bf2b978 | 2010-08-30 22:05:04 +0000 | [diff] [blame] | 58 | erlc ${ERLC_FLAGS} ${INCLUDEFLAGS} -o ${GEN_TARGETDIR} ${GEN_SRCDIR}/*.erl |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 59 | |
| 60 | $(TARGETS): ${TARGETDIR}/%.beam: ${SRCDIR}/%.erl ${GEN_INCLUDEDIR}/ ${HEADERS} |
David Reiss | c85a695 | 2008-06-11 00:56:55 +0000 | [diff] [blame] | 61 | mkdir -p ${TARGETDIR} |
David Reiss | bf2b978 | 2010-08-30 22:05:04 +0000 | [diff] [blame] | 62 | erlc ${ERLC_FLAGS} ${INCLUDEFLAGS} -o ${TARGETDIR} $< |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 63 | |
| 64 | clean: |
| 65 | rm -f ${TARGETDIR}/*.beam |
| 66 | rm -rf ${GENDIR} |