#!/usr/bin/make -f

#
# \brief  Tool for checking the hash file of a port
# \author Christian Helmuth
# \author Norman Feske
# \date   2018-04-23
#

#
# Determine Genode base directory based on the known location of the
# 'create_builddir' tool within the Genode source tree
#
GENODE_DIR := $(realpath $(dir $(MAKEFILE_LIST))/../..)

include $(GENODE_DIR)/tool/ports/mk/front_end.inc
include $(GENODE_DIR)/tool/ports/mk/check_port_arg.inc

usage:
	@$(ECHO)
	@$(ECHO) "--- check hash file of a port ---"
	@$(ECHO) "usage: check_hash <port-name>"
	@$(ECHO)

include $(PORT)

_DST_HASH_FILE := $(shell mktemp -qt $(firstword tmpXXX.$(TARGET)).hash)

# XXX remove this line when the tool has stabilized
STRICT_HASH ?= no

include $(GENODE_DIR)/tool/ports/mk/hash.inc

check_and_remove: _check_hash
	$(VERBOSE)rm -f $(_DST_HASH_FILE)

.PHONY: $(_DST_HASH_FILE)

$(TARGET): check_and_remove
