1 # The contents of this file are subject to the Mozilla Public License
2 # Version 1.1 (the "License"); you may not use this file except in
3 # compliance with the License. You may obtain a copy of the License at
4 # http://www.mozilla.org/MPL/
6 # Software distributed under the License is distributed on an "AS IS"
7 # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
8 # License for the specific language governing rights and limitations
11 # The Original Code is the RabbitMQ Erlang Client.
13 # The Initial Developers of the Original Code are LShift Ltd.,
14 # Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.
16 # Portions created by LShift Ltd., Cohesive Financial
17 # Technologies LLC., and Rabbit Technologies Ltd. are Copyright (C)
18 # 2007 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit
21 # All Rights Reserved.
23 # Contributor(s): Ben Hood <0x6e6562@gmail.com>.
29 DIST_DIR=rabbitmq-erlang-client
31 LOAD_PATH=ebin rabbitmq_server/ebin
33 INCLUDES=$(wildcard $(INCLUDE_DIR)/*.hrl)
34 SOURCES=$(wildcard $(SOURCE_DIR)/*.erl)
35 TARGETS=$(patsubst $(SOURCE_DIR)/%.erl, $(EBIN_DIR)/%.beam,$(SOURCES))
37 ERLC_OPTS=-I $(INCLUDE_DIR) -o $(EBIN_DIR) -Wall -v +debug_info
39 BROKER_DIR=../rabbitmq-server
40 BROKER_SYMLINK=rabbitmq_server
42 NODENAME=rabbit_test_direct
43 MNESIA_DIR=/tmp/rabbitmq_$(NODENAME)_mnesia
46 ERL_CALL=erl_call -sname $(NODENAME) -e
48 all: $(EBIN_DIR) $(TARGETS)
52 ln -sf $(BROKER_DIR) $(BROKER_SYMLINK)
58 $(EBIN_DIR)/%.beam: $(SOURCE_DIR)/%.erl $(INCLUDES) $(BROKER_SYMLINK)
62 NODE_IP_ADDRESS=$(NODE_IP_ADDRESS) NODE_PORT=$(NODE_PORT) NODE_ONLY=true LOG_BASE=$(LOG_BASE) RABBIT_ARGS="$(RABBIT_ARGS) -s rabbit" MNESIA_DIR=$(MNESIA_DIR) $(BROKER_DIR)/scripts/rabbitmq-server
63 sleep 2 # so that the node is initialized when the tests are run
65 all_tests: test_network test_network_coverage test_direct test_direct_coverage
68 tests_network: test_network test_network_coverage
71 test_network: $(TARGETS)
72 erl -pa $(LOAD_PATH) -noshell -eval 'network_client_test:test(),halt().'
74 test_network_coverage: $(TARGETS)
75 erl -pa $(LOAD_PATH) -noshell -eval 'network_client_test:test_coverage(),halt().'
77 tests_direct: test_direct test_direct_coverage
81 test_direct: $(TARGETS)
82 erl -pa $(LOAD_PATH) -noshell -mnesia dir tmp -boot start_sasl -s rabbit -noshell \
83 -sasl sasl_error_logger '{file, "'${LOG_BASE}'/rabbit-sasl.log"}' \
84 -kernel error_logger '{file, "'${LOG_BASE}'/rabbit.log"}' \
85 -eval 'direct_client_test:test(),halt().'
87 test_direct_coverage: $(TARGETS)
88 erl -pa $(LOAD_PATH) -noshell -mnesia dir tmp -boot start_sasl -s rabbit -noshell \
89 -sasl sasl_error_logger '{file, "'${LOG_BASE}'/rabbit-sasl.log"}' \
90 -kernel error_logger '{file, "'${LOG_BASE}'/rabbit.log"}' \
91 -eval 'direct_client_test:test_coverage(),halt().'
94 rm -f $(EBIN_DIR)/*.beam
95 rm -f rabbitmq_server erl_crash.dump
99 mkdir -p dist/$(DIST_DIR)
100 cp -a README Makefile src include dist/$(DIST_DIR)
101 cd dist ; tar cvzf $(DIST_DIR).tar.gz $(DIST_DIR)