#!/bin/sh

# $TSUKUBA_Release: Omni Compiler Version 0.9.1 $
# $TSUKUBA_Copyright:
#  Copyright (C) 2010-2014 University of Tsukuba, 
#  	      2012-2014  University of Tsukuba and Riken AICS
#  
#  This software is free software; you can redistribute it and/or modify
#  it under the terms of the GNU Lesser General Public License version
#  2.1 published by the Free Software Foundation.
#  
#  Please check the Copyright and License information in the files named
#  COPYRIGHT and LICENSE under the top  directory of the Omni Compiler
#  Software release kit.
#  
#  * The specification of XcalableMP has been designed by the XcalableMP
#    Specification Working Group (http://www.xcalablemp.org/).
#  
#  * The development of this software was partially supported by "Seamless and
#    Highly-productive Parallel Programming Environment for
#    High-performance computing" project funded by Ministry of Education,
#    Culture, Sports, Science and Technology, Japan.
#  $
# $Id$

genJARjdk () {
    /usr/bin/jar cf ${target} $*
}

genJARkaffe () {
    TMPDIR=/tmp/.genjar.$$
    rm -rf ${TMPDIR}
    mkdir ${TMPDIR}
    tar cpf - $* | ( cd ${TMPDIR}; tar xpf - )
    (cd ${TMPDIR}; /usr/bin/zip -q -DX -r ${target} .)
    mv ${TMPDIR}/${target} .
    rm -rf ${TMPDIR}
}

target=$1
shift

isKaffe=no
useGcj=no
if test "x${isKaffe}" = "xyes" -o "x${useGcj}" = "xyes"; then
    genJARkaffe ${1+"$@"}
else
    genJARjdk ${1+"$@"}
fi
exit 0

