# This file is part of Java-GNOME.
#
# Java-GNOME 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.
#
# Java-GNOME 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 Java-GNOME; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#


version=@version@
apiversion=@apiversion@
gnomevfsversion=@version@
gnomevfsapiversion=@apiversion@

top_srcdir=@top_srcdir@
srcdir=@srcdir@

# Directories for configure.  Will remove the redundant ones when we know where
# to install the files.
prefix=@prefix@
exec_prefix=@exec_prefix@
datadir=@datadir@
bindir=@bindir@
includedir=@includedir@
infodir=@infodir@
libdir=@libdir@
libexecdir=@libexecdir@
localstatedir=@localstatedir@
mandir=@mandir@
sharedstatedir=@sharedstatedir@

INSTALL=@INSTALL@

# Set Java related stuff
JAVADOC = @JAVADOC@
JAVAC = @JAVAC@
JAVA = @JAVA@
JAR = @JAR@

DOCBOOK = @DOCBOOK@

all: distro 

distro:
	$(MAKE) -C src all

# Install targets
install: @GCJ_INSTALL_TARGETS@
	$(INSTALL) -s -m644 lib/libgnomevfsjava$(gnomevfsapiversion).so.$(gnomevfsversion) $(DESTDIR)$(libdir)/
	ln -s -f libgnomevfsjava$(gnomevfsapiversion).so.$(gnomevfsversion)  $(DESTDIR)$(libdir)/libgnomevfsjava$(gnomevfsapiversion).so
	$(INSTALL) -m644 lib/gnomevfs$(gnomevfsapiversion)-$(gnomevfsversion).jar $(DESTDIR)$(datadir)/java
	ln -s -f gnomevfs$(gnomevfsapiversion)-$(gnomevfsversion).jar $(DESTDIR)$(datadir)/java/gnomevfs$(gnomevfsapiversion).jar
	-for f in $(DOCUMENTS); do $(INSTALL) -m644 $(JG_DOC_DIR)/$$f $(DESTDIR)$(datadir)/doc/java-gnome-$(gnomevfsapiversion) || exit 1; done
		$(INSTALL) -m644 gnomevfs-java.pc $(DESTDIR)$(libdir)/pkgconfig/


native_install:
	$(INSTALL) -s -m644 lib/libgnomevfsjar$(gnomevfsapiversion).so.$(gnomevfsversion) $(DESTDIR)$(libdir)/
	@ln -s -f libgnomevfsjar$(gnomevfsapiversion).so.$(gnomevfsversion) $(DESTDIR)$(libdir)/libgnomevfsjar$(gnomevfsapiversion).so

# Uninstall targets
uninstall: @GCJ_UNINSTALL_TARGETS@
	rm -f $(libdir)/libgnomevfsjava$(gnomevfsapiversion).so.$(gnomevfsversion)
	rm -f $(libdir)/libgnomevfsjava$(gnomevfsapiversion).so
	rm -f $(datadir)/java/gnomevfs$(gnomevfsapiversion)-$(gnomevfsversion).jar
	rm -f $(datadir)/java/gnomevfs$(gnomevfsapiversion).jar
	rm -rf $(datadir)/doc/java-gnome-$(gnomevfsapiversion)

native_uninstall:
	rm -f $(libdir)/libgnomevfsjar$(gnomevfsapiversion).so.$(gnomevfsversion)
	rm -f $(libdir)/libgnomevfsjar$(gnomevfsapiversion).so


# Targets to clean up after us

.PHONY: mostlyclean clean distclean maintainer-clean

mostlyclean:
	-$(MAKE) -C src mostlyclean

clean: mostlyclean
	-$(MAKE) -C src clean

distclean: clean
	-$(MAKE) -C src distclean
	rm -f config.* Makefile *.spec

maintainer-clean: distclean
	-$(MAKE) -C src maintainer-clean
