This repository has been archived by the owner on Nov 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 127
/
Makefile
198 lines (164 loc) · 6.07 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
PROJECT = amqp_client
PROJECT_DESCRIPTION = RabbitMQ AMQP Client
PROJECT_MOD = amqp_client
PROJECT_REGISTERED = amqp_sup
define PROJECT_ENV
[
{prefer_ipv6, false},
{ssl_options, []},
{writer_gc_threshold, 1000000000}
]
endef
define PROJECT_APP_EXTRA_KEYS
%% Hex.pm package informations.
{licenses, ["MPL 2.0"]},
{links, [
{"Website", "https://www.rabbitmq.com/"},
{"GitHub", "https://github.com/rabbitmq/rabbitmq-erlang-client"},
{"User guide", "https://www.rabbitmq.com/erlang-client-user-guide.html"}
]},
{build_tools, ["make", "rebar3"]},
{files, [
$(RABBITMQ_HEXPM_DEFAULT_FILES)
]}
endef
# Release artifacts are put in $(PACKAGES_DIR).
PACKAGES_DIR ?= $(abspath PACKAGES)
LOCAL_DEPS = xmerl
DEPS = rabbit_common
TEST_DEPS = rabbitmq_ct_helpers rabbit
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-test.mk
DEP_PLUGINS = rabbit_common/mk/rabbitmq-build.mk \
rabbit_common/mk/rabbitmq-hexpm.mk \
rabbit_common/mk/rabbitmq-dist.mk \
rabbit_common/mk/rabbitmq-run.mk \
rabbit_common/mk/rabbitmq-test.mk \
rabbit_common/mk/rabbitmq-tools.mk
PLT_APPS = ssl public_key
# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be
# reviewed and merged.
ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git
ERLANG_MK_COMMIT = rabbitmq-tmp
WITHOUT = plugins/proper
include rabbitmq-components.mk
include erlang.mk
# --------------------------------------------------------------------
# Distribution.
# --------------------------------------------------------------------
.PHONY: distribution
distribution: docs source-dist package
docs:: edoc
edoc: doc/overview.edoc
doc/overview.edoc: src/overview.edoc.in
mkdir -p doc
sed -e 's:%%VERSION%%:$(PROJECT_VERSION):g' < $< > $@
.PHONY: source-dist clean-source-dist
SOURCE_DIST_BASE ?= $(PROJECT)
SOURCE_DIST_SUFFIXES ?= tar.xz zip
SOURCE_DIST ?= $(PACKAGES_DIR)/$(SOURCE_DIST_BASE)-$(PROJECT_VERSION)-src
# The first source distribution file is used by packages: if the archive
# type changes, you must update all packages' Makefile.
SOURCE_DIST_FILES = $(addprefix $(SOURCE_DIST).,$(SOURCE_DIST_SUFFIXES))
.PHONY: $(SOURCE_DIST_FILES)
source-dist: $(SOURCE_DIST_FILES)
@:
RSYNC ?= rsync
RSYNC_V_0 =
RSYNC_V_1 = -v
RSYNC_V_2 = -v
RSYNC_V = $(RSYNC_V_$(V))
RSYNC_FLAGS += -a $(RSYNC_V) \
--exclude '.sw?' --exclude '.*.sw?' \
--exclude '*.beam' \
--exclude '*.d' \
--exclude '*.pyc' \
--exclude '.git*' \
--exclude '.hg*' \
--exclude '.travis.yml' \
--exclude '.*.plt' \
--exclude '$(notdir $(ERLANG_MK_TMP))' \
--exclude 'cover/' \
--exclude 'deps/' \
--exclude 'ebin/' \
--exclude 'erl_crash.dump' \
--exclude '$(notdir $(DEPS_DIR))/' \
--exclude 'doc/' \
--exclude 'hexer*' \
--exclude 'logs/' \
--exclude 'plugins/' \
--exclude '$(notdir $(DIST_DIR))/' \
--exclude 'test' \
--exclude 'xrefr' \
--exclude '/$(notdir $(PACKAGES_DIR))/' \
--exclude '/PACKAGES/' \
--delete \
--delete-excluded
TAR ?= tar
TAR_V_0 =
TAR_V_1 = -v
TAR_V_2 = -v
TAR_V = $(TAR_V_$(V))
GZIP ?= gzip
BZIP2 ?= bzip2
XZ ?= xz
ZIP ?= zip
ZIP_V_0 = -q
ZIP_V_1 =
ZIP_V_2 =
ZIP_V = $(ZIP_V_$(V))
.PHONY: $(SOURCE_DIST)
$(SOURCE_DIST): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
$(verbose) mkdir -p $(dir $@)
$(gen_verbose) $(RSYNC) $(RSYNC_FLAGS) ./ $@/
$(verbose) echo "$(PROJECT_DESCRIPTION) $(PROJECT_VERSION)" > $@/git-revisions.txt
$(verbose) echo "$(PROJECT) $$(git rev-parse HEAD) $$(git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD)" >> $@/git-revisions.txt
$(verbose) for dep in $$(cat $(ERLANG_MK_RECURSIVE_DEPS_LIST) | grep -v '/$(PROJECT)$$' | LC_COLLATE=C sort); do \
$(RSYNC) $(RSYNC_FLAGS) \
$$dep \
$@/deps; \
if test -f $@/deps/$$(basename $$dep)/erlang.mk && \
test "$$(wc -l $@/deps/$$(basename $$dep)/erlang.mk | awk '{print $$1;}')" = "1" && \
grep -qs -E "^[[:blank:]]*include[[:blank:]]+(erlang\.mk|.*/erlang\.mk)$$" $@/deps/$$(basename $$dep)/erlang.mk; then \
echo "include ../../erlang.mk" > $@/deps/$$(basename $$dep)/erlang.mk; \
fi; \
sed -E -i.bak "s|^[[:blank:]]*include[[:blank:]]+\.\./.*erlang.mk$$|include ../../erlang.mk|" \
$@/deps/$$(basename $$dep)/Makefile && \
rm $@/deps/$$(basename $$dep)/Makefile.bak; \
(cd $$dep; echo "$$(basename "$$dep") $$(git rev-parse HEAD) $$(git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD)") >> $@/git-revisions.txt; \
done
$(verbose) for file in $$(find $@ -name '*.app.src'); do \
sed -E -i.bak \
-e 's/[{]vsn[[:blank:]]*,[[:blank:]]*(""|"0.0.0")[[:blank:]]*}/{vsn, "$(PROJECT_VERSION)"}/' \
$$file; \
rm $$file.bak; \
done
$(verbose) rm $@/README.in
$(verbose) cp README.in $@/README
$(verbose) if test "$(BUILD_DOC)"; then cat "$(BUILD_DOC)" >> $@/README; fi
# TODO: Fix file timestamps to have reproducible source archives.
# $(verbose) find $@ -not -name 'git-revisions.txt' -print0 | xargs -0 touch -r $@/git-revisions.txt
$(SOURCE_DIST).tar.gz: $(SOURCE_DIST)
$(gen_verbose) cd $(dir $(SOURCE_DIST)) && \
find $(notdir $(SOURCE_DIST)) -print0 | LC_COLLATE=C sort -z | \
xargs -0 $(TAR) $(TAR_V) --no-recursion -cf - | \
$(GZIP) --best > $@
$(SOURCE_DIST).tar.bz2: $(SOURCE_DIST)
$(gen_verbose) cd $(dir $(SOURCE_DIST)) && \
find $(notdir $(SOURCE_DIST)) -print0 | LC_COLLATE=C sort -z | \
xargs -0 $(TAR) $(TAR_V) --no-recursion -cf - | \
$(BZIP2) > $@
$(SOURCE_DIST).tar.xz: $(SOURCE_DIST)
$(gen_verbose) cd $(dir $(SOURCE_DIST)) && \
find $(notdir $(SOURCE_DIST)) -print0 | LC_COLLATE=C sort -z | \
xargs -0 $(TAR) $(TAR_V) --no-recursion -cf - | \
$(XZ) > $@
$(SOURCE_DIST).zip: $(SOURCE_DIST)
$(verbose) rm -f $@
$(gen_verbose) cd $(dir $(SOURCE_DIST)) && \
find $(notdir $(SOURCE_DIST)) -print0 | LC_COLLATE=C sort -z | \
xargs -0 $(ZIP) $(ZIP_V) $@
clean:: clean-source-dist
clean-source-dist:
$(gen_verbose) rm -rf -- $(SOURCE_DIST_BASE)-*
package: dist
cp $(DIST_DIR)/*.ez $(PACKAGES_DIR)