# Top level -*- makefile -*- fragment for the GNU compiler for the Java(TM)
# language.
#   Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.

#This file is part of GCC.

#GCC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2, or (at your option)
#any later version.

#GCC is distributed in the hope that it will be useful,
#but WITHOUT 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
#along with GCC; see the file COPYING.  If not, write to
#the Free Software Foundation, 59 Temple Place - Suite 330,
#Boston, MA 02111-1307, USA.

#Java and all Java-based marks are trademarks or registered trademarks
#of Sun Microsystems, Inc. in the United States and other countries.
#The Free Software Foundation is independent of Sun Microsystems, Inc.

# This file provides the language dependent support in the main Makefile.
# Each language makefile fragment must provide the following targets:
#
# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
# foo.install-normal, foo.install-common, foo.install-man,
# foo.uninstall,
# foo.mostlyclean, foo.clean, foo.distclean,
# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
#
# where `foo' is the name of the language.
#
# It should also provide rules for:
#
# - making any compiler driver (eg: g++)
# - the compiler proper (eg: jc1)
# - define the names for selecting the language in LANGUAGES.

# Actual names to use when installing a native compiler.
JAVA_INSTALL_NAME := $(shell echo gcj|sed '$(program_transform_name)')
JAVA_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcj|sed '$(program_transform_name)')
GCJH_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcjh|sed '$(program_transform_name)')

GCJ = gcj

# Define the names for selecting java in LANGUAGES.
java: jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) \
      gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext)

# Define the name of target independent tools to be installed in $(bindir)
# Names are subject to changes
JAVA_TARGET_INDEPENDENT_BIN_TOOLS = gcjh jv-scan jcf-dump

# Tell GNU make to ignore these if they exist.
.PHONY: java

jvspec.o: $(srcdir)/java/jvspec.c $(SYSTEM_H) coretypes.h $(TM_H) \
  $(GCC_H) $(CONFIG_H)
	(SHLIB_LINK='$(SHLIB_LINK)' \
	SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
		$(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION))

# Create the compiler driver for $(GCJ).
$(GCJ)$(exeext): gcc.o jvspec.o version.o \
	   prefix.o intl.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o jvspec.o prefix.o intl.o \
	  version.o $(EXTRA_GCC_OBJS) $(LIBS)

# Create a version of the $(GCJ) driver which calls the cross-compiler.
$(GCJ)-cross$(exeext): $(GCJ)$(exeext)
	-rm -f $(GCJ)-cross$(exeext)
	cp $(GCJ)$(exeext) $(GCJ)-cross$(exeext)

java.srcextra: java/parse.c java/parse-scan.c
	-cp -p $^ $(srcdir)/java

java/parse.c: java/parse.y
	-$(BISON) -t --name-prefix=java_ $(BISONFLAGS) -o $@ $<

java/parse-scan.c: java/parse-scan.y
	-$(BISON) -t $(BISONFLAGS) -o $@ $< 

$(srcdir)/java/keyword.h: $(srcdir)/java/keyword.gperf
	(cd $(srcdir)/java || exit 1; \
	gperf -L ANSI-C -C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k1,4,$$ \
		keyword.gperf > k$$$$.h || { \
	echo "Please update gperf from ftp://ftp.gnu.org/pub/gnu/gperf/" >&2; \
	rm -f k$$$$.h; \
	exit 1; } ; \
	mv -f k$$$$.h keyword.h)

gt-java-class.h gt-java-constants.h gt-java-decl.h : s-gtype ; @true
gt-java-expr.h gt-java-jcf-parse.h gt-java-jcf-write.h : s-gtype ; @true
gt-java-lang.h gt-java-mangle.h gt-java-parse.h : s-gtype ; @true
gt-java-builtins.h gtype-java.h gt-java-resource.h : s-gtype ; @true

# Executables built by this Makefile:
JAVA_OBJS = java/parse.o java/class.o java/decl.o java/expr.o \
  java/constants.o java/lang.o java/typeck.o java/except.o java/verify.o \
  java/verify-glue.o java/verify-impl.o \
  java/zextract.o java/jcf-io.o java/win32-host.o java/jcf-parse.o java/mangle.o \
  java/mangle_name.o java/builtins.o java/resource.o \
  java/jcf-write.o java/buffer.o java/check-init.o java/jcf-depend.o \
  java/jcf-path.o java/xref.o java/boehm.o java/java-gimplify.o

GCJH_OBJS = java/gjavah.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
  java/win32-host.o java/zextract.o version.o errors.o ggc-none.o \
  intl.o

JVSCAN_OBJS = java/parse-scan.o java/jv-scan.o version.o intl.o

JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
		java/win32-host.o java/zextract.o errors.o version.o ggc-none.o intl.o

JVGENMAIN_OBJS = java/jvgenmain.o java/mangle_name.o errors.o intl.o

# Use strict warnings for this front end.
java-warn = $(STRICT_WARN)

# String length warnings
jvspec.o-warn = -Wno-error

# Bison-1.75 output often yields (harmless) -Wtraditional warnings
java/parse-scan.o-warn = -Wno-error
java/parse.o-warn = -Wno-error

jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS)
	rm -f $@
	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
		$(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS)

gcjh$(exeext): $(GCJH_OBJS) $(LIBDEPS)
	rm -f $@
	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GCJH_OBJS) $(CPPLIBS) $(ZLIB) $(LIBS)

jv-scan$(exeext): $(JVSCAN_OBJS) $(LIBDEPS)
	rm -f $@
	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVSCAN_OBJS) $(LIBICONV) $(LIBS)

jcf-dump$(exeext): $(JCFDUMP_OBJS) $(LIBDEPS)
	rm -f $@
	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JCFDUMP_OBJS) \
		$(CPPLIBS) $(ZLIB) $(LDEXP_LIB) $(LIBS)

jvgenmain$(exeext): $(JVGENMAIN_OBJS) $(LIBDEPS)
	rm -f $@
	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVGENMAIN_OBJS) $(LIBS)

#
# Build hooks:

java.all.build: $(GCJ)$(exeext)
java.all.cross: $(GCJ)-cross$(exeext)
java.start.encap: $(GCJ)$(exeext)
java.rest.encap:


java.tags: force
	cd $(srcdir)/java; etags -o TAGS.sub *.y *.c *.h --language=none \
	  --regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' java-tree.def; \
	etags --include TAGS.sub --include ../TAGS.sub


java.info: doc/gcj.info

java.srcinfo: doc/gcj.info
	-cp -p $^ $(srcdir)/doc

dvi:: doc/gcj.dvi
html:: $(htmldir)/java/index.html
JAVA_MANFILES = doc/gcj.1 doc/gcjh.1 doc/jv-scan.1 doc/jcf-dump.1 doc/gij.1 \
                doc/jv-convert.1 doc/grmic.1 doc/grmiregistry.1 \
		doc/gcj-dbtool.1

java.man: $(JAVA_MANFILES)

java.srcman: $(JAVA_MANFILES)
	-cp -p $^ $(srcdir)/doc

check-java :

# Install hooks:
# jc1, gcj, jvgenmain, and gcjh are installed elsewhere as part
# of $(COMPILERS).

# Nothing to do here.
java.install-normal:

# Install gcj as well as the target-independent tools.
# For a native build, we special-case gcjh and also install
# its explicitly-prefixed variant. This allows us to write
# portable makefiles for both cross builds (where gcjh *must*
# be explicitly prefixed) and native builds.
java.install-common: installdirs
	-if [ -f $(GCJ)$(exeext) ]; then \
	  rm -f $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
	  $(INSTALL_PROGRAM) $(GCJ)$(exeext) $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
	  chmod a+x $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
	  if [ -f $(GCJ)-cross$(exeext) ]; then \
	    true; \
	  else \
	    rm -f $(DESTDIR)$(bindir)/$(JAVA_TARGET_INSTALL_NAME)$(exeext); \
	    ( cd $(DESTDIR)$(bindir) && \
	      $(LN) $(JAVA_INSTALL_NAME)$(exeext) $(JAVA_TARGET_INSTALL_NAME)$(exeext) ); \
	  fi ; \
	fi ; \
        for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS); do \
	  tool_transformed_name=`echo $$tool|sed '$(program_transform_name)'`; \
          if [ -f $$tool$(exeext) ]; then \
	    rm -f $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
	    $(INSTALL_PROGRAM) $$tool$(exeext) $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
	    chmod a+x $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
	    if [ -f $(GCJ)-cross$(exeext) ]; then \
	      true; \
	    elif [ $$tool = gcjh ]; then \
	      rm -f $(DESTDIR)$(bindir)/$(GCJH_TARGET_INSTALL_NAME)$(exeext); \
	      ( cd $(DESTDIR)$(bindir) && \
	        $(LN) $$tool_transformed_name$(exeext) $(GCJH_TARGET_INSTALL_NAME)$(exeext) ); \
	    fi; \
          fi ; \
       done

java.install-man:

java.uninstall:
	-rm -rf $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext)
	-rm -rf $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext)
	-rm -rf $(DESTDIR)$(man1dir)/gcjh$(man1ext)
	-rm -rf $(DESTDIR)$(man1dir)/jv-scan$(man1ext)
	-rm -rf $(DESTDIR)$(man1dir)/jcf-dump$(man1ext)
	-rm -rf $(DESTDIR)$(man1dir)/gij$(man1ext)
	-rm -rf $(DESTDIR)$(man1dir)/jv-convert$(man1ext)
	-rm -rf $(DESTDIR)$(man1dir)/gcj-dbtool$(man1ext)

install-info:: $(DESTDIR)$(infodir)/gcj.info

#
# Clean hooks:
# A lot of the ancillary files are deleted by the main makefile.
# We just have to delete files specific to us.

java.mostlyclean:
	-rm -f java/parse.c java/parse-scan.c
	-rm -f java/*$(objext) $(DEMANGLER_PROG)
	-rm -f java/*$(coverageexts)
	-rm -f jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext) s-java
java.clean:
java.distclean:
	-rm -f java/config.status java/Makefile
	-rm -f java/parse.output java/y.tab.c
java.maintainer-clean:
	-rm -f $(docobjdir)/gcj.1 $(docobjdir)/gcjh.1
	-rm -f $(docobjdir)/jv-scan.1 $(docobjdir)/jcf-dump.1
	-rm -f $(docobjdir)/gij.1
	-rm -f $(docobjdir)/jv-convert.1
	-rm -f $(docobjdir)/grmic.1
	-rm -f $(docobjdir)/grmiregistry.1
	-rm -f $(docobjdir)/gcj-dbtool.1
#
# Stage hooks:
# The main makefile has already created stage?/java.

java.stage1: stage1-start
	-mv java/*$(objext) stage1/java
java.stage2: stage2-start
	-mv java/*$(objext) stage2/java
java.stage3: stage3-start
	-mv java/*$(objext) stage3/java
java.stage4: stage4-start
	-mv java/*$(objext) stage4/java
java.stageprofile: stageprofile-start
	-mv java/*$(objext) stageprofile/java
java.stagefeedback: stageprofile-start
	-mv java/*$(objext) stagefeedback/java

#
# .o:.h dependencies.
JAVA_TREE_H = $(TREE_H) $(HASHTAB_H) java/java-tree.h java/java-tree.def
JAVA_LEX_C = java/lex.c java/keyword.h java/chartables.h

java/jcf-dump.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(JAVA_TREE_H) \
  java/jcf-dump.c java/jcf-reader.c java/jcf.h java/javaop.h java/javaop.def \
  version.h $(GGC_H) intl.h
java/gjavah.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(JAVA_TREE_H) \
  java/gjavah.c java/jcf-reader.c java/jcf.h java/javaop.h version.h $(GGC_H) \
  intl.h
java/boehm.o: java/boehm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
  $(TREE_H) $(JAVA_TREE_H) java/parse.h toplev.h
java/buffer.o: java/buffer.c $(CONFIG_H) java/buffer.h $(SYSTEM_H) coretypes.h \
  $(TM_H) toplev.h
java/builtins.o: java/builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
  $(JAVA_TREE_H) $(GGC_H) flags.h langhooks.h gt-java-builtins.h
java/check-init.o: java/check-init.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \
  coretypes.h $(TM_H) toplev.h
java/class.o: java/class.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
  $(JAVA_TREE_H) $(RTL_H) java/jcf.h java/parse.h toplev.h output.h $(GGC_H) \
  $(TARGET_H) function.h gt-java-class.h
java/constants.o: java/constants.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
  toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) gt-java-constants.h
java/decl.o: java/decl.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) java/jcf.h \
  toplev.h flags.h $(SYSTEM_H) coretypes.h $(TM_H) function.h expr.h \
  libfuncs.h except.h java/java-except.h $(GGC_H) real.h gt-java-decl.h \
  target.h
java/except.o: java/except.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h real.h \
  $(RTL_H) java/javaop.h java/java-opcodes.h except.h java/java-except.h \
  toplev.h $(SYSTEM_H) coretypes.h $(TM_H) function.h 
java/expr.o: java/expr.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h real.h \
  $(RTL_H) $(EXPR_H) java/javaop.h java/java-opcodes.h except.h \
  java/java-except.h java/java-except.h java/parse.h toplev.h \
  $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) gt-java-expr.h target.h
java/jcf-depend.o: java/jcf-depend.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
  $(TM_H) java/jcf.h
java/jcf-parse.o: java/jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) flags.h \
  input.h java/java-except.h $(SYSTEM_H) coretypes.h $(TM_H) toplev.h \
  java/parse.h $(GGC_H) debug.h real.h gt-java-jcf-parse.h $(TM_P_H)
java/jcf-write.o: java/jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
  $(RTL_H) java/java-opcodes.h java/parse.h java/buffer.h $(SYSTEM_H) \
  coretypes.h $(TM_H) toplev.h $(GGC_H) gt-java-jcf-write.h $(TM_P_H)
java/jv-scan.o: java/jv-scan.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
  version.h intl.h
java/jvgenmain.o: java/jvgenmain.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \
  coretypes.h $(TM_H) intl.h
java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \
  toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(EXPR_H) diagnostic.h \
  langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h opts.h options.h
java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) $(SYSTEM_H) \
  coretypes.h $(TM_H) toplev.h $(GGC_H) gt-java-mangle.h
java/mangle_name.o: java/mangle_name.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) \
  $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(GGC_H)
java/resource.o: java/resource.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
  $(JAVA_TREE_H) $(RTL_H) java/jcf.h java/parse.h toplev.h output.h $(GGC_H) \
  $(TARGET_H) function.h gt-java-resource.h expr.h
java/typeck.o: java/typeck.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
  java/convert.h toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) real.h
java/win32-host.o: java/win32-host.c $(CONFIG_H) $(SYSTEM_H) coretypes.h java/jcf.h
java/verify.o: java/verify.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
  java/javaop.h java/java-opcodes.h java/java-except.h toplev.h $(SYSTEM_H) \
  coretypes.h $(TM_H)
java/verify-glue.o: java/verify-glue.c $(CONFIG_H) $(SYSTEM_H) $(JAVA_TREE_H) \
  coretypes.h $(TM_H) java/verify.h
java/verify-impl.o: java/verify-impl.c $(CONFIG_H) java/verify.h $(SYSTEM_H) \
  coretypes.h  java/jcf.h $(JAVA_TREE_H)
java/xref.o: java/xref.c java/xref.h $(CONFIG_H) $(JAVA_TREE_H) toplev.h \
  $(SYSTEM_H) coretypes.h $(TM_H)
java/zextract.o: java/zextract.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
  java/zipfile.h
java/java-gimplify.o: java/java-gimplify.c $(CONFIG_H) $(SYSTEM_H) \
  coretypes.h $(TM_H) $(JAVA_TREE_H) tree-gimple.h toplev.h

java/parse-scan.o: java/parse-scan.c $(CONFIG_H) $(SYSTEM_H) \
  coretypes.h $(TM_H) toplev.h $(JAVA_LEX_C) java/parse.h java/lex.h input.h
java/parse.o: java/parse.c java/jcf-reader.c $(CONFIG_H) $(SYSTEM_H) \
  coretypes.h $(TM_H) function.h $(JAVA_TREE_H) $(JAVA_LEX_C) java/parse.h \
  java/lex.h input.h $(GGC_H) debug.h gt-java-parse.h gtype-java.h target.h

# jcf-io.o needs $(ZLIBINC) added to cflags.
java/jcf-io.o: java/jcf-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
  $(JAVA_TREE_H)
	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ZLIBINC) \
		$(srcdir)/java/jcf-io.c $(OUTPUT_OPTION)

# jcf-path.o needs a -D.
java/jcf-path.o: java/jcf-path.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
  java/jcf.h
	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
	  -DLIBGCJ_ZIP_FILE='"$(datadir)/java/libgcj-$(version).jar"' \
	  -DDEFAULT_TARGET_VERSION=\"$(version)\" \
	  $(srcdir)/java/jcf-path.c $(OUTPUT_OPTION)

TEXI_JAVA_FILES = java/gcj.texi $(docdir)/include/fdl.texi $(docdir)/include/gpl.texi \
	 $(docdir)/include/gcc-common.texi

# Documentation
doc/gcj.info: $(TEXI_JAVA_FILES)
	if test "x$(BUILD_INFO)" = xinfo; then \
	  rm -f doc/gcj.info*; \
	  $(MAKEINFO) $(MAKEINFOFLAGS) -I $(docdir)/include -o $@ $<; \
	else true; fi

doc/gcj.dvi: $(TEXI_JAVA_FILES)
	$(TEXI2DVI) -I $(abs_docdir)/include -o $@ $<

$(htmldir)/java/index.html: $(TEXI_JAVA_FILES)
	$(mkinstalldirs) $(@D)
	rm -f $(@D)/*
	$(TEXI2HTML) -I $(docdir)/include -I $(srcdir)/java -o $(@D) $<

.INTERMEDIATE: gcj.pod gcjh.pod jv-scan.pod jcf-dump.pod gij.pod \
  jv-convert.pod grmic.pod grmiregistry.pod gcj-dbtool.pod

gcj.pod: java/gcj.texi
	-$(TEXI2POD) -D gcj < $< > $@
gcjh.pod: java/gcj.texi
	-$(TEXI2POD) -D gcjh < $< > $@
jv-scan.pod: java/gcj.texi
	-$(TEXI2POD) -D jv-scan < $< > $@
jcf-dump.pod: java/gcj.texi
	-$(TEXI2POD) -D jcf-dump < $< > $@
gij.pod: java/gcj.texi
	-$(TEXI2POD) -D gij < $< > $@
jv-convert.pod: java/gcj.texi
	-$(TEXI2POD) -D jv-convert < $< > $@
grmic.pod: java/gcj.texi
	-$(TEXI2POD) -D grmic < $< > $@
grmiregistry.pod: java/gcj.texi
	-$(TEXI2POD) -D grmiregistry < $< > $@
gcj-dbtool.pod: java/gcj.texi
	-$(TEXI2POD) -D gcj-dbtool < $< > $@

# Install the man pages.
java.install-man: installdirs \
                  $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext) \
		  $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS:%=doc/%.1) \
		  doc/gij.1 doc/jv-convert.1 doc/grmic.1 doc/grmiregistry.1 \
		  doc/gcj-dbtool.1
	for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS) \
		gij jv-convert grmic grmiregistry gcj-dbtool ; do \
	  tool_transformed_name=`echo $$tool|sed '$(program_transform_name)'`; \
	  man_name=$(DESTDIR)$(man1dir)/$${tool_transformed_name}$(man1ext); \
	  rm -f $$man_name ; \
	  for source_name in doc/$${tool}.1 $(srcdir)/doc/$${tool}.1 ; do \
	    if test -f $$source_name; then \
	      $(INSTALL_DATA) $$source_name $$man_name; \
	      break; \
	      else : ; \
	    fi; \
	  done ; \
	  chmod a-x $$man_name ; \
	done

$(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext): doc/gcj.1
	-rm -f $@
	-$(INSTALL_DATA) $< $@
	-chmod a-x $@
