Finish `make source-dist` and update erlang.mk
This commit is contained in:
parent
0f3a9ac85d
commit
fe61400611
103
Makefile
103
Makefile
|
|
@ -2,6 +2,14 @@ PROJECT = rabbit
|
|||
|
||||
DEPS = rabbit_common
|
||||
|
||||
SRCDIST_DEPS ?= rabbitmq_shovel
|
||||
|
||||
ifneq ($(IS_DEP),1)
|
||||
ifneq ($(findstring source-dist,$(MAKECMDGOALS)),)
|
||||
DEPS += $(SRCDIST_DEPS)
|
||||
endif
|
||||
endif
|
||||
|
||||
# For RabbitMQ repositories, we want to checkout branches which match
|
||||
# the parent porject. For instance, if the parent project is on a
|
||||
# release tag, dependencies must be on the same release tag. If the
|
||||
|
|
@ -19,6 +27,7 @@ export base_rmq_ref
|
|||
endif
|
||||
|
||||
dep_rabbit_common = git https://github.com/rabbitmq/rabbitmq-common.git $(current_rmq_ref) $(base_rmq_ref)
|
||||
dep_rabbitmq_shovel = git https://github.com/rabbitmq/rabbitmq-shovel.git $(current_rmq_ref) $(base_rmq_ref)
|
||||
|
||||
define usage_xml_to_erl
|
||||
$(subst __,_,$(patsubst $(DOCS_DIR)/rabbitmq%.1.xml, src/rabbit_%_usage.erl, $(subst -,_,$(1))))
|
||||
|
|
@ -45,8 +54,8 @@ DEP_PLUGINS = rabbit_common/mk/rabbitmq-run.mk
|
|||
# FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be
|
||||
# reviewed and merged.
|
||||
|
||||
ERLANG_MK_GIT_REPOSITORY = https://github.com/rabbitmq/erlang.mk.git
|
||||
ERLANG_MK_GIT_REF = rabbitmq-tmp
|
||||
ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git
|
||||
ERLANG_MK_COMMIT = rabbitmq-tmp
|
||||
|
||||
include erlang.mk
|
||||
|
||||
|
|
@ -163,68 +172,72 @@ distclean-manpages::
|
|||
.PHONY: source-dist
|
||||
|
||||
SOURCE_DIST_BASE ?= rabbitmq-server
|
||||
SOURCE_DIST_SUFFIXES ?= tar.xz
|
||||
SOURCE_DIST_SUFFIXES ?= tar.xz zip
|
||||
SOURCE_DIST ?= $(SOURCE_DIST_BASE)-$(VERSION)
|
||||
|
||||
SOURCE_DIST_FILES = $(addprefix $(SOURCE_DIST).,$(SOURCE_DIST_SUFFIXES))
|
||||
|
||||
SRCDIST_DEPS ?= rabbitmq_shovel
|
||||
|
||||
dep_rabbitmq_shovel = git https://github.com/rabbitmq/rabbitmq-shovel.git $(current_rmq_ref) $(base_rmq_ref)
|
||||
|
||||
ALL_SRCDIST_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(SRCDIST_DEPS))
|
||||
|
||||
$(foreach dep,$(SRCDIST_DEPS),$(eval $(call dep_target,$(dep))))
|
||||
|
||||
.PHONY: $(SOURCE_DIST_FILES)
|
||||
|
||||
source-dist: $(SOURCE_DIST_FILES)
|
||||
@:
|
||||
|
||||
TAR ?= tar
|
||||
TAR_VERSION = $(shell $(TAR) --version)
|
||||
RSYNC ?= rsync
|
||||
RSYNC_V_0 =
|
||||
RSYNC_V_1 = -v
|
||||
RSYNC_V = $(RSYNC_V_$(V))
|
||||
RSYNC_FLAGS += -a $(RSYNC_V) \
|
||||
--exclude '.sw?' --exclude '.*.sw?' \
|
||||
--exclude '*.beam' \
|
||||
--exclude '*.pyc' \
|
||||
--exclude '.git*' \
|
||||
--exclude '$(notdir $(ERLANG_MK_TMP))' \
|
||||
--exclude '$(SOURCE_DIST_BASE)-*' \
|
||||
--exclude 'ebin' \
|
||||
--exclude 'packaging' \
|
||||
--exclude 'erl_crash.dump' \
|
||||
--exclude 'deps' \
|
||||
--delete \
|
||||
--delete-excluded
|
||||
|
||||
TAR ?= tar
|
||||
TAR_V_0 =
|
||||
TAR_V_1 = -v
|
||||
TAR_V = $(TAR_V_$(V))
|
||||
TAR_FLAGS = $(TAR_V) -cf - \
|
||||
--exclude '.sw?' --exclude '.*.sw?' \
|
||||
--exclude '*.beam' \
|
||||
--exclude '.git*' \
|
||||
--exclude '$(notdir $(ERLANG_MK_TMP))' \
|
||||
--exclude '$(SOURCE_DIST_BASE)-*' \
|
||||
--exclude 'packaging'
|
||||
|
||||
ifneq (,$(findstring GNU tar,$(TAR_VERSION)))
|
||||
define tar_source_dist
|
||||
$(TAR) $(TAR_FLAGS) \
|
||||
--transform 's/^\./$(SOURCE_DIST)/' \
|
||||
--show-transformed \
|
||||
.
|
||||
endef
|
||||
endif
|
||||
GZIP ?= gzip
|
||||
BZIP2 ?= bzip2
|
||||
XZ ?= xz
|
||||
|
||||
ifneq (,$(findstring bsdtar,$(TAR_VERSION)))
|
||||
define tar_source_dist
|
||||
$(TAR) $(TAR_FLAGS) \
|
||||
-s '/^\./$(SOURCE_DIST)/' \
|
||||
.
|
||||
endef
|
||||
endif
|
||||
ZIP ?= zip
|
||||
ZIP_V_0 = -q
|
||||
ZIP_V_1 =
|
||||
ZIP_V = $(ZIP_V_$(V))
|
||||
|
||||
$(SOURCE_DIST).tar.gz: $(ALL_DEPS_DIRS) $(ALL_SRCDIST_DEPS_DIRS)
|
||||
$(gen_verbose) $(call tar_source_dist) \
|
||||
| gzip --best > $@
|
||||
.PHONY: $(SOURCE_DIST)
|
||||
|
||||
$(SOURCE_DIST).tar.bz2: $(ALL_DEPS_DIRS) $(ALL_SRCDIST_DEPS_DIRS)
|
||||
$(gen_verbose) $(call tar_source_dist) \
|
||||
| bzip2 > $@
|
||||
$(SOURCE_DIST): $(ERLANG_MK_RECURSIVE_DEPS_LIST)
|
||||
$(gen_verbose) $(RSYNC) $(RSYNC_FLAGS) ./ $(SOURCE_DIST)/
|
||||
$(verbose) mkdir -p $(SOURCE_DIST)/deps
|
||||
$(verbose) for dep in $$(cat $(ERLANG_MK_RECURSIVE_DEPS_LIST)); do \
|
||||
$(RSYNC) $(RSYNC_FLAGS) \
|
||||
$$dep \
|
||||
$(SOURCE_DIST)/deps; \
|
||||
done
|
||||
|
||||
$(SOURCE_DIST).tar.xz: $(ALL_DEPS_DIRS) $(ALL_SRCDIST_DEPS_DIRS)
|
||||
$(gen_verbose) $(call tar_source_dist) \
|
||||
| xz > $@
|
||||
$(SOURCE_DIST).tar.gz: $(SOURCE_DIST)
|
||||
$(gen_verbose) $(TAR) -cf - $(TAR_V) $(SOURCE_DIST) | $(GZIP) --best > $@
|
||||
|
||||
$(SOURCE_DIST).tar.bz2: $(SOURCE_DIST)
|
||||
$(gen_verbose) $(TAR) -cf - $(TAR_V) $(SOURCE_DIST) | $(BZIP2) > $@
|
||||
|
||||
$(SOURCE_DIST).tar.xz: $(SOURCE_DIST)
|
||||
$(gen_verbose) $(TAR) -cf - $(TAR_V) $(SOURCE_DIST) | $(XZ) > $@
|
||||
|
||||
$(SOURCE_DIST).zip: $(SOURCE_DIST)
|
||||
$(gen_verbose) $(ZIP) -r $(ZIP_V) $@ $(SOURCE_DIST)
|
||||
|
||||
clean:: clean-source-dist
|
||||
|
||||
clean-source-dist:
|
||||
$(gen_verbose) rm -f $(SOURCE_DIST).*
|
||||
$(gen_verbose) rm -rf -- $(SOURCE_DIST_BASE)-*
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
ERLANG_MK_FILENAME := $(realpath $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
ERLANG_MK_VERSION = 1.2.0-700-g8140907-dirty
|
||||
ERLANG_MK_VERSION = 1.2.0-738-gaac8996-dirty
|
||||
|
||||
# Core configuration.
|
||||
|
||||
|
|
@ -45,7 +45,6 @@ export ERLANG_MK_TMP
|
|||
ERL = erl +A0 -noinput -boot start_clean
|
||||
|
||||
# Platform detection.
|
||||
# @todo Add Windows/Cygwin detection eventually.
|
||||
|
||||
ifeq ($(PLATFORM),)
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
|
@ -64,6 +63,10 @@ else ifeq ($(UNAME_S),NetBSD)
|
|||
PLATFORM = netbsd
|
||||
else ifeq ($(UNAME_S),OpenBSD)
|
||||
PLATFORM = openbsd
|
||||
else ifeq ($(UNAME_S),DragonFly)
|
||||
PLATFORM = dragonfly
|
||||
else ifeq ($(shell uname -o),Msys)
|
||||
PLATFORM = msys2
|
||||
else
|
||||
$(error Unable to detect platform. Please open a ticket with the output of uname -a.)
|
||||
endif
|
||||
|
|
@ -90,7 +93,10 @@ ifneq ($(wildcard erl_crash.dump),)
|
|||
$(gen_verbose) rm -f erl_crash.dump
|
||||
endif
|
||||
|
||||
distclean:: clean
|
||||
distclean:: clean distclean-tmp
|
||||
|
||||
distclean-tmp:
|
||||
$(gen_verbose) rm -rf $(ERLANG_MK_TMP)
|
||||
|
||||
help::
|
||||
$(verbose) printf "%s\n" \
|
||||
|
|
@ -103,6 +109,8 @@ help::
|
|||
" all Run deps, app and rel targets in that order" \
|
||||
" app Compile the project" \
|
||||
" deps Fetch dependencies (if needed) and compile them" \
|
||||
" fetch-deps Fetch dependencies (if needed) without compiling them" \
|
||||
" list-deps Fetch dependencies (if needed) and list them" \
|
||||
" search q=... Search for a package in the built-in index" \
|
||||
" rel Build a release for this project, if applicable" \
|
||||
" docs Build the documentation for this project" \
|
||||
|
|
@ -171,15 +179,15 @@ core_ls = $(filter-out $(1),$(shell echo $(1)))
|
|||
|
||||
# Automated update.
|
||||
|
||||
ERLANG_MK_GIT_REPOSITORY ?= https://github.com/ninenines/erlang.mk
|
||||
ERLANG_MK_GIT_REF ?=
|
||||
ERLANG_MK_REPO ?= https://github.com/ninenines/erlang.mk
|
||||
ERLANG_MK_COMMIT ?=
|
||||
ERLANG_MK_BUILD_CONFIG ?= build.config
|
||||
ERLANG_MK_BUILD_DIR ?= .erlang.mk.build
|
||||
|
||||
erlang-mk:
|
||||
git clone $(ERLANG_MK_GIT_REPOSITORY) $(ERLANG_MK_BUILD_DIR)
|
||||
git clone $(ERLANG_MK_REPO) $(ERLANG_MK_BUILD_DIR)
|
||||
if [ -f $(ERLANG_MK_BUILD_CONFIG) ]; then cp $(ERLANG_MK_BUILD_CONFIG) $(ERLANG_MK_BUILD_DIR)/build.config; fi
|
||||
cd $(ERLANG_MK_BUILD_DIR) && $(if $(ERLANG_MK_GIT_REF),git checkout $(ERLANG_MK_GIT_REF) &&) $(MAKE)
|
||||
cd $(ERLANG_MK_BUILD_DIR) && $(if $(ERLANG_MK_COMMIT),git checkout $(ERLANG_MK_COMMIT) &&) $(MAKE)
|
||||
cp $(ERLANG_MK_BUILD_DIR)/erlang.mk ./erlang.mk
|
||||
rm -rf $(ERLANG_MK_BUILD_DIR)
|
||||
|
||||
|
|
@ -3976,7 +3984,7 @@ endif
|
|||
# Copyright (c) 2013-2015, Loïc Hoguin <essen@ninenines.eu>
|
||||
# This file is part of erlang.mk and subject to the terms of the ISC License.
|
||||
|
||||
.PHONY: distclean-deps distclean-pkg
|
||||
.PHONY: fetch-deps list-deps distclean-deps distclean-pkg
|
||||
|
||||
# Configuration.
|
||||
|
||||
|
|
@ -4006,6 +4014,26 @@ dep_verbose = $(dep_verbose_$(V))
|
|||
|
||||
# Core targets.
|
||||
|
||||
ifneq ($(SKIP_DEPS),)
|
||||
fetch-deps:
|
||||
else
|
||||
fetch-deps: $(ALL_DEPS_DIRS)
|
||||
ifneq ($(IS_DEP),1)
|
||||
$(verbose) rm -f $(ERLANG_MK_TMP)/fetch-deps.log
|
||||
endif
|
||||
$(verbose) mkdir -p $(ERLANG_MK_TMP)
|
||||
$(verbose) for dep in $(ALL_DEPS_DIRS) ; do \
|
||||
if grep -qs ^$$dep$$ $(ERLANG_MK_TMP)/fetch-deps.log; then \
|
||||
echo -n; \
|
||||
else \
|
||||
echo $$dep >> $(ERLANG_MK_TMP)/fetch-deps.log; \
|
||||
if [ -f $$dep/erlang.mk ]; then \
|
||||
$(MAKE) -C $$dep fetch-deps IS_DEP=1 || exit $$?; \
|
||||
fi \
|
||||
fi \
|
||||
done
|
||||
endif
|
||||
|
||||
ifneq ($(SKIP_DEPS),)
|
||||
deps::
|
||||
else
|
||||
|
|
@ -4029,6 +4057,29 @@ endif
|
|||
done
|
||||
endif
|
||||
|
||||
ERLANG_MK_RECURSIVE_DEPS_LIST = $(ERLANG_MK_TMP)/list-deps.log
|
||||
|
||||
$(ERLANG_MK_RECURSIVE_DEPS_LIST): fetch-deps
|
||||
ifneq ($(IS_DEP),1)
|
||||
$(verbose) rm -f $(ERLANG_MK_TMP)/list-deps.log.orig
|
||||
endif
|
||||
$(verbose) for dep in $(filter-out $(CURDIR),$(ALL_DEPS_DIRS)); do \
|
||||
(test -f "$$dep/erlang.mk" && \
|
||||
$(MAKE) -C "$$dep" --no-print-directory \
|
||||
$(ERLANG_MK_RECURSIVE_DEPS_LIST) IS_DEP=1) || :; \
|
||||
done
|
||||
$(verbose) for dep in $(DEPS); do \
|
||||
echo $(DEPS_DIR)/$$dep; \
|
||||
done >> $(ERLANG_MK_TMP)/list-deps.log.orig
|
||||
ifneq ($(IS_DEP),1)
|
||||
$(verbose) sort < $(ERLANG_MK_TMP)/list-deps.log.orig \
|
||||
| uniq > $(ERLANG_MK_TMP)/list-deps.log
|
||||
$(verbose) rm -f $(ERLANG_MK_TMP)/list-deps.log.orig
|
||||
endif
|
||||
|
||||
list-deps: $(ERLANG_MK_RECURSIVE_DEPS_LIST)
|
||||
$(verbose) cat $(ERLANG_MK_TMP)/list-deps.log
|
||||
|
||||
distclean:: distclean-deps distclean-pkg
|
||||
|
||||
# Deps related targets.
|
||||
|
|
@ -4648,21 +4699,15 @@ asn1_verbose = $(asn1_verbose_$(V))
|
|||
mib_verbose_0 = @echo " MIB " $(filter %.bin %.mib,$(?F));
|
||||
mib_verbose = $(mib_verbose_$(V))
|
||||
|
||||
ifneq ($(wildcard src/),)
|
||||
|
||||
# Targets.
|
||||
|
||||
ifeq ($(wildcard ebin/test),)
|
||||
ifneq ($(wildcard src/),)
|
||||
app:: $(PROJECT).d
|
||||
else
|
||||
app::
|
||||
endif
|
||||
$(verbose) $(MAKE) --no-print-directory app-build
|
||||
else
|
||||
ifneq ($(wildcard src/),)
|
||||
app:: clean $(PROJECT).d
|
||||
else
|
||||
app:: clean
|
||||
endif
|
||||
$(verbose) $(MAKE) --no-print-directory app-build
|
||||
endif
|
||||
|
||||
|
|
@ -4691,15 +4736,11 @@ define app_file
|
|||
endef
|
||||
endif
|
||||
|
||||
ifneq ($(wildcard src/),)
|
||||
app-build: ebin/$(PROJECT).app
|
||||
endif
|
||||
|
||||
app-build: ; @echo -n
|
||||
$(verbose) echo -n
|
||||
|
||||
# Source files.
|
||||
|
||||
ifneq ($(wildcard src/),)
|
||||
ERL_FILES = $(sort $(call core_find,src/,*.erl))
|
||||
CORE_FILES = $(sort $(call core_find,src/,*.core))
|
||||
|
||||
|
|
@ -4816,7 +4857,8 @@ endef
|
|||
ebin/$(PROJECT).app:: $(ERL_FILES) $(CORE_FILES)
|
||||
$(if $(strip $?),$(call compile_erl,$?))
|
||||
$(eval GITDESCRIBE := $(shell git describe --dirty --abbrev=7 --tags --always --first-parent 2>/dev/null || true))
|
||||
$(eval MODULES := $(patsubst %,'%',$(sort $(notdir $(basename $(ERL_FILES) $(CORE_FILES))))))
|
||||
$(eval MODULES := $(patsubst %,'%',$(sort $(notdir $(basename \
|
||||
$(filter-out $(ERLC_EXCLUDE_PATHS),$(ERL_FILES) $(CORE_FILES)))))))
|
||||
ifeq ($(wildcard src/$(PROJECT).app.src),)
|
||||
$(app_verbose) echo $(subst $(newline),,$(subst ",\",$(call app_file,$(GITDESCRIBE),$(MODULES)))) \
|
||||
> ebin/$(PROJECT).app
|
||||
|
|
@ -4831,8 +4873,6 @@ else
|
|||
> ebin/$(PROJECT).app
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
clean:: clean-app
|
||||
|
||||
clean-app:
|
||||
|
|
@ -4842,6 +4882,8 @@ clean-app:
|
|||
$(addprefix include/,$(patsubst %.asn1,%.asn1db,$(notdir $(ASN1_FILES)))) \
|
||||
$(addprefix src/,$(patsubst %.asn1,%.erl,$(notdir $(ASN1_FILES))))
|
||||
|
||||
endif
|
||||
|
||||
# Copyright (c) 2015, Viktor Söderqvist <viktor@zuiderkwast.se>
|
||||
# This file is part of erlang.mk and subject to the terms of the ISC License.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue