Makefile
author Matthias Radestock <matthias@lshift.net>
Thu Jan 08 14:41:54 2009 +0000 (2009-01-08)
changeset 205 3c6f7b5e67ae
parent 147 d9cf040e181c
child 223 8d46eb0fbbaa
child 241 b2a67614f099
child 247 512389202536
permissions -rw-r--r--
merge bug19964 into default
     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/
     5 #
     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
     9 #   under the License.
    10 #
    11 #   The Original Code is the RabbitMQ Erlang Client.
    12 #
    13 #   The Initial Developers of the Original Code are LShift Ltd.,
    14 #   Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.
    15 #
    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 
    19 #   Technologies Ltd.; 
    20 #
    21 #   All Rights Reserved.
    22 #
    23 #   Contributor(s): Ben Hood <0x6e6562@gmail.com>.
    24 #
    25 
    26 EBIN_DIR=ebin
    27 SOURCE_DIR=src
    28 INCLUDE_DIR=include
    29 DIST_DIR=rabbitmq-erlang-client
    30 
    31 LOAD_PATH=ebin rabbitmq_server/ebin
    32 
    33 INCLUDES=$(wildcard $(INCLUDE_DIR)/*.hrl)
    34 SOURCES=$(wildcard $(SOURCE_DIR)/*.erl)
    35 TARGETS=$(patsubst $(SOURCE_DIR)/%.erl, $(EBIN_DIR)/%.beam,$(SOURCES))
    36 
    37 ERLC_OPTS=-I $(INCLUDE_DIR) -o $(EBIN_DIR) -Wall -v +debug_info
    38 
    39 BROKER_DIR=../rabbitmq-server
    40 BROKER_SYMLINK=rabbitmq_server
    41 
    42 NODENAME=rabbit_test_direct
    43 MNESIA_DIR=/tmp/rabbitmq_$(NODENAME)_mnesia
    44 LOG_BASE=/tmp
    45 
    46 ERL_CALL=erl_call -sname $(NODENAME) -e
    47 
    48 all: $(EBIN_DIR) $(TARGETS)
    49 
    50 $(BROKER_SYMLINK):
    51 ifdef BROKER_DIR
    52 	ln -sf $(BROKER_DIR) $(BROKER_SYMLINK)
    53 endif
    54 
    55 $(EBIN_DIR):
    56 	mkdir -p $@
    57 
    58 $(EBIN_DIR)/%.beam: $(SOURCE_DIR)/%.erl $(INCLUDES) $(BROKER_SYMLINK)
    59 	erlc $(ERLC_OPTS) $<
    60 
    61 run_server:
    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
    64 
    65 all_tests: test_network test_network_coverage test_direct test_direct_coverage
    66 	$(ERL_CALL) -q
    67 
    68 tests_network: test_network test_network_coverage
    69 	$(ERL_CALL) -q
    70 
    71 test_network: $(TARGETS)
    72 	erl -pa $(LOAD_PATH) -noshell -eval 'network_client_test:test(),halt().'
    73 
    74 test_network_coverage: $(TARGETS)
    75 	erl -pa $(LOAD_PATH) -noshell -eval 'network_client_test:test_coverage(),halt().'
    76 
    77 tests_direct: test_direct test_direct_coverage
    78 	$(ERL_CALL) -q
    79 	rm -rf $(MNESIA_DIR)
    80 
    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().'
    86 
    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().'
    92 
    93 clean:
    94 	rm -f $(EBIN_DIR)/*.beam
    95 	rm -f rabbitmq_server erl_crash.dump
    96 	rm -fr cover dist
    97 
    98 source-tarball:
    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)
   102