#-- start of java_header ------

${CONSTITUENT}javadirs ::
	$(silent) if test ! -d $(javabin)${CONSTITUENT} ; then $(mkdir) -p $(javabin)${CONSTITUENT} ; fi

${CONSTITUENT} :: ${CONSTITUENT}javadirs $(javabin)${CONSTITUENT}.jar
	$(echo) "${CONSTITUENT} ok"

cmt_${CONSTITUENT}_${HASPROTOTYPES} = 1

#--------------------------------------

ifdef cmt_${CONSTITUENT}_has_prototypes

${CONSTITUENT}prototype : ${PROTOTARGET} ;

endif

${CONSTITUENT}compile : ${OBJS} ;

$(javabin)${CONSTITUENT}.jar :: ${OBJS}
	$(java_echo) $@
	$(java_silent)cd $(javabin)${CONSTITUENT}; \
	  echo "Main-Class: ${CONSTITUENT}" >| ${CONSTITUENT}.jmf; \
	  $(jar) -cmvf ${CONSTITUENT}.jmf ../${CONSTITUENT}.jar *

install_dir = ${CMTINSTALLAREA}/share/bin
${CONSTITUENT}installname = ${CONSTITUENT}.jar

${CONSTITUENT} :: ${CONSTITUENT}install ;

install :: ${CONSTITUENT}install ;

${CONSTITUENT}install :: $(install_dir)/$(${CONSTITUENT}installname)
ifdef CMTINSTALLAREA
	$(echo) "installation done"
endif

$(install_dir)/$(${CONSTITUENT}installname) :: $(javabin)$(${CONSTITUENT}installname)
ifdef CMTINSTALLAREA
	$(install_silent) $(cmt_install_action) \
	    -source "$(PACKAGE_ROOT)/classes" \
	    -name "$(${CONSTITUENT}installname)" \
	    -out "$(install_dir)" \
	    -cmd "$(cmt_installarea_command)" \
	    -cmtpath "$($(package)_cmtpath)"
endif

##${CONSTITUENT}clean :: ${CONSTITUENT}uninstall

uninstall :: ${CONSTITUENT}uninstall ;

${CONSTITUENT}uninstall ::
ifdef CMTINSTALLAREA
	$(cleanup_silent) $(cmt_uninstall_action) \
	    -source "$(PACKAGE_ROOT)/classes" \
	    -name "$(${CONSTITUENT}installname)" \
	    -out "$(install_dir)" \
	    -cmtpath "$($(package)_cmtpath)"
endif

${CONSTITUENT}clean ::
	$(cleanup_silent) /bin/rm -rf $(javabin)/${CONSTITUENT}
	$(cleanup_silent) /bin/rm -f $(javabin)/${CONSTITUENT}.jar

#-- end of java_header ------
