#

# Copyright 2020 OpenHW Group
# 
# Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     https://solderpad.org/licenses/
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
#
###############################################################################
#
# Redirection script to point to makefile under core with:
# $(CV_CORE)/sim/uvmt/Makefile
#
###############################################################################

# Validate CV_CORE
ifndef CV_CORE
$(error Must set CV_CORE to a valid core)
endif

# Variables
MAKE           = make
MAKE_PATH     := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
CORE_V_VERIF   = $(abspath $(MAKE_PATH)/..)
CV_CORE_LC     = $(shell echo $(CV_CORE) | tr A-Z a-z)

# If no targets specified, run default target in CV_CORE
all:
	$(MAKE) -C $(CORE_V_VERIF)/$(CV_CORE_LC)/sim/uvmt

# If specified recursively run each target in CV_CORE
%:
	$(MAKE) -C $(CORE_V_VERIF)/$(CV_CORE_LC)/sim/uvmt $@
