## 
## -------------------------------------------------------------
##    Copyright 2008 Cadence Design Systems, Inc.
##    All Rights Reserved Worldwide
## 
##    Licensed under the Apache License, 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
## 
##        http://www.apache.org/licenses/LICENSE-2.0
## 
##    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.
## -------------------------------------------------------------
## 

INCLUDE_OVM?=1

VMM_HOME ?= ../../../..
OVM_HOME ?= $(shell ncroot)/tools/ovm
INTEROP_HOME?=../..

OVM_EXAMPLE_ARGS = -ovmhome $(OVM_HOME) -incdir $(VMM_HOME)/sv -incdir $(INTEROP_HOME)/src $(VMM_HOME)/sv/std_lib/vmm_str_dpi.c


SOURCES = $(shell find . | grep '/[0-9][0-9]*_.*\.sv' | sort)
TARGETS = $(subst .sv,,$(SOURCES))

# used for 04_IP_integration
HFPB_INCLUDE = +incdir+../src/hfpb \
               +incdir+../src/hfpb_components

# used for 05
APB_INCLUDE = +incdir+$(INTEROP_HOME)/examples/src

# used for 03_vmm_on_top
APB_ENV_HOME = $(VMM_HOME)/sv/examples/sb/apb_bus

run: $(TARGETS)

% : %.sv 
	irun $(OVM_EXAMPLE_ARGS) $@.sv \
	$(APB_INCLUDE) $(HFPB_INCLUDE) -l $@.log +vmm_log_default=trace 

clean:
	rm -rf INCA_libs *.log
