# Makefile.in -- input for rep-gtk Makefile
# Copyright (C) 1998 John Harper <john@dcs.warwick.ac.uk>
# $Id: Makefile.in,v 1.5 2003/01/05 00:31:59 ghudson Exp $

SGTK_SRCS = rep-types.c
SGTK_OBJS = $(SGTK_SRCS:.c=.lo)

SRCS = rep-gtk.c gtk-support.c gtk-compat.c glib-glue.c gdk-glue.c gtk-glue.c gdk-pixbuf-glue.c
OBJS = $(SRCS:.c=.lo)

LIBGLADE_SRCS = libglade-support.c libglade-glue.c
LIBGLADE_OBJS = libglade-support.lo libglade-glue.lo
GNOME_LIBGLADE_OBJS = libglade-gnome-support.lo libglade-glue.lo

GNOMELIB_SRCS = gnomelib-support.c gnomelib-glue.c
GNOMELIB_OBJS = $(GNOMELIB_SRCS:.c=.lo)

GNOMEUI_SRCS = gnomeui-support.c gnomeui-glue.c
GNOMEUI_OBJS = $(GNOMEUI_SRCS:.c=.lo)

GNOME_CANVAS_SRCS = gnome-canvas-support.c gnome-canvas-glue.c
GNOME_CANVAS_OBJS = $(GNOME_CANVAS_SRCS:.c=.lo)

OUT = @OUT@
OUT_DESTS = $(foreach x, $(OUT), gui/$(x))

version=@version@
host_type=@host@
SHELL=/bin/sh

repexecdir=@REP_EXECDIR@
include $(repexecdir)/rules.mk

CC=@CC@
CPPFLAGS=@CPPFLAGS@
CFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@
override CPPFLAGS += -DHAVE_CONFIG_H -I.
override CFLAGS += @GLIB_CFLAGS@ @GTK_CFLAGS@ @REP_CFLAGS@ @LIBGLADE_CFLAGS@ @GNOME_CFLAGS@ @GNOMEUI_CFLAGS@ @GNOME_CANVAS_CFLAGS@ @GDK_PIXBUF_CFLAGS@
REP_SGTK_LIBS=@GLIB_LIBS@ @LIBS@
REP_GTK_LIBS=@GTK_LIBS@ @LIBS@
REP_LIBGLADE_LIBS=@LIBGLADE_LIBS@ @LIBS@
REP_GNOMELIB_LIBS=@GNOME_LIBS@ @LIBS@
REP_GNOMEUI_LIBS=@GNOMEUI_LIBS@ @LIBS@
REP_GNOME_CANVAS_LIBS=@GNOME_CANVAS_LIBS@ @LIBS@

INSTALL=@INSTALL@
INSTALL_DATA=@INSTALL_DATA@
INSTALL_PROGRAM=@INSTALL_PROGRAM@

DESTDIR=
installdir=$(repexecdir)

top_srcdir=@top_srcdir@
top_builddir=.
VPATH=@top_srcdir@:.

.PHONY: clean realclean install

all : build_dirs $(OUT)

gtk-2/types.la : $(SGTK_OBJS)
	$(rep_DL_LD) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(REP_SGTK_LIBS)

gtk-2/gtk.la : $(OBJS)
	$(rep_DL_LD) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(REP_GTK_LIBS)

gtk-2/libglade.la : $(LIBGLADE_OBJS)
	$(rep_DL_LD) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(REP_LIBGLADE_LIBS)

gtk-2/gnome-lib.la : $(GNOMELIB_OBJS)
	$(rep_DL_LD) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(REP_GNOMELIB_LIBS)

gtk-2/gnome-ui.la : $(GNOMEUI_OBJS)
	$(rep_DL_LD) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(REP_GNOMEUI_LIBS)

gtk-2/gnome-canvas.la : $(GNOME_CANVAS_OBJS)
	$(rep_DL_LD) $(CPPFLAGS) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(REP_GNOME_CANVAS_LIBS)

%-glue.c : %.defs build-gtk.jlc
	rep build-gtk.jlc -f build-gtk-batch $< $@

build-gtk.jlc : build-gtk.jl
	rep compiler -f compile-batch $<

libglade-gnome-support.lo : libglade-support.c
	$(rep_LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) \
	 @GNOME_LIBGLADE_CFLAGS@ -DGLADE_GNOME=1 $< -o $@

install : all installdirs
	set -e; for f in $(OUT); do \
	  $(rep_DL_INSTALL) $$f $(DESTDIR)$(installdir)/gui/gtk-2; \
	done
	set -e; for f in $(OUT_DESTS); do \
	  case $$f in \
	    gui/gtk-2/gtk.la|gui/gtk-2/gnome-lib.la) \
	      printf "\nrep_requires='gui.gtk-2.types'\n" >>$(DESTDIR)$(installdir)/$$f ;; \
	    gui/gkt-2/libglade.la|gui/gtk-2/gnome-ui.la|gui/gtk-2/gdk-pixbuf.la) \
	      printf "\nrep_requires='gui.gtk-2.gtk'\n" >>$(DESTDIR)$(installdir)/$$f ;; \
	    gui/gtk-2/gnome-canvas*.la) \
	      printf "\nrep_requires='gui.gtk-2.gnome-ui'\n" >>$(DESTDIR)$(installdir)/$$f ;; \
	  esac; \
	done
	for f in $(OUT_DESTS); do \
	  printf "\nrep_open_globally=yes\n" >>$(DESTDIR)$(installdir)/$$f; \
	done
	$(rep_INSTALL_ALIASES) -c . $(DESTDIR)$(installdir)

installdirs : $(top_srcdir)/mkinstalldirs
	$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(installdir)/gui/gtk-2

uninstall :
	$(rep_DL_UNINSTALL) $(DESTDIR)$(installdir)/$(OUT)

clean :
	rm -f *-glue.c *~ core *.jlc *.o *.lo *.la
	rm -rf gtk-2

realclean : clean
	rm -f Makefile config.cache config.log config.status config.h
	rm -f rep-gtk.spec

cvsclean : realclean
	rm -f aclocal.m4 configure

build_dirs : gtk-2

gtk-2 :
	mkdir gtk-2

# hand-needed dependences
gtk-glue.c : gtk.defs gtktext.defs build-gtk.jlc
