# Makefile.in for sawmill version 4
# Copyright (C) 1998 John Harper <john@dcs.warwick.ac.uk>
# $Id: Makefile.in,v 1.31 2003/04/03 02:24:42 jsh 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-ui

all : build.h DOC NEWS FAQ
	for dir in $(SUBDIRS); do \
	  [ -d $$dir ] && ( cd $$dir && $(MAKE) $@ ) || exit 1; \
 	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)$(subversion) \
	  '$(sawfishdir)' '$(lispdir)' '$(sawfishexecdir)' '$(localedir)'

install : all installdirs
	for dir in $(SUBDIRS); do \
	  ( cd $$dir && $(MAKE) $@ ) || exit 1; \
	done
	for f in ./DOC*; do \
	  $(INSTALL_DATA) $$f $(DESTDIR)$(sawfishexecdir); \
	done
	rm -f $(DESTDIR)$(GNOMEDIR)/share/gnome/wm-properties/Sawmill.desktop
	$(INSTALL_DATA) $(srcdir)/sawfish.desktop \
		$(DESTDIR)$(datadir)/applications/
	$(INSTALL_DATA) $(srcdir)/sawfish-wm.desktop \
	  $(DESTDIR)$(GNOMEDIR)/share/gnome/wm-properties
	-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
	$(INSTALL_DATA) $(top_srcdir)/sawfish.pc $(DESTDIR)$(libdir)/pkgconfig/
	$(INSTALL_DATA) $(top_srcdir)/sawfish-session.desktop $(DESTDIR)$(datadir)/xsessions/sawfish.desktop
	$(INSTALL_DATA) $(top_srcdir)/sawfish-ksm.desktop $(DESTDIR)$(datadir)/apps/ksmserver/windowmanagers/sawfish.desktop

installdirs : mkinstalldirs
	$(SHELL) $< $(DESTDIR)$(sawfishdir)/$(version) \
	  $(DESTDIR)$(bindir) $(DESTDIR)$(sawfishexecdir) \
	  $(DESTDIR)$(GNOMEDIR)/share/gnome/wm-properties \
	  $(DESTDIR)$(datadir)/applications/ \
	  $(DESTDIR)$(libdir)/pkgconfig/ \
	  $(DESTDIR)$(datadir)/xsessions/ \
	  $(DESTDIR)$(datadir)/apps/ksmserver/windowmanagers/

uninstall :
	for dir in $(SUBDIRS); do \
	  ( cd $$dir && $(MAKE) $@ ) || exit 1; \
	done
	rm -rf $(DESTDIR)$(sawfishdir)/$(version)
	rm -f $(DESTDIR)$(libdir)/pkgconfig/sawfish.pc
	rm -f $(DESTDIR)$(datadir)/xsessions/sawfish.desktop
	rm -f $(DESTDIR)$(datadir)/applications/sawfish.desktop
	rm -f $(DESTDIR)$(GNOMEDIR)/share/gnome/wm-properties/sawfish-wm.desktop

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

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

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

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

distclean :
	-for dir in $(SUBDIRS); do \
	  [ -d $$dir ] && ( cd $$dir && $(MAKE) $@ ) || exit 1; \
	done
	rm -f config.cache config.h config.log config.status Makedefs Makefile
	rm -f *~ NEWS DOC* TAGS build.h sawfish.spec sawfish*.ebuild sawfish.pc
	rm -rf aclocal.m4 autom4te.cache

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

.PHONY: install uninstall tar clean realclean distclean TAGS
