blob: 017cdc1ac3d6351562528012ef7cf2e455a5df4e [file] [log] [blame]
David Reissc0cce962008-06-10 22:58:58 +00001GENDIR=gen
2GEN_INCLUDEDIR=$(GENDIR)/include
3GEN_SRCDIR=$(GENDIR)/src
4GEN_TARGETDIR=$(GENDIR)/ebin
5
6INCLUDEDIR=include
7TARGETDIR=ebin
8SRCDIR=src
9
10ALL_INCLUDEDIR=$(GEN_INCLUDEDIR) $(INCLUDEDIR) ../../lib/erl/include
11INCLUDEFLAGS=$(patsubst %,-I%, ${ALL_INCLUDEDIR})
12
David Reiss60b50cf2008-06-10 22:59:10 +000013MODULES = stress_server test_server
David Reissc0cce962008-06-10 22:58:58 +000014
15INCLUDES =
16TARGETS = $(patsubst %,${TARGETDIR}/%.beam,${MODULES})
17HEADERS = $(patsubst %,${INCLUDEDIR}/%.hrl,${INCLUDES})
18
19all: ${GEN_TARGETDIR}/ ${TARGETS}
20
David Reiss60b50cf2008-06-10 22:59:10 +000021TEST_RPCFILE = ../ThriftTest.thrift
22STRESS_RPCFILE = ../StressTest.thrift
David Reissc0cce962008-06-10 22:58:58 +000023THRIFT = ../../compiler/cpp/thrift
24
25${GENDIR}/: ${RPCFILE}
26 rm -rf ${GENDIR}
David Reiss60b50cf2008-06-10 22:59:10 +000027 ${THRIFT} -alterl ${TEST_RPCFILE}
28 ${THRIFT} -alterl ${STRESS_RPCFILE}
David Reissc0cce962008-06-10 22:58:58 +000029 mkdir -p ${GEN_INCLUDEDIR}
30 mkdir -p ${GEN_SRCDIR}
31 mkdir -p ${GEN_TARGETDIR}
32 mv -t ${GEN_INCLUDEDIR} gen-erl/*.hrl
33 mv -t ${GEN_SRCDIR} gen-erl/*.erl
34 rm -rf gen-erl
35
36${GEN_TARGETDIR}/: ${GENDIR}/
37 rm -rf ${GEN_TARGETDIR}
38 mkdir -p ${GEN_TARGETDIR}
39 erlc ${INCLUDEFLAGS} -o ${GEN_TARGETDIR} ${GEN_SRCDIR}/*.erl
40
41$(TARGETS): ${TARGETDIR}/%.beam: ${SRCDIR}/%.erl ${GEN_INCLUDEDIR}/ ${HEADERS}
David Reissc85a6952008-06-11 00:56:55 +000042 mkdir -p ${TARGETDIR}
David Reissc0cce962008-06-10 22:58:58 +000043 erlc ${INCLUDEFLAGS} -o ${TARGETDIR} $<
44
45clean:
46 rm -f ${TARGETDIR}/*.beam
47 rm -rf ${GENDIR}