
rule SetSimulationBuild level
{
	USB_INPUT = false ;
	
	SetBuild "emu" : $(level) ;
}

rule SetBareMetalBuild level
{
	USB_INPUT = true ;
	
	SetBuild "iso" : $(level) ;
}


rule SetBuild suffix : level
{
	# split $(JAM_TARGETS) into a prefix and build-level:
	local res = [ MATCH (.*).$(suffix)(.?) : $(JAM_TARGETS) ] ;
	
	local prefix = $(res[1]) ;  # e.g. "hog-demos"
	level ?= $(res[2]) ;  # e.g. "6"
	
	#echo $(res) ;
	#echo $(prefix) ;
	#echo $(level) ;
	
	# redirect build target from *.emu to *.run
	# e.g. "hog-demos.run"
	JAM_TARGETS = $(prefix).run ;
	echo "...redirecting to target '" $(JAM_TARGETS) "' with build level '" $(level) "' " ;
	
	# e.g. "LayerLevel = 6 ;" etc
	#
	DEFINES += hog_TEST_LEVEL=$(level) ;  # in case misc-tests/* is involved (only in t1-t9 scenarios)
	LayerLevel = $(level) ;  # what to include in haiku.lib.so (all scenarios)
}

