David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 1 | GENDIR=gen |
| 2 | GEN_INCLUDEDIR=$(GENDIR)/include |
| 3 | GEN_SRCDIR=$(GENDIR)/src |
| 4 | GEN_TARGETDIR=$(GENDIR)/ebin |
| 5 | |
| 6 | INCLUDEDIR=include |
| 7 | TARGETDIR=ebin |
| 8 | SRCDIR=src |
| 9 | |
| 10 | ALL_INCLUDEDIR=$(GEN_INCLUDEDIR) $(INCLUDEDIR) ../../lib/erl/include |
| 11 | INCLUDEFLAGS=$(patsubst %,-I%, ${ALL_INCLUDEDIR}) |
| 12 | |
David Reiss | 60b50cf | 2008-06-10 22:59:10 +0000 | [diff] [blame] | 13 | MODULES = stress_server test_server |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 14 | |
| 15 | INCLUDES = |
| 16 | TARGETS = $(patsubst %,${TARGETDIR}/%.beam,${MODULES}) |
| 17 | HEADERS = $(patsubst %,${INCLUDEDIR}/%.hrl,${INCLUDES}) |
| 18 | |
| 19 | all: ${GEN_TARGETDIR}/ ${TARGETS} |
| 20 | |
David Reiss | 60b50cf | 2008-06-10 22:59:10 +0000 | [diff] [blame] | 21 | TEST_RPCFILE = ../ThriftTest.thrift |
| 22 | STRESS_RPCFILE = ../StressTest.thrift |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 23 | THRIFT = ../../compiler/cpp/thrift |
| 24 | |
| 25 | ${GENDIR}/: ${RPCFILE} |
| 26 | rm -rf ${GENDIR} |
David Reiss | 60b50cf | 2008-06-10 22:59:10 +0000 | [diff] [blame] | 27 | ${THRIFT} -alterl ${TEST_RPCFILE} |
| 28 | ${THRIFT} -alterl ${STRESS_RPCFILE} |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 29 | 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 Reiss | c85a695 | 2008-06-11 00:56:55 +0000 | [diff] [blame^] | 42 | mkdir -p ${TARGETDIR} |
David Reiss | c0cce96 | 2008-06-10 22:58:58 +0000 | [diff] [blame] | 43 | erlc ${INCLUDEFLAGS} -o ${TARGETDIR} $< |
| 44 | |
| 45 | clean: |
| 46 | rm -f ${TARGETDIR}/*.beam |
| 47 | rm -rf ${GENDIR} |