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
simon@32
     1
#   The contents of this file are subject to the Mozilla Public License
simon@32
     2
#   Version 1.1 (the "License"); you may not use this file except in
simon@32
     3
#   compliance with the License. You may obtain a copy of the License at
simon@32
     4
#   http://www.mozilla.org/MPL/
simon@32
     5
#
simon@32
     6
#   Software distributed under the License is distributed on an "AS IS"
simon@32
     7
#   basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
simon@32
     8
#   License for the specific language governing rights and limitations
simon@32
     9
#   under the License.
simon@32
    10
#
simon@32
    11
#   The Original Code is the RabbitMQ Erlang Client.
simon@32
    12
#
simon@32
    13
#   The Initial Developers of the Original Code are LShift Ltd.,
simon@32
    14
#   Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.
simon@32
    15
#
simon@32
    16
#   Portions created by LShift Ltd., Cohesive Financial
simon@32
    17
#   Technologies LLC., and Rabbit Technologies Ltd. are Copyright (C) 
simon@32
    18
#   2007 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit 
simon@32
    19
#   Technologies Ltd.; 
simon@32
    20
#
simon@32
    21
#   All Rights Reserved.
simon@32
    22
#
simon@32
    23
#   Contributor(s): Ben Hood <0x6e6562@gmail.com>.
simon@32
    24
#
simon@32
    25
0x6e6562@2
    26
EBIN_DIR=ebin
0x6e6562@1
    27
SOURCE_DIR=src
0x6e6562@1
    28
INCLUDE_DIR=include
simon@31
    29
DIST_DIR=rabbitmq-erlang-client
0x6e6562@1
    30
0x6e6562@138
    31
LOAD_PATH=ebin rabbitmq_server/ebin
0x6e6562@138
    32
0x6e6562@138
    33
INCLUDES=$(wildcard $(INCLUDE_DIR)/*.hrl)
0x6e6562@138
    34
SOURCES=$(wildcard $(SOURCE_DIR)/*.erl)
0x6e6562@138
    35
TARGETS=$(patsubst $(SOURCE_DIR)/%.erl, $(EBIN_DIR)/%.beam,$(SOURCES))
0x6e6562@138
    36
0x6e6562@139
    37
ERLC_OPTS=-I $(INCLUDE_DIR) -o $(EBIN_DIR) -Wall -v +debug_info
0x6e6562@138
    38
0x6e6562@138
    39
BROKER_DIR=../rabbitmq-server
0x6e6562@138
    40
BROKER_SYMLINK=rabbitmq_server
0x6e6562@138
    41
adrian@65
    42
NODENAME=rabbit_test_direct
adrian@65
    43
MNESIA_DIR=/tmp/rabbitmq_$(NODENAME)_mnesia
adrien@63
    44
LOG_BASE=/tmp
adrien@63
    45
adrien@63
    46
ERL_CALL=erl_call -sname $(NODENAME) -e
adrien@63
    47
0x6e6562@138
    48
all: $(EBIN_DIR) $(TARGETS)
adrien@63
    49
0x6e6562@138
    50
$(BROKER_SYMLINK):
0x6e6562@138
    51
ifdef BROKER_DIR
0x6e6562@138
    52
	ln -sf $(BROKER_DIR) $(BROKER_SYMLINK)
0x6e6562@138
    53
endif
0x6e6562@1
    54
0x6e6562@138
    55
$(EBIN_DIR):
0x6e6562@138
    56
	mkdir -p $@
0x6e6562@1
    57
0x6e6562@138
    58
$(EBIN_DIR)/%.beam: $(SOURCE_DIR)/%.erl $(INCLUDES) $(BROKER_SYMLINK)
0x6e6562@138
    59
	erlc $(ERLC_OPTS) $<
0x6e6562@138
    60
0x6e6562@138
    61
run_server:
0x6e6562@138
    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
hubert@88
    63
	sleep 2 # so that the node is initialized when the tests are run
hubert@88
    64
adrian@65
    65
all_tests: test_network test_network_coverage test_direct test_direct_coverage
adrian@66
    66
	$(ERL_CALL) -q
adrian@65
    67
adrian@65
    68
tests_network: test_network test_network_coverage
adrian@66
    69
	$(ERL_CALL) -q
adrian@65
    70
0x6e6562@138
    71
test_network: $(TARGETS)
0x6e6562@138
    72
	erl -pa $(LOAD_PATH) -noshell -eval 'network_client_test:test(),halt().'
simon@14
    73
0x6e6562@138
    74
test_network_coverage: $(TARGETS)
0x6e6562@138
    75
	erl -pa $(LOAD_PATH) -noshell -eval 'network_client_test:test_coverage(),halt().'
simon@14
    76
adrian@65
    77
tests_direct: test_direct test_direct_coverage
adrian@66
    78
	$(ERL_CALL) -q
adrian@65
    79
	rm -rf $(MNESIA_DIR)
simon@26
    80
0x6e6562@138
    81
test_direct: $(TARGETS)
0x6e6562@148
    82
	erl -pa $(LOAD_PATH) -noshell -mnesia dir tmp -boot start_sasl -s rabbit -noshell \
0x6e6562@148
    83
	-sasl sasl_error_logger '{file, "'${LOG_BASE}'/rabbit-sasl.log"}' \
0x6e6562@148
    84
	-kernel error_logger '{file, "'${LOG_BASE}'/rabbit.log"}' \
0x6e6562@147
    85
	-eval 'direct_client_test:test(),halt().'
adrian@65
    86
0x6e6562@138
    87
test_direct_coverage: $(TARGETS)
0x6e6562@148
    88
	erl -pa $(LOAD_PATH) -noshell -mnesia dir tmp -boot start_sasl -s rabbit -noshell \
0x6e6562@148
    89
	-sasl sasl_error_logger '{file, "'${LOG_BASE}'/rabbit-sasl.log"}' \
0x6e6562@148
    90
	-kernel error_logger '{file, "'${LOG_BASE}'/rabbit.log"}' \
0x6e6562@148
    91
	-eval 'direct_client_test:test_coverage(),halt().'
simon@26
    92
0x6e6562@2
    93
clean:
0x6e6562@138
    94
	rm -f $(EBIN_DIR)/*.beam
0x6e6562@138
    95
	rm -f rabbitmq_server erl_crash.dump
0x6e6562@138
    96
	rm -fr cover dist
simon@31
    97
simon@31
    98
source-tarball:
simon@31
    99
	mkdir -p dist/$(DIST_DIR)
simon@31
   100
	cp -a README Makefile src include dist/$(DIST_DIR)
simon@31
   101
	cd dist ; tar cvzf $(DIST_DIR).tar.gz $(DIST_DIR)
simon@31
   102