diff --git a/tool/ports/mk/common.inc b/tool/ports/mk/common.inc index 1c80f09e5..b4e420d85 100644 --- a/tool/ports/mk/common.inc +++ b/tool/ports/mk/common.inc @@ -4,6 +4,9 @@ # \date 2014-05-27 # +# compound directory where all 3rd-party source codes are installed +CONTRIB_DIR ?= $(GENODE_DIR)/contrib + SHELL := bash VERBOSE ?= @ ECHO := echo -e diff --git a/tool/ports/mk/front_end.inc b/tool/ports/mk/front_end.inc index eb5795ad2..a0bb5f807 100644 --- a/tool/ports/mk/front_end.inc +++ b/tool/ports/mk/front_end.inc @@ -17,9 +17,6 @@ $(MAKECMDGOALS) default: ARGUMENT := $(MAKECMDGOALS) PORT_NAME := $(firstword $(ARGUMENT)) -# compound directory where all 3rd-party source codes are installed -CONTRIB_DIR ?= $(GENODE_DIR)/contrib - # list of all repositories located at '/repos/' REPOSITORIES ?= $(shell find $(GENODE_DIR)/repos -follow -mindepth 1 -maxdepth 1 -type d) @@ -45,18 +42,6 @@ _REL_HASH_FILE := $(notdir $(REP_DIR))/ports/$(notdir $(PORT)) # directory where to install the port PORT_DIR := $(CONTRIB_DIR)/$(PORT_NAME)-$(HASH) -# -# Protect the GENODE_DIR Git repository by creating an -# empty Git repository in CONTRIB_DIR. This is to catch -# Git tools called by port recipes from falling through -# the parent directories of PORT_DIR and affecting other -# Git repositories. -# -$(PORT_DIR): $(CONTRIB_DIR)/.git -$(CONTRIB_DIR)/.git: - $(VERBOSE)mkdir -p $(CONTRIB_DIR) - $(VERBOSE)git init --quiet $(CONTRIB_DIR) - # path to hash file generated during installation PORT_HASH_FILE := $(PORT_DIR)/$(PORT_NAME).hash diff --git a/tool/ports/prepare_port b/tool/ports/prepare_port index b390d8039..d95f49d9b 100755 --- a/tool/ports/prepare_port +++ b/tool/ports/prepare_port @@ -12,6 +12,8 @@ endif export GENODE_DIR := $(realpath $(dir $(MAKEFILE_LIST))/../..) +include $(GENODE_DIR)/tool/ports/mk/common.inc + usage: @echo @echo "Tool for preparing and updating ports" @@ -29,5 +31,17 @@ TARGETS = $(sort $(MAKECMDGOALS)) .PHONY: $(TARGETS) -$(TARGETS): +# +# Protect the GENODE_DIR Git repository by creating an +# empty Git repository in CONTRIB_DIR. This is to catch +# Git tools called by port recipes from falling through +# the parent directories of PORT_DIR and affecting other +# Git repositories. +# +$(PORT_DIR): $(CONTRIB_DIR)/.git/HEAD +$(CONTRIB_DIR)/.git/HEAD: + @$(VERBOSE)mkdir -p $(CONTRIB_DIR) + @$(VERBOSE)git init --quiet $(CONTRIB_DIR) + +$(TARGETS): $(CONTRIB_DIR)/.git/HEAD @$(MAKE) -f $(GENODE_DIR)/tool/ports/mk/prepare_single_port.mk $@