##############################################################################
#                                                                            #
#                                  javatools                                 #
#                                                                            #
#                              M a k e f i l e                               #
#                                                                            #
#                     Copyright (C) 1998-2006, AdaCore                       #
#                                                                            #
#  GNAT is free software;  you can  redistribute it  and/or modify it under  #
#  terms of the  GNU General Public License as published  by the Free Soft-  #
#  ware  Foundation;  either version 2,  or (at your option) any later ver-  #
#  sion.  GNAT is distributed in the hope that it will be useful, but WITH-  #
#  OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY  #
#  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License  #
#  for  more details.  You should have  received  a copy of the GNU General  #
#  Public License  distributed with GNAT;  see file COPYING.  If not, write  #
#  to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston,  #
#  MA 02111-1307, USA.                                                       #
#                                                                            #
##############################################################################

include Makefile.conf

# Assume tool_utils is copied in the current directory
export ASIS_TOOL_UTILS=${shell echo "`pwd`/tool_utils"}

jnitools: setup jni_build jvm2ada ada2java javastub

setup:
	$(MAKE) -C src/jvm setup
	$(MAKE) -C jni setup

jvm2ada: setup
	$(MAKE) -C src/jvm jvm2ada

javastub: setup
	$(MAKE) -C src/jvm javastub

jni_build:
	$(MAKE) -C jni

ada2java: jni_build
	$(MAKE) -C prototypes/ada2java runtime_ada
	$(MAKE) -C prototypes/ada2java ada2java

jnitools_install: jnitools
	$(MAKE) -C jni install INSTALL_DIR="$(INSTALL_DIR)"
	$(MAKE) -C prototypes/ada2java install INSTALL_DIR="$(INSTALL_DIR)"
	$(COPY) src/jvm/bin/javastub$(EXE_EXT) "$(INSTALL_DIR)/bin"
	$(COPY) src/jvm/bin/jvm2ada$(EXE_EXT) "$(INSTALL_DIR)/bin"
	$(MKDIR) -p "$(INSTALL_DIR)/share/doc/ajis"
	$(MKDIR) -p "$(INSTALL_DIR)/share/examples/ajis"
	$(COPY) -p distrib/features "$(INSTALL_DIR)/share/doc/ajis"
	$(COPY) -p distrib/known-problems "$(INSTALL_DIR)/share/doc/ajis"
	$(COPY) -pr distrib/examples/* "$(INSTALL_DIR)/share/examples/ajis"
	$(COPY) -p distrib/doinstall "$(INSTALL_DIR)"
	$(COPY) -pr share "$(INSTALL_DIR)"
