Makefile
author Simon MacMullen <simon@rabbitmq.com>
Fri Feb 03 15:59:12 2012 +0000 (3 months ago)
changeset 8922 4f87837a40be
parent 8670 02476613ae59
parent 8671 8b4c4598afd6
child 8829 4157b5c86aec
child 8850 24c00697df46
child 8855 a9c2c098fc44
child 9000 5e31ba01360c
permissions -rw-r--r--
Merge bug24702
vlad@1881
     1
TMPDIR ?= /tmp
vlad@1881
     2
vlad@1881
     3
RABBITMQ_NODENAME ?= rabbit
vlad@1881
     4
RABBITMQ_SERVER_START_ARGS ?=
vlad@1881
     5
RABBITMQ_MNESIA_DIR ?= $(TMPDIR)/rabbitmq-$(RABBITMQ_NODENAME)-mnesia
matthew@5185
     6
RABBITMQ_PLUGINS_EXPAND_DIR ?= $(TMPDIR)/rabbitmq-$(RABBITMQ_NODENAME)-plugins-scratch
vlad@1881
     7
RABBITMQ_LOG_BASE ?= $(TMPDIR)
tonyg@537
     8
matthias@2648
     9
DEPS_FILE=deps.mk
tonyg@0
    10
SOURCE_DIR=src
tonyg@0
    11
EBIN_DIR=ebin
tonyg@0
    12
INCLUDE_DIR=include
matthew@2916
    13
DOCS_DIR=docs
alexandru@3843
    14
INCLUDES=$(wildcard $(INCLUDE_DIR)/*.hrl) $(INCLUDE_DIR)/rabbit_framing.hrl
simon@3768
    15
SOURCES=$(wildcard $(SOURCE_DIR)/*.erl) $(SOURCE_DIR)/rabbit_framing_amqp_0_9_1.erl $(SOURCE_DIR)/rabbit_framing_amqp_0_8.erl $(USAGES_ERL)
matthias@2648
    16
BEAM_TARGETS=$(patsubst $(SOURCE_DIR)/%.erl, $(EBIN_DIR)/%.beam, $(SOURCES))
alexandru@8151
    17
TARGETS=$(EBIN_DIR)/rabbit.app $(INCLUDE_DIR)/rabbit_framing.hrl $(BEAM_TARGETS) plugins
tonyg@3797
    18
WEB_URL=http://www.rabbitmq.com/
matthew@2916
    19
MANPAGES=$(patsubst %.xml, %.gz, $(wildcard $(DOCS_DIR)/*.[0-9].xml))
matthew@2916
    20
WEB_MANPAGES=$(patsubst %.xml, %.man.xml, $(wildcard $(DOCS_DIR)/*.[0-9].xml) $(DOCS_DIR)/rabbitmq-service.xml)
alexandru@8218
    21
USAGES_XML=$(DOCS_DIR)/rabbitmqctl.1.xml $(DOCS_DIR)/rabbitmq-plugins.1.xml
matthew@2916
    22
USAGES_ERL=$(foreach XML, $(USAGES_XML), $(call usage_xml_to_erl, $(XML)))
emile@7491
    23
QC_MODULES := rabbit_backing_queue_qc
emile@7491
    24
QC_TRIALS ?= 100
tonyg@0
    25
tonyg@2354
    26
ifeq ($(shell python -c 'import simplejson' 2>/dev/null && echo yes),yes)
tonyg@603
    27
PYTHON=python
tonyg@2354
    28
else
tonyg@2354
    29
ifeq ($(shell python2.6 -c 'import simplejson' 2>/dev/null && echo yes),yes)
tonyg@2354
    30
PYTHON=python2.6
tonyg@2354
    31
else
tonyg@2354
    32
ifeq ($(shell python2.5 -c 'import simplejson' 2>/dev/null && echo yes),yes)
tonyg@2354
    33
PYTHON=python2.5
tonyg@2354
    34
else
tonyg@2354
    35
# Hmm. Missing simplejson?
tonyg@2354
    36
PYTHON=python
tonyg@2354
    37
endif
tonyg@2354
    38
endif
tonyg@2354
    39
endif
tonyg@603
    40
vlad@1769
    41
BASIC_PLT=basic.plt
vlad@1883
    42
RABBIT_PLT=rabbit.plt
vlad@1769
    43
tonyg@0
    44
ifndef USE_SPECS
simon@3576
    45
# our type specs rely on features and bug fixes in dialyzer that are
matthew@7311
    46
# only available in R14B03 upwards (R14B03 is erts 5.8.4)
matthew@7311
    47
USE_SPECS:=$(shell erl -noshell -eval 'io:format([list_to_integer(X) || X <- string:tokens(erlang:system_info(version), ".")] >= [5,8,4]), halt().')
tonyg@0
    48
endif
tonyg@0
    49
emile@7491
    50
ifndef USE_PROPER_QC
emile@7491
    51
# PropEr needs to be installed for property checking
emile@7491
    52
# http://proper.softlab.ntua.gr/
emile@7491
    53
USE_PROPER_QC:=$(shell erl -noshell -eval 'io:format({module, proper} =:= code:ensure_loaded(proper)), halt().')
emile@7491
    54
endif
emile@7491
    55
tonyg@0
    56
#other args: +native +"{hipe,[o3,verbose]}" -Ddebug=true +debug_info +no_strict_record_tests
emile@7491
    57
ERLC_OPTS=-I $(INCLUDE_DIR) -o $(EBIN_DIR) -Wall -v +debug_info $(call boolean_macro,$(USE_SPECS),use_specs) $(call boolean_macro,$(USE_PROPER_QC),use_proper_qc)
tonyg@0
    58
piotr@8670
    59
VERSION?=0.0.0
alexandru@8151
    60
PLUGINS_SRC_DIR?=$(shell [ -d "plugins-src" ] && echo "plugins-src" || echo )
alexandru@8281
    61
PLUGINS_DIR=plugins
tonyg@0
    62
TARBALL_NAME=rabbitmq-server-$(VERSION)
hubert@354
    63
TARGET_SRC_DIR=dist/$(TARBALL_NAME)
tonyg@0
    64
tonyg@0
    65
SIBLING_CODEGEN_DIR=../rabbitmq-codegen/
tonyg@0
    66
AMQP_CODEGEN_DIR=$(shell [ -d $(SIBLING_CODEGEN_DIR) ] && echo $(SIBLING_CODEGEN_DIR) || echo codegen)
simon@3852
    67
AMQP_SPEC_JSON_FILES_0_9_1=$(AMQP_CODEGEN_DIR)/amqp-rabbitmq-0.9.1.json
simon@3852
    68
AMQP_SPEC_JSON_FILES_0_8=$(AMQP_CODEGEN_DIR)/amqp-rabbitmq-0.8.json
tonyg@1980
    69
tonyg@539
    70
ERL_CALL=erl_call -sname $(RABBITMQ_NODENAME) -e
tonyg@0
    71
vlad@1830
    72
ERL_EBIN=erl -noinput -pa $(EBIN_DIR)
vlad@1798
    73
matthew@2916
    74
define usage_xml_to_erl
matthew@2917
    75
  $(subst __,_,$(patsubst $(DOCS_DIR)/rabbitmq%.1.xml, $(SOURCE_DIR)/rabbit_%_usage.erl, $(subst -,_,$(1))))
matthew@2916
    76
endef
matthew@2916
    77
matthew@2916
    78
define usage_dep
matthew@2916
    79
  $(call usage_xml_to_erl, $(1)): $(1) $(DOCS_DIR)/usage.xsl
matthew@2916
    80
endef
matthew@2916
    81
emile@7491
    82
define boolean_macro
emile@7491
    83
$(if $(filter true,$(1)),-D$(2))
emile@7491
    84
endef
emile@7491
    85
matthew@3600
    86
ifneq "$(SBIN_DIR)" ""
matthew@3600
    87
ifneq "$(TARGET_DIR)" ""
matthew@3600
    88
SCRIPTS_REL_PATH=$(shell ./calculate-relative $(TARGET_DIR)/sbin $(SBIN_DIR))
matthew@3600
    89
endif
matthew@3600
    90
endif
matthew@3600
    91
matthew@3782
    92
# Versions prior to this are not supported
matthew@3782
    93
NEED_MAKE := 3.80
matthew@3782
    94
ifneq "$(NEED_MAKE)" "$(firstword $(sort $(NEED_MAKE) $(MAKE_VERSION)))"
alexandru@3779
    95
$(error Versions of make prior to $(NEED_MAKE) are not supported)
alexandru@3779
    96
endif
matthew@3782
    97
matthew@3782
    98
# .DEFAULT_GOAL introduced in 3.81
matthew@3782
    99
DEFAULT_GOAL_MAKE := 3.81
matthew@3782
   100
ifneq "$(DEFAULT_GOAL_MAKE)" "$(firstword $(sort $(DEFAULT_GOAL_MAKE) $(MAKE_VERSION)))"
matthew@3782
   101
.DEFAULT_GOAL=all
alexandru@3751
   102
endif
alexandru@3751
   103
tonyg@0
   104
all: $(TARGETS)
tonyg@0
   105
alexandru@8061
   106
.PHONY: plugins
alexandru@8151
   107
ifneq "$(PLUGINS_SRC_DIR)" ""
alexandru@8059
   108
plugins:
alexandru@8237
   109
	[ -d "$(PLUGINS_SRC_DIR)/rabbitmq-server" ] || ln -s "$(CURDIR)" "$(PLUGINS_SRC_DIR)/rabbitmq-server"
alexandru@8281
   110
	mkdir -p $(PLUGINS_DIR)
alexandru@8281
   111
	PLUGINS_SRC_DIR="" $(MAKE) -C "$(PLUGINS_SRC_DIR)" plugins-dist PLUGINS_DIST_DIR="$(CURDIR)/$(PLUGINS_DIR)" VERSION=$(VERSION)
alexandru@8281
   112
	echo "Put your EZs here and use rabbitmq-plugins to enable them." > $(PLUGINS_DIR)/README
alexandru@8281
   113
	rm -f $(PLUGINS_DIR)/rabbit_common*.ez
alexandru@8151
   114
else
alexandru@8151
   115
plugins:
alexandru@8151
   116
# Not building plugins
alexandru@8151
   117
endif
alexandru@8059
   118
matthias@2648
   119
$(DEPS_FILE): $(SOURCES) $(INCLUDES)
matthew@4851
   120
	rm -f $@
matthew@5430
   121
	echo $(subst : ,:,$(foreach FILE,$^,$(FILE):)) | escript generate_deps $@ $(EBIN_DIR)
tonyg@0
   122
simon@7219
   123
$(EBIN_DIR)/rabbit.app: $(EBIN_DIR)/rabbit_app.in $(SOURCES) generate_app
matthew@7327
   124
	escript generate_app $< $@ $(SOURCE_DIR)
matthias@729
   125
matthew@4851
   126
$(EBIN_DIR)/%.beam: $(SOURCE_DIR)/%.erl | $(DEPS_FILE)
matthias@699
   127
	erlc $(ERLC_OPTS) -pa $(EBIN_DIR) $<
tonyg@0
   128
simon@3873
   129
$(INCLUDE_DIR)/rabbit_framing.hrl: codegen.py $(AMQP_CODEGEN_DIR)/amqp_codegen.py $(AMQP_SPEC_JSON_FILES_0_9_1) $(AMQP_SPEC_JSON_FILES_0_8)
simon@3943
   130
	$(PYTHON) codegen.py --ignore-conflicts header $(AMQP_SPEC_JSON_FILES_0_9_1) $(AMQP_SPEC_JSON_FILES_0_8) $@
matthias@582
   131
simon@3768
   132
$(SOURCE_DIR)/rabbit_framing_amqp_0_9_1.erl: codegen.py $(AMQP_CODEGEN_DIR)/amqp_codegen.py $(AMQP_SPEC_JSON_FILES_0_9_1)
simon@3768
   133
	$(PYTHON) codegen.py body $(AMQP_SPEC_JSON_FILES_0_9_1) $@
simon@3768
   134
simon@3768
   135
$(SOURCE_DIR)/rabbit_framing_amqp_0_8.erl: codegen.py $(AMQP_CODEGEN_DIR)/amqp_codegen.py $(AMQP_SPEC_JSON_FILES_0_8)
simon@3768
   136
	$(PYTHON) codegen.py body $(AMQP_SPEC_JSON_FILES_0_8) $@
tonyg@0
   137
vlad@1883
   138
dialyze: $(BEAM_TARGETS) $(BASIC_PLT)
matthias@8071
   139
	dialyzer --plt $(BASIC_PLT) --no_native --fullpath \
matthias@5391
   140
	  -Wrace_conditions $(BEAM_TARGETS)
vlad@1769
   141
vlad@1900
   142
# rabbit.plt is used by rabbitmq-erlang-client's dialyze make target
vlad@1883
   143
create-plt: $(RABBIT_PLT)
vlad@1769
   144
vlad@1883
   145
$(RABBIT_PLT): $(BEAM_TARGETS) $(BASIC_PLT)
matthias@5336
   146
	dialyzer --plt $(BASIC_PLT) --output_plt $@ --no_native \
matthias@5336
   147
	  --add_to_plt $(BEAM_TARGETS)
vlad@1769
   148
vlad@1839
   149
$(BASIC_PLT): $(BEAM_TARGETS)
vlad@1839
   150
	if [ -f $@ ]; then \
vlad@1839
   151
	    touch $@; \
vlad@1839
   152
	else \
matthias@5336
   153
	    dialyzer --output_plt $@ --build_plt \
matthias@5392
   154
		--apps erts kernel stdlib compiler sasl os_mon mnesia tools \
matthias@5392
   155
		  public_key crypto ssl; \
vlad@1839
   156
	fi
tonyg@0
   157
tonyg@1387
   158
clean:
tonyg@0
   159
	rm -f $(EBIN_DIR)/*.beam
paulj@1861
   160
	rm -f $(EBIN_DIR)/rabbit.app $(EBIN_DIR)/rabbit.boot $(EBIN_DIR)/rabbit.script $(EBIN_DIR)/rabbit.rel
alexandru@8281
   161
	rm -f $(PLUGINS_DIR)/*.ez
alexandru@8237
   162
	[ -d "$(PLUGINS_SRC_DIR)" ] && PLUGINS_SRC_DIR="" PRESERVE_CLONE_DIR=1 make -C $(PLUGINS_SRC_DIR) clean || true
simon@3978
   163
	rm -f $(INCLUDE_DIR)/rabbit_framing.hrl $(SOURCE_DIR)/rabbit_framing_amqp_*.erl codegen.pyc
matthew@2916
   164
	rm -f $(DOCS_DIR)/*.[0-9].gz $(DOCS_DIR)/*.man.xml $(DOCS_DIR)/*.erl $(USAGES_ERL)
vlad@1883
   165
	rm -f $(RABBIT_PLT)
matthias@2648
   166
	rm -f $(DEPS_FILE)
tonyg@0
   167
tonyg@1380
   168
cleandb:
matthew@1231
   169
	rm -rf $(RABBITMQ_MNESIA_DIR)/*
tonyg@0
   170
tonyg@0
   171
############ various tasks to interact with RabbitMQ ###################
tonyg@0
   172
tonyg@537
   173
BASIC_SCRIPT_ENVIRONMENT_SETTINGS=\
tonyg@537
   174
	RABBITMQ_NODE_IP_ADDRESS="$(RABBITMQ_NODE_IP_ADDRESS)" \
tonyg@537
   175
	RABBITMQ_NODE_PORT="$(RABBITMQ_NODE_PORT)" \
tonyg@537
   176
	RABBITMQ_LOG_BASE="$(RABBITMQ_LOG_BASE)" \
matthew@5185
   177
	RABBITMQ_MNESIA_DIR="$(RABBITMQ_MNESIA_DIR)" \
matthew@5185
   178
	RABBITMQ_PLUGINS_EXPAND_DIR="$(RABBITMQ_PLUGINS_EXPAND_DIR)"
tonyg@537
   179
tonyg@0
   180
run: all
tonyg@537
   181
	$(BASIC_SCRIPT_ENVIRONMENT_SETTINGS) \
paulj@1867
   182
		RABBITMQ_ALLOW_INPUT=true \
paulj@1905
   183
		RABBITMQ_SERVER_START_ARGS="$(RABBITMQ_SERVER_START_ARGS)" \
tonyg@537
   184
		./scripts/rabbitmq-server
tonyg@0
   185
tonyg@0
   186
run-node: all
tonyg@537
   187
	$(BASIC_SCRIPT_ENVIRONMENT_SETTINGS) \
tonyg@537
   188
		RABBITMQ_NODE_ONLY=true \
paulj@1867
   189
		RABBITMQ_ALLOW_INPUT=true \
tonyg@537
   190
		RABBITMQ_SERVER_START_ARGS="$(RABBITMQ_SERVER_START_ARGS)" \
tonyg@537
   191
		./scripts/rabbitmq-server
tonyg@0
   192
matthew@7972
   193
run-background-node: all
matthew@7972
   194
	$(BASIC_SCRIPT_ENVIRONMENT_SETTINGS) \
matthew@7972
   195
		RABBITMQ_NODE_ONLY=true \
matthew@7972
   196
		RABBITMQ_SERVER_START_ARGS="$(RABBITMQ_SERVER_START_ARGS)" \
matthew@7972
   197
		./scripts/rabbitmq-server
matthew@7972
   198
tonyg@0
   199
run-tests: all
simon@7390
   200
	OUT=$$(echo "rabbit_tests:all_tests()." | $(ERL_CALL)) ; \
simon@7390
   201
	  echo $$OUT ; echo $$OUT | grep '^{ok, passed}$$' > /dev/null
tonyg@0
   202
emile@7491
   203
run-qc: all
emile@7492
   204
	$(foreach MOD,$(QC_MODULES),./quickcheck $(RABBITMQ_NODENAME) $(MOD) $(QC_TRIALS))
emile@7491
   205
simon@8265
   206
start-background-node: all
simon@8264
   207
	-rm -f $(RABBITMQ_MNESIA_DIR).pid
matthew@8027
   208
	mkdir -p $(RABBITMQ_MNESIA_DIR)
matthew@7972
   209
	setsid sh -c "$(MAKE) run-background-node > $(RABBITMQ_MNESIA_DIR)/startup_log 2> $(RABBITMQ_MNESIA_DIR)/startup_err" &
matthew@7972
   210
	sleep 1
tonyg@0
   211
tonyg@0
   212
start-rabbit-on-node: all
tonyg@0
   213
	echo "rabbit:start()." | $(ERL_CALL)
matthew@7972
   214
	./scripts/rabbitmqctl -n $(RABBITMQ_NODENAME) wait $(RABBITMQ_MNESIA_DIR).pid
tonyg@0
   215
tonyg@0
   216
stop-rabbit-on-node: all
tonyg@0
   217
	echo "rabbit:stop()." | $(ERL_CALL)
tonyg@0
   218
matthias@4238
   219
set-memory-alarm: all
matthew@6569
   220
	echo "alarm_handler:set_alarm({{vm_memory_high_watermark, node()}, []})." | \
matthias@4238
   221
	$(ERL_CALL)
matthias@4238
   222
matthias@4238
   223
clear-memory-alarm: all
matthew@6569
   224
	echo "alarm_handler:clear_alarm({vm_memory_high_watermark, node()})." | \
matthias@4238
   225
	$(ERL_CALL)
matthias@4238
   226
tonyg@0
   227
stop-node:
tonyg@0
   228
	-$(ERL_CALL) -q
tonyg@0
   229
majek@1503
   230
# code coverage will be created for subdirectory "ebin" of COVER_DIR
majek@1503
   231
COVER_DIR=.
majek@1394
   232
tonyg@0
   233
start-cover: all
simon@3131
   234
	echo "rabbit_misc:start_cover([\"rabbit\", \"hare\"])." | $(ERL_CALL)
simon@3131
   235
	echo "rabbit_misc:enable_cover([\"$(COVER_DIR)\"])." | $(ERL_CALL)
tonyg@0
   236
matthew@3165
   237
start-secondary-cover: all
matthew@3165
   238
	echo "rabbit_misc:start_cover([\"hare\"])." | $(ERL_CALL)
tonyg@0
   239
tonyg@0
   240
stop-cover: all
tonyg@0
   241
	echo "rabbit_misc:report_cover(), cover:stop()." | $(ERL_CALL)
tonyg@0
   242
	cat cover/summary.txt
tonyg@0
   243
tonyg@0
   244
########################################################################
tonyg@0
   245
hubert@354
   246
srcdist: distclean
hubert@354
   247
	mkdir -p $(TARGET_SRC_DIR)/codegen
simon@8544
   248
	cp -r ebin src include LICENSE LICENSE-MPL-RabbitMQ INSTALL README $(TARGET_SRC_DIR)
piotr@8671
   249
	sed 's/%%VSN%%/$(VERSION)/' $(TARGET_SRC_DIR)/ebin/rabbit_app.in > $(TARGET_SRC_DIR)/ebin/rabbit_app.in.tmp && \
piotr@8671
   250
		mv $(TARGET_SRC_DIR)/ebin/rabbit_app.in.tmp $(TARGET_SRC_DIR)/ebin/rabbit_app.in
tonyg@530
   251
hubert@354
   252
	cp -r $(AMQP_CODEGEN_DIR)/* $(TARGET_SRC_DIR)/codegen/
matthias@2648
   253
	cp codegen.py Makefile generate_app generate_deps calculate-relative $(TARGET_SRC_DIR)
hubert@352
   254
hubert@354
   255
	cp -r scripts $(TARGET_SRC_DIR)
matthew@2916
   256
	cp -r $(DOCS_DIR) $(TARGET_SRC_DIR)
hubert@354
   257
	chmod 0755 $(TARGET_SRC_DIR)/scripts/*
tonyg@0
   258
alexandru@8337
   259
ifneq "$(PLUGINS_SRC_DIR)" ""
alexandru@8357
   260
	cp -r $(PLUGINS_SRC_DIR) $(TARGET_SRC_DIR)/plugins-src
alexandru@8357
   261
	rm $(TARGET_SRC_DIR)/LICENSE
alexandru@8357
   262
	cat packaging/common/LICENSE.head >> $(TARGET_SRC_DIR)/LICENSE
alexandru@8358
   263
	cat $(AMQP_CODEGEN_DIR)/license_info >> $(TARGET_SRC_DIR)/LICENSE
alexandru@8357
   264
	find $(PLUGINS_SRC_DIR)/licensing -name "license_info_*" -exec cat '{}' >> $(TARGET_SRC_DIR)/LICENSE \;
alexandru@8357
   265
	cat packaging/common/LICENSE.tail >> $(TARGET_SRC_DIR)/LICENSE
alexandru@8357
   266
	find $(PLUGINS_SRC_DIR)/licensing -name "LICENSE-*" -exec cp '{}' $(TARGET_SRC_DIR) \;
alexandru@8357
   267
	rm -rf $(TARGET_SRC_DIR)/licensing
alexandru@8337
   268
else
alexandru@8337
   269
	@echo No plugins source distribution found
alexandru@8337
   270
endif
alexandru@8058
   271
alexandru@8058
   272
	(cd dist; tar -zchf $(TARBALL_NAME).tar.gz $(TARBALL_NAME))
alexandru@7713
   273
	(cd dist; zip -q -r $(TARBALL_NAME).zip $(TARBALL_NAME))
hubert@354
   274
	rm -rf $(TARGET_SRC_DIR)
tonyg@0
   275
tonyg@0
   276
distclean: clean
dpw@1538
   277
	$(MAKE) -C $(AMQP_CODEGEN_DIR) distclean
tonyg@0
   278
	rm -rf dist
hubert@588
   279
	find . -regex '.*\(~\|#\|\.swp\|\.dump\)' -exec rm {} \;
tonyg@0
   280
simon@2813
   281
# xmlto can not read from standard input, so we mess with a tmp file.
matthew@2916
   282
%.gz: %.xml $(DOCS_DIR)/examples-to-end.xsl
david@3827
   283
	xmlto --version | grep -E '^xmlto version 0\.0\.([0-9]|1[1-8])$$' >/dev/null || opt='--stringparam man.indent.verbatims=0' ; \
simon@7334
   284
	    xsltproc --novalid $(DOCS_DIR)/examples-to-end.xsl $< > $<.tmp && \
matthias@4574
   285
	    xmlto -o $(DOCS_DIR) $$opt man $<.tmp && \
david@3827
   286
	    gzip -f $(DOCS_DIR)/`basename $< .xml`
simon@2813
   287
	rm -f $<.tmp
tonyg@531
   288
simon@2933
   289
# Use tmp files rather than a pipeline so that we get meaningful errors
simon@2933
   290
# Do not fold the cp into previous line, it's there to stop the file being
simon@2933
   291
# generated but empty if we fail
matthew@2916
   292
$(SOURCE_DIR)/%_usage.erl:
simon@7320
   293
	xsltproc --novalid --stringparam modulename "`basename $@ .erl`" \
tonygarnockjones@2947
   294
		$(DOCS_DIR)/usage.xsl $< > $@.tmp
tonygarnockjones@2947
   295
	sed -e 's/"/\\"/g' -e 's/%QUOTE%/"/g' $@.tmp > $@.tmp2
tonygarnockjones@2947
   296
	fold -s $@.tmp2 > $@.tmp3
tonyg@2948
   297
	mv $@.tmp3 $@
tonyg@2948
   298
	rm $@.tmp $@.tmp2
simon@2813
   299
simon@2895
   300
# We rename the file before xmlto sees it since xmlto will use the name of
simon@2821
   301
# the file to make internal links.
matthew@2916
   302
%.man.xml: %.xml $(DOCS_DIR)/html-to-website-xml.xsl
simon@2856
   303
	cp $< `basename $< .xml`.xml && \
simon@2856
   304
		xmlto xhtml-nochunks `basename $< .xml`.xml ; rm `basename $< .xml`.xml
simon@2895
   305
	cat `basename $< .xml`.html | \
matthew@2916
   306
	    xsltproc --novalid $(DOCS_DIR)/remove-namespaces.xsl - | \
simon@7334
   307
		xsltproc --novalid --stringparam original `basename $<` $(DOCS_DIR)/html-to-website-xml.xsl - | \
simon@2895
   308
		xmllint --format - > $@
simon@2856
   309
	rm `basename $< .xml`.html
simon@2813
   310
simon@2856
   311
docs_all: $(MANPAGES) $(WEB_MANPAGES)
tonyg@531
   312
simon@5157
   313
install: install_bin install_docs
simon@5157
   314
simon@5157
   315
install_bin: all install_dirs
alexandru@8337
   316
	cp -r ebin include LICENSE* INSTALL $(TARGET_DIR)
tonyg@0
   317
tonyg@0
   318
	chmod 0755 scripts/*
alexandru@8218
   319
	for script in rabbitmq-env rabbitmq-server rabbitmqctl rabbitmq-plugins; do \
paulj@1426
   320
		cp scripts/$$script $(TARGET_DIR)/sbin; \
paulj@1426
   321
		[ -e $(SBIN_DIR)/$$script ] || ln -s $(SCRIPTS_REL_PATH)/$$script $(SBIN_DIR)/$$script; \
paulj@1551
   322
	done
alexandru@8236
   323
alexandru@8281
   324
	mkdir -p $(TARGET_DIR)/$(PLUGINS_DIR)
alexandru@8338
   325
	[ -d "$(PLUGINS_DIR)" ] && cp $(PLUGINS_DIR)/*.ez $(PLUGINS_DIR)/README $(TARGET_DIR)/$(PLUGINS_DIR) || true
simon@5157
   326
simon@5157
   327
install_docs: docs_all install_dirs
tonyg@531
   328
	for section in 1 5; do \
tonyg@531
   329
		mkdir -p $(MAN_DIR)/man$$section; \
matthew@2930
   330
		for manpage in $(DOCS_DIR)/*.$$section.gz; do \
tonyg@2921
   331
			cp $$manpage $(MAN_DIR)/man$$section; \
tonyg@531
   332
		done; \
hubert@70
   333
	done
paulj@1426
   334
paulj@1426
   335
install_dirs:
matthew@3601
   336
	@ OK=true && \
matthew@3601
   337
	  { [ -n "$(TARGET_DIR)" ] || { echo "Please set TARGET_DIR."; OK=false; }; } && \
matthew@3601
   338
	  { [ -n "$(SBIN_DIR)" ] || { echo "Please set SBIN_DIR."; OK=false; }; } && \
matthew@3601
   339
	  { [ -n "$(MAN_DIR)" ] || { echo "Please set MAN_DIR."; OK=false; }; } && $$OK
matthias@3584
   340
matthias@3584
   341
	mkdir -p $(TARGET_DIR)/sbin
paulj@1426
   342
	mkdir -p $(SBIN_DIR)
matthias@3584
   343
	mkdir -p $(MAN_DIR)
matthias@2648
   344
alexandru@3751
   345
$(foreach XML,$(USAGES_XML),$(eval $(call usage_dep, $(XML))))
matthew@2916
   346
matthew@2918
   347
# Note that all targets which depend on clean must have clean in their
matthew@2918
   348
# name.  Also any target that doesn't depend on clean should not have
matthew@2918
   349
# clean in its name, unless you know that you don't need any of the
matthew@2918
   350
# automatic dependency generation for that target (eg cleandb).
matthew@2919
   351
matthew@2919
   352
# We want to load the dep file if *any* target *doesn't* contain
matthew@2919
   353
# "clean" - i.e. if removing all clean-like targets leaves something
matthew@2922
   354
matthew@2922
   355
ifeq "$(MAKECMDGOALS)" ""
matthew@2922
   356
TESTABLEGOALS:=$(.DEFAULT_GOAL)
matthew@2922
   357
else
matthew@2922
   358
TESTABLEGOALS:=$(MAKECMDGOALS)
matthew@2922
   359
endif
matthew@2922
   360
matthew@2922
   361
ifneq "$(strip $(patsubst clean%,,$(patsubst %clean,,$(TESTABLEGOALS))))" ""
david@3825
   362
-include $(DEPS_FILE)
matthew@2943
   363
endif
matthew@6303
   364
emile@7540
   365
.PHONY: run-qc