# Makefile.in
# $Id: Makefile.in,v 1.6 2001/02/14 04:28:35 jsh Exp $
#
# Copyright (C) 1999 John Harper <john@dcs.warwick.ac.uk>
#
# This file is part of sawfish.
#
# sawfish 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.
#
# sawfish 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 sawfish; 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@

LISP_SRCS := sawfish-menu.jl sawfish-client.jl sawfish-about.jl
LISP_OBJS := $(LISP_SRCS:.jl=.jlc)

REP_ENVIRON := $(REP_ENVIRON) REP_LOAD_PATH=$(top_srcdir)/lisp:$(top_builddir)/lisp

SUBSTS := -e "s|__lispdir__|$(lispdir)|" \
	  -e "s|__localedir__|$(localedir)|" \
	  -e "s|__version__|$(version)|" \
	  -e "s|__codename__|$(codename)|" \
	  -e "s|__sawfishdir__|$(sawfishdir)|"

%.jlc : %.jl
	$(REP_ENVIRON) rep compiler -f compile-batch $<

all : $(LISP_OBJS)

sawfish-about.jl : sawfish-about.jl.in ./Makefile
	sed $(SUBSTS) $< >$@

install : all installdirs
	$(INSTALL_SCRIPT) sawfish-menu.jlc $(DESTDIR)$(sawfishexecdir)/sawfish-menu
	$(INSTALL_SCRIPT) sawfish-client.jlc $(DESTDIR)$(bindir)/sawfish-client
	$(INSTALL_SCRIPT) sawfish-about.jlc $(DESTDIR)$(bindir)/sawfish-about
	$(INSTALL_DATA) sawfish.png $(DESTDIR)$(sawfishdir)/sawfish.png
	$(INSTALL_DATA) cabinet-missing.png $(DESTDIR)$(sawfishimagedir)/cabinet-missing.png

uninstall :
	rm -f $(DESTDIR)${sawfishexecdir}/sawfish-menu
	rm -f $(DESTDIR)${bindir}/sawfish-client
	rm -f $(DESTDIR)${sawfishexecdir}/sawfish-about
	rm -f $(DESTDIR)$(sawfishdir)/sawfish.png
	rm -f $(DESTDIR)$(sawfishimagedir)/*.png

installdirs : $(top_srcdir)/mkinstalldirs
	$(SHELL) $< $(DESTDIR)$(bindir) $(DESTDIR)$(sawfishexecdir) $(DESTDIR)$(sawfishimagedir)

clean :
	rm -f *~ *.jlc core sawfish-about.jl

distclean : clean
	rm -f Makefile

.PHONY: all install uninstall clean distclean
