aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <[email protected]>2015-09-08 11:02:34 +0200
committerJean-Sébastien Pédron <[email protected]>2015-09-09 12:14:13 +0200
commitc20251fa40ce7dc59d1d7f875f2867ea410ebbc1 (patch)
tree96d9e3173bfd4332ff9066887b2f29e7214cc740
parentb9c0bd643746ddd3424a91f6dd3cb6ad299cd342 (diff)
downloaderlang.mk-c20251fa40ce7dc59d1d7f875f2867ea410ebbc1.tar.gz
erlang.mk-c20251fa40ce7dc59d1d7f875f2867ea410ebbc1.tar.bz2
erlang.mk-c20251fa40ce7dc59d1d7f875f2867ea410ebbc1.zip
core.mk: Allow to take erlang.mk from an alternate Git repository
-rw-r--r--core/core.mk6
-rw-r--r--test/Makefile30
2 files changed, 33 insertions, 3 deletions
diff --git a/core/core.mk b/core/core.mk
index f5ada0b..a41a240 100644
--- a/core/core.mk
+++ b/core/core.mk
@@ -173,13 +173,15 @@ core_ls = $(filter-out $(1),$(shell echo $(1)))
# Automated update.
+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 https://github.com/ninenines/erlang.mk $(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) && $(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)
diff --git a/test/Makefile b/test/Makefile
index b987cd8..5ca47bc 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1323,7 +1323,7 @@ $(CORE_APP_CLEAN_TARGETS):
# Core: Erlang.mk upgrade.
-CORE_UPGRADE_CASES = no-config custom-config renamed-config custom-build-dir
+CORE_UPGRADE_CASES = alt-erlangmk-repo no-config custom-config renamed-config custom-build-dir
CORE_UPGRADE_TARGETS = $(addprefix core-upgrade-,$(CORE_UPGRADE_CASES))
CORE_UPGRADE_CLEAN_TARGETS = $(addprefix clean-,$(CORE_UPGRADE_TARGETS))
@@ -1331,6 +1331,34 @@ CORE_UPGRADE_CLEAN_TARGETS = $(addprefix clean-,$(CORE_UPGRADE_TARGETS))
core-upgrade: $(CORE_UPGRADE_TARGETS)
+core-upgrade-alt-erlangmk-repo: build clean-core-upgrade-alt-erlangmk-repo
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Fork erlang.mk locally and modify it"
+ $t git clone -q file://$(abspath $(CURDIR)/..) $(APP)/alt-erlangmk-repo
+ $t sed -i.bak '1i\
+# Copyright (c) erlang.mk Testsuite!\
+' $(APP)/alt-erlangmk-repo/core/core.mk
+ $t (cd $(APP)/alt-erlangmk-repo && \
+ git checkout -q -b test-copyright && \
+ git commit -q -a -m 'Add Testsuite copyright')
+
+ $i "Point application to an alternate erlang.mk repository"
+ $t sed -i.bak '2i\
+ERLANG_MK_REPO = file://$(abspath $(APP)/alt-erlangmk-repo)\
+ERLANG_MK_COMMIT = test-copyright\
+' $(APP)/Makefile
+
+ $i "Update erlang.mk"
+ $t $(MAKE) -C $(APP) erlang-mk $v
+
+ $i "Check our modification is there"
+ $t grep -q "# Copyright (c) erlang.mk Testsuite!" $(APP)/erlang.mk
+
core-upgrade-no-config: build clean-core-upgrade-no-config
$i "Bootstrap a new OTP library named $(APP)"