# Makefile.in for sawmill version 4
# Copyright (C) 1998 John Harper <john@dcs.warwick.ac.uk>
# $Id: Makefile.in,v 1.26 2000/07/06 13:30:07 john Exp $
#
# This file is part of sawmill.
#
# sawmill 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.
#
# sawmill 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 sawmill; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

include ./Makedefs

top_builddir=.
top_srcdir=@top_srcdir@
srcdir=@srcdir@
VPATH=@srcdir@

SUBDIRS = @SUBDIRS@

OLD_BINARIES = sawmill sawmill-client sawmill-capplet sawmill-ui sawmill-themer

all : build.h DOC NEWS FAQ
	set -e; for dir in $(SUBDIRS); do \
	  [ -d $$dir ] && ( cd $$dir && $(MAKE) $@ ); \
 	done

# this depends on config.status so it's rebuilt if configure is re-run
build.h : build-info config.status
	$(SHELL) $< $(host_type) $(version) \
	  '$(sawfishdir)' '$(lispdir)' '$(sawfishexecdir)'

install : all installdirs
	set -e; for dir in $(SUBDIRS); do \
	  ( cd $$dir && $(MAKE) $@ ); \
	done
	for f in ./DOC*; do \
	  $(INSTALL_DATA) $$f $(DESTDIR)$(sawfishexecdir); \
	done
	if [ -d $(DESTDIR)$(GNOMEDIR)/share/gnome/wm-properties ]; then \
	  rm -f $(DESTDIR)$(GNOMEDIR)/share/gnome/wm-properties/Sawmill.desktop; \
	  $(INSTALL_DATA) $(srcdir)/Sawfish.desktop $(DESTDIR)$(GNOMEDIR)/share/gnome/wm-properties; \
	fi
	-set -e; for f in $(OLD_BINARIES); do \
	  if [ -x $(DESTDIR)$(bindir)/$$f ]; then \
	    rm -f $(DESTDIR)$(bindir)/$$f; \
	    $(INSTALL_SCRIPT) $(srcdir)/moved $(DESTDIR)$(bindir)/$$f; \
	  fi \
	done

installdirs : mkinstalldirs
	$(SHELL) $< $(DESTDIR)$(sawfishdir)/$(version) \
	  $(DESTDIR)$(bindir) $(DESTDIR)$(sawfishexecdir)

uninstall :
	set -e; for dir in $(SUBDIRS); do \
	  ( cd $$dir && $(MAKE) $@ ); \
	done
	rm -rf $(DESTDIR)$(sawfishdir)/$(version)

DOC :
	repdoc DOC `find $(srcdir) -name '*.c' -print`

NEWS : man/news.texi
	(cd man && $(MAKE) ../NEWS )

FAQ : man/faq.texi
	(cd man && $(MAKE) ../FAQ )

clean :
	-set -e; for dir in $(SUBDIRS); do \
	  [ -d $$dir ] && ( cd $$dir && $(MAKE) $@ ); \
	done
	rm -f *~ NEWS DOC* TAGS build.h

realclean :
	-set -e; for dir in $(SUBDIRS); do \
	  [ -d $$dir ] && ( cd $$dir && $(MAKE) $@ ); \
	done
	rm -f config.cache config.h config.log config.status Makedefs Makefile
	rm -f *~ NEWS DOC* TAGS build.h sawfish.spec

distclean : realclean

TAGS :
	etags --language=c `find $(srcdir) -name '*.[ch]' -print` \
	      --language=lisp `find $(srcdir) -name '*.jl' -print`

.PHONY: install uninstall tar clean realclean distclean TAGS
