###########################################################################
#
# Makefile -- gsdl buildtime code
# A component of the Greenstone digital library software
# from the New Zealand Digital Library Project at the
# University of Waikato, New Zealand.
#
# Copyright (C) 1999  The New Zealand Digital Library Project
#
#
# This program 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 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
###########################################################################
srcdir = @srcdir@

SHELL = /bin/bash
PACKAGE = @PACKAGE@
VERSION = @VERSION@

@SET_MAKE@
CC = @CC@
CXX = @CXX@
CFLAGS = @CFLAGS@
CXXFLAGS = @CXXFLAGS@
LIBS   = @LIBS@
MDEFINES =

GSDLOS = @gsdlos@

COMPILE = $(CC) -c

SOURCES = 

OBJECTS = 

ALLFILES = $(OBJECTS)

# all directories should be compiled
COMPILEDIRS = packages src/hashfile src/phind/generate src/java/org/nzdl/gsdl
# a subset of the directories get installed
INSTALLDIRS = packages src/hashfile src/phind/generate 

MODULEDIRS = @MODULEDIRS@

ENABLE_GNOMELIB_EXT=@ENABLE_GNOMELIB_EXT@


all:
	if test $(ENABLE_GNOMELIB_EXT) = 1; then \
	  if test -d ../ext/gnome-lib; then \
	    pushd ../ext/gnome-lib && source ./devel.bash && popd; \
	  elif test -d ../ext/gnome-lib-minimal; then \
	    pushd ../ext/gnome-lib-minimal && source ./devel.bash && popd; \
	  fi; \
	fi
	for odir in $(COMPILEDIRS) $(MODULEDIRS); do \
	  echo making $@ in $$odir; \
	  (cd $$odir && $(MAKE) $(MDEFINES) $@) || exit 1; \
	done

install: all
	for idir in $(INSTALLDIRS); do \
	  echo installing $$idir; \
	  (cd $$idir && $(MAKE) install) || exit 1; \
	done
	cp src/java/org/nzdl/gsdl/ApplyXSLT.jar ../bin/java/

distclean: clean
	rm -f Makefile config.cache config.h config.log stamp-h config.status
	for subdir in $(COMPILEDIRS); do \
	  echo cleaning $@ in $$subdir; \
	  (cd $$subdir && $(MAKE) distclean) || exit 1; \
	done

clean:
	for subdir in $(COMPILEDIRS); do \
	  echo cleaning $@ in $$subdir; \
	  (cd $$subdir && $(MAKE) clean) || exit 1; \
	done

# commented out - jrm21 Dec 2004 - can get confused by cvs timestamps
# (and might run the wrong version of autoconf)
#
## For an explanation of the following Makefile rules, see node
## `Automatic Remaking' in GNU Autoconf documentation.
#Makefile: Makefile.in config.status
#	CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
#config.status: configure
#	./config.status --recheck
#configure: configure.in aclocal.m4
#	cd $(srcdir) && autoconf
#
#config.h: stamp-h
#stamp-h: config.h.in config.status
#	CONFIG_FILES= CONFIG_HEADERS=config.h ./config.status
#config.h.in: stamp-h.in
#stamp-h.in: configure.in aclocal.m4 acconfig.h
#	cd $(srcdir) && autoheader
#	$(TOUCH) $(srcdir)/stamp-h.in



