top_builddir = ..
top_srcdir = @top_srcdir@
prefix = @prefix@
sysconfdir = @sysconfdir@
exec_prefix = @exec_prefix@
datadir = @datadir@
bindir = @bindir@
libdir = @libdir@
libexecdir = @libexecdir@

LIBDIR = $(DESTDIR)$(libdir)

CC = @CC@
LIBTOOL = @LIBTOOL@
INSTALL = @INSTALL@
PKG_CONFIG = @PKG_CONFIG@

VPATH = $(top_srcdir)/gtk

VTE_ABI = @VTE_ABI@

PKG_NAME = $(PKG_NAME_$(VTE_ABI))
PKG_NAME_ = vte
PKG_NAME_2.90 = vte-2.90
PKG_NAME_2.91 = vte-2.91

LIB_VERSION = $(LIB_VERSION_$(VTE_ABI))
LIB_VERSION_ = 9:0:0
LIB_VERSION_2.90 = 9:0:0
LIB_VERSION_2.91 = 0:0:0

TARGET = $(TARGET_$(VTE_ABI))
TARGET_ = libvte
TARGET_2.90 = libvte2_90
TARGET_2.91 = libvte-2.91

CFLAGS = $(CFLAGS_LOCAL) @TYPE_CFLAGS@ @DEB_CFLAGS@ @SSH2_CFLAGS@ \
	-DSYSCONFDIR=\"$(sysconfdir)\" `$(PKG_CONFIG) --cflags $(PKG_NAME)` @CPPFLAGS@
LIBS = $(top_builddir)/kiklib/src/libkik.la $(top_builddir)/mkf/lib/libmkf.la \
	@IMAGELIB_LIBS@ @DL_LIBS_IM@ @GTK_LIBS@ @CTL_LIBS_FOR_VTE@ @TYPE_LIBS_FOR_VTE@ @DEXPORT@

LIBTOOL_CC = $(LIBTOOL) --mode=compile $(CC) $(CFLAGS)
LIBTOOL_LINK = $(LIBTOOL) --mode=link $(CC) @LDFLAGS@
LIBTOOL_INSTALL = $(LIBTOOL) --mode=install $(INSTALL)

OBJ = vte.o marshal.o vtetypebuiltins.o reaper.o

all: $(TARGET).la

$(TARGET).la: $(OBJ)
	$(LIBTOOL_LINK) -o $(TARGET).la $(OBJ:.o=.lo) ../mlterm/*.lo \
	`echo ../xwindow/*.lo| \
	sed 's/..\/xwindow\/x_layout.lo//g' | \
	sed 's/..\/xwindow\/x_scrollbar.lo//g' | \
	sed 's/..\/xwindow\/x_sb_view_factory.lo//g' | \
	sed 's/..\/xwindow\/x_connect_dialog.lo//g' | \
	sed 's/..\/xwindow\/x_simple_sb_view.lo//g' | \
	sed 's/..\/xwindow\/x_screen_manager.lo//g' | \
	sed 's/..\/xwindow\/x_event_source.lo//g'` \
	$(LIBS) -rpath $(libdir) -version-info $(LIB_VERSION)

.c.o:
	$(LIBTOOL_CC) $(CFLAGS) -I$(top_srcdir)/mlterm -I$(top_srcdir)/xwindow \
		-I$(top_builddir)/xwindow -I../mkf/include -I../kiklib/include -g -c $<

clean:
	rm -rf $(OBJ) $(OBJ:.o=.lo) $(TARGET).* *.core .libs

distclean: clean
	rm -f Makefile

install: $(LIBDIR)
	$(LIBTOOL_INSTALL) $(TARGET).la $(LIBDIR)

$(LIBDIR):
	mkdir -p $(LIBDIR)

uninstall:
	rm -f $(LIBDIR)/$(TARGET).*
