<project name="jcademo" default="deploy">
	<target name="native">
        <javah classpath="bin" destdir="native">
            <class name="jcademo.raoutbound.natmultcp.NatMulTCP"/>
        </javah>
        <exec executable="gcc">
            <arg value="-c"/>
            <arg value="-I\SUN\64bit\jdk1.8.0_192\include"/>
            <arg value="-I\SUN\64bit\jdk1.8.0_192\include\win32"/>
            <arg value="-Inative"/>
        	<arg value="-Wall"/>
            <arg value="native\jcademo_raoutbound_natmultcp_NatMulTCP.c"/>
            <arg value="-o"/>
            <arg value="\work\jcademo_raoutbound_natmultcp_NatMulTCP.obj"/>
        </exec>
        <exec executable="gcc">
            <arg value="-s"/>
            <arg value="-shared"/>
            <arg value="-Wl,--export-all,--kill-at"/>
            <arg value="\work\jcademo_raoutbound_natmultcp_NatMulTCP.obj"/>
            <arg value="-o"/>
            <arg value="\work\NatMulTCP.dll"/>
        	<arg value="-lws2_32"/>
        </exec>
	</target>
	<target name="pack" depends="native">
		<war warfile="/work/test.war" webxml="web.xml">
            <classes dir="bin" includes="jcademo/client/*.class"/>
            <webinf dir="." includes="jboss-deployment-structure.xml"/>
		</war>
        <jar destfile="/work/multcp.jar">
            <fileset dir="bin" includes="jcademo/raoutbound/multcp/*.class"/>
        </jar>
        <jar destfile="/work/test-multcp.rar">
            <fileset dir="/work" includes="multcp.jar"/>
            <metainf dir="multcp" includes="ra.xml,ironjacamar.xml"/>
        </jar>
        <jar destfile="/work/multcp_cci.jar">
            <fileset dir="bin" includes="jcademo/raoutbound/multcp_cci/*.class"/>
        </jar>
        <jar destfile="/work/test-multcp_cci.rar">
            <fileset dir="/work" includes="multcp_cci.jar"/>
            <metainf dir="multcp_cci" includes="ra.xml,ironjacamar.xml"/>
        </jar>
        <jar destfile="/work/tcp.jar">
            <fileset dir="bin" includes="jcademo/raoutbound/tcp/*.class"/>
        </jar>
        <jar destfile="/work/test-tcp.rar">
            <fileset dir="/work" includes="tcp.jar"/>
            <metainf dir="tcp" includes="ra.xml,ironjacamar.xml"/>
        </jar>
        <jar destfile="/work/permtcp.jar">
            <fileset dir="bin" includes="jcademo/raoutbound/permtcp/*.class"/>
        </jar>
        <jar destfile="/work/test-permtcp.rar">
            <fileset dir="/work" includes="permtcp.jar"/>
            <metainf dir="permtcp" includes="ra.xml,ironjacamar.xml"/>
        </jar>
        <jar destfile="/work/udp.jar">
            <fileset dir="bin" includes="jcademo/raoutbound/udp/*.class"/>
        </jar>
        <jar destfile="/work/test-udp.rar">
            <fileset dir="/work" includes="udp.jar"/>
            <metainf dir="udp" includes="ra.xml,ironjacamar.xml"/>
        </jar>
        <jar destfile="/work/natmultcp.jar">
            <fileset dir="bin" includes="jcademo/raoutbound/natmultcp/*.class"/>
        </jar>
        <jar destfile="/work/test-natmultcp.rar">
            <fileset dir="/work" includes="natmultcp.jar,NatMulTCP.dll"/>
            <metainf dir="natmultcp" includes="ra.xml,ironjacamar.xml"/>
        </jar>
        <ear destfile="/work/test.ear" appxml="application.xml">
            <fileset dir="/work" includes="test.war,test-multcp.rar,test-multcp_cci.rar,test-tcp.rar,test-permtcp.rar,test-udp.rar,test-natmultcp.rar"/>
        </ear>
	</target>
    <target name="deploy" depends="pack">
    	<copy file="/work/test.ear" todir="/JBoss/wildfly-10.1.0.Final/standalone/deployments"/>
	</target>
</project>