genode/tool/ports/prepare_port
Roman Iten 1caa2ff3cb prepare_port: fix race condition in safety rule
The safe guard Git repository in $(CONTRIB_DIR) may only be initialized
once, regardless of the number of ports to be prepared.

Issue #3235
2019-04-01 19:33:49 +02:00

48 lines
1.1 KiB
Makefile
Executable File

#!/usr/bin/make -f
#
# \brief Tool for preparing and updating ports
# \author Martin Stein
# \date 2016-02-03
#
ifndef VERBOSE
MAKEFLAGS += --no-print-directory
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"
@echo
@echo "usage:"
@echo
@echo " $(notdir $(MAKEFILE_LIST)) [-j<n>] <ports>"
@echo
@echo " -j<n> prepare <n> ports in parallel at a max, default is 1"
@echo
@echo " <ports> whitespace-separated list of ports"
@echo
TARGETS = $(sort $(MAKECMDGOALS))
.PHONY: $(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 $@