# 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@
gconfversion=@version@
gconfapiversion=@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/libgconfjava$(gconfapiversion).so.$(gconfversion) $(DESTDIR)$(libdir)/
	ln -s -f libgconfjava$(gconfapiversion).so.$(gconfversion)  $(DESTDIR)$(libdir)/libgconfjava$(gconfapiversion).so
	$(INSTALL) -m644 lib/gconf$(gconfapiversion)-$(gconfversion).jar $(DESTDIR)$(datadir)/java
	ln -s -f gconf$(gconfapiversion)-$(gconfversion).jar $(DESTDIR)$(datadir)/java/gconf$(gconfapiversion).jar
	-for f in $(DOCUMENTS); do $(INSTALL) -m644 $(JG_DOC_DIR)/$$f $(DESTDIR)$(datadir)/doc/java-gnome-$(gconfapiversion) || exit 1; done
	$(INSTALL) -m644 gconf-java.pc $(DESTDIR)$(libdir)/pkgconfig/

native_install:
	$(INSTALL) -s -m644 lib/libgconfjar$(gconfapiversion).so.$(gconfversion) $(DESTDIR)$(libdir)/
	@ln -s -f libgconfjar$(gconfapiversion).so.$(gconfversion) $(DESTDIR)$(libdir)/libgconfjar$(gconfapiversion).so

# Uninstall targets
uninstall: @GCJ_UNINSTALL_TARGETS@
	rm -f $(libdir)/libgconfjava$(gconfapiversion).so.$(gconfversion)
	rm -f $(libdir)/libgconfjava$(gconfapiversion).so
	rm -f $(datadir)/java/gconf$(gconfapiversion)-$(gconfversion).jar
	rm -f $(datadir)/java/gconf$(gconfapiversion).jar
	rm -rf $(datadir)/java-gnome
	rm -rf $(datadir)/doc/java-gnome-$(gconfapiversion)

native_uninstall:
	rm -f $(libdir)/libgconfjar$(gconfapiversion).so.$(gconfversion)
	rm -f $(libdir)/libgconfjar$(gconfapiversion).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
