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

	<!-- 
		Generate link file for VM with Mark and Compact GC
	-->

	<import file="${ant.file.markAndCompactGCInit}/../../extension-init.xml" />
	<import file="${ant.file.markAndCompactGCInit}/../../microejAntlib.xml" />
		
	<target name="createLinkFileMarkandCompactGC" extensionOf="init/execution" if="onBoard">
		<defineOption name="com.microej.runtime.core.gc.markstack.levels.max" defaultValue="32"/>
		
		<!-- temporary link files -->
		<local name="link.files.dir"/>
		<microejtempfile deleteonexit="true" prefix="linkMarkAndCompactGC" property="link.files.dir"/>
		<mkdir dir="${link.files.dir}"/>
		
		<local name="link.sizes"/>
		<property name="link.sizes" value="${link.files.dir}/sizes.lscf" />
		
		<fail unless="arch.symbol.prefix" message="Please define the 'arch.symbol.prefix' property"/>
		
		<!-- create the size file -->
		<echoxml file="${link.sizes}" append="false">
			<lscFragment>
				<!-- Size of mark stack -->
				<defSymbol name="${arch.symbol.prefix}_jvm_gc_max_stack_level" value="${com.microej.runtime.core.gc.markstack.levels.max}"/>
			</lscFragment>
		</echoxml>
		
		<augment id="partialLink.lscf.path">
			<path location="${link.files.dir}"/>
		</augment>
	</target>
		
</project>
