<?xml version="1.0" encoding="UTF-8"?>
<!--
  	ANT
 
  	Copyright 2013-2023 IS2T. All rights reserved.
	Modification and distribution is permitted under certain conditions.
  	IS2T PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
-->
<project name="partialLinkGTInit">

	<!-- 
		Generate link file for GreenThread VM
	-->

	<import file="${ant.file.partialLinkGTInit}/../../extension-init.xml" />
	<import file="${ant.file.partialLinkGTInit}/../../microejAntlib.xml" />
		
	<target name="createLinkFileGT" extensionOf="init/execution" if="onBoard">
		<!-- temporary link files -->
		<local name="link.files.dir"/>
		<microejtempfile deleteonexit="true" prefix="linkGT" property="link.files.dir"/>
		<mkdir dir="${link.files.dir}"/>
		
		<!-- Try to load a MJVM configuration from a properties file defined in the scripts -->
		<property file="${scripts.dir}/mjvm.properties"/>
		
		<local name="link.sizes"/>
		<property name="link.sizes" value="${link.files.dir}/sizes.lscf" />

		<!-- 
			Set options default values if not set
			(in sync with XPF workbench extension default values)
		-->
		<property name="core.memory.threads.size" value="5"/>
		<property name="core.memory.thread.block.size" value="512"/>
		<property name="core.memory.thread.max.size" value="4"/>
		<property name="core.memory.threads.pool.size" value="15"/>
		<property name="core.memory.thread.max.nb.monitors" value="8" />
			
		<fail unless="arch.symbol.prefix" message="Please define the 'arch.symbol.prefix' property"/>
		
		<!-- create the size file -->
		<echoxml file="${link.sizes}" append="false">
			<lscFragment>
				<defSymbol name="${arch.symbol.prefix}_java_max_nb_standaloneEngines" value="${core.memory.threads.size}" rootSymbol="true"/>
				<defSymbol name="${arch.symbol.prefix}_java_max_nb_monitors_per_thread" value="${core.memory.thread.max.nb.monitors}" rootSymbol="true"/>
			</lscFragment>
		</echoxml>
		
		<augment id="partialLink.lscf.path">
			<path location="${link.files.dir}"/>
		</augment>
	</target>
		
</project>
