forked from rabbitmq/rabbitmq-erlang-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
122 lines (95 loc) · 4.65 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
# License for the specific language governing rights and limitations
# under the License.
#
# The Original Code is RabbitMQ.
#
# The Initial Developer of the Original Code is VMware, Inc.
# Copyright (c) 2007-2011 VMware, Inc. All rights reserved.
#
VERSION=0.0.0
SOURCE_PACKAGE_DIR=$(PACKAGE)-$(VERSION)-src
SOURCE_PACKAGE_TAR_GZ=$(SOURCE_PACKAGE_DIR).tar.gz
BROKER_HEADERS=$(wildcard $(BROKER_DIR)/$(INCLUDE_DIR)/*.hrl)
BROKER_SOURCES=$(wildcard $(BROKER_DIR)/$(SOURCE_DIR)/*.erl)
BROKER_DEPS=$(BROKER_HEADERS) $(BROKER_SOURCES)
INFILES=$(shell find . -name '*.app.in')
INTARGETS=$(patsubst %.in, %, $(INFILES))
include common.mk
run_in_broker: compile $(BROKER_DEPS) $(EBIN_DIR)/$(PACKAGE).app
$(MAKE) RABBITMQ_SERVER_START_ARGS='$(PA_LOAD_PATH)' -C $(BROKER_DIR) run
clean: common_clean
rm -f $(INTARGETS)
rm -rf $(DIST_DIR)
distribution: documentation source_tarball package
%.app: %.app.in $(SOURCES) $(BROKER_DIR)/generate_app
escript $(BROKER_DIR)/generate_app $< $@ $(SOURCE_DIR)
sed 's/%%VSN%%/$(VERSION)/' $@ > [email protected] && mv [email protected] $@
###############################################################################
## Dialyzer
###############################################################################
RABBIT_PLT=$(BROKER_DIR)/rabbit.plt
dialyze: $(RABBIT_PLT) $(TARGETS)
dialyzer --plt $(RABBIT_PLT) --no_native -Wrace_conditions $(TARGETS)
.PHONY: $(RABBIT_PLT)
$(RABBIT_PLT):
$(MAKE) -C $(BROKER_DIR) create-plt
###############################################################################
## Documentation
###############################################################################
documentation: $(DOC_DIR)/index.html
$(DOC_DIR)/overview.edoc: $(SOURCE_DIR)/overview.edoc.in
mkdir -p $(DOC_DIR)
sed -e 's:%%VERSION%%:$(VERSION):g' < $< > $@
$(DOC_DIR)/index.html: $(DEPS_DIR)/$(COMMON_PACKAGE_DIR) $(DOC_DIR)/overview.edoc $(SOURCES)
$(LIBS_PATH) erl -noshell -eval 'edoc:application(amqp_client, ".", [{preprocess, true}])' -run init stop
###############################################################################
## Testing
###############################################################################
include test.mk
compile_tests: $(TEST_TARGETS) $(EBIN_DIR)/$(PACKAGE).app
$(TEST_TARGETS): $(TEST_DIR)
.PHONY: $(TEST_DIR)
$(TEST_DIR): $(DEPS_DIR)/$(COMMON_PACKAGE_DIR)
$(MAKE) -C $(TEST_DIR)
###############################################################################
## Packaging
###############################################################################
COPY=cp -pR
$(DIST_DIR)/$(COMMON_PACKAGE_EZ): $(BROKER_DEPS) $(COMMON_PACKAGE).app | $(DIST_DIR)
rm -f $@
$(MAKE) -C $(BROKER_DIR)
rm -rf $(DIST_DIR)/$(COMMON_PACKAGE_DIR)
mkdir -p $(DIST_DIR)/$(COMMON_PACKAGE_DIR)/$(INCLUDE_DIR)
mkdir -p $(DIST_DIR)/$(COMMON_PACKAGE_DIR)/$(EBIN_DIR)
cp $(COMMON_PACKAGE).app $(DIST_DIR)/$(COMMON_PACKAGE_DIR)/$(EBIN_DIR)/
$(foreach DEP, $(DEPS), \
( cp $(BROKER_DIR)/ebin/$(DEP).beam $(DIST_DIR)/$(COMMON_PACKAGE_DIR)/$(EBIN_DIR)/ \
);)
cp $(BROKER_DIR)/include/*.hrl $(DIST_DIR)/$(COMMON_PACKAGE_DIR)/$(INCLUDE_DIR)/
(cd $(DIST_DIR); zip -q -r $(COMMON_PACKAGE_EZ) $(COMMON_PACKAGE_DIR))
source_tarball: $(DIST_DIR)/$(COMMON_PACKAGE_EZ) $(EBIN_DIR)/$(PACKAGE).app | $(DIST_DIR)
mkdir -p $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/$(DIST_DIR)
$(COPY) $(DIST_DIR)/$(COMMON_PACKAGE_EZ) $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/$(DIST_DIR)/
$(COPY) README $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/
$(COPY) common.mk $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/
$(COPY) test.mk $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/
sed 's/%%VSN%%/$(VERSION)/' Makefile.in > $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/Makefile
mkdir -p $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/$(SOURCE_DIR)
$(COPY) $(SOURCE_DIR)/*.erl $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/$(SOURCE_DIR)/
mkdir -p $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/$(EBIN_DIR)
$(COPY) $(EBIN_DIR)/*.app $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/$(EBIN_DIR)/
mkdir -p $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/$(INCLUDE_DIR)
$(COPY) $(INCLUDE_DIR)/*.hrl $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/$(INCLUDE_DIR)/
mkdir -p $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/$(TEST_DIR)
$(COPY) $(TEST_DIR)/*.erl $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/$(TEST_DIR)/
$(COPY) $(TEST_DIR)/Makefile $(DIST_DIR)/$(SOURCE_PACKAGE_DIR)/$(TEST_DIR)/
cd $(DIST_DIR) ; tar czf $(SOURCE_PACKAGE_TAR_GZ) $(SOURCE_PACKAGE_DIR)
$(DIST_DIR):
mkdir -p $@