top_builddir = ../..
top_srcdir = @top_srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@

LIBDIR = $(DESTDIR)$(libdir)/mlterm

VPATH = ${top_srcdir}/mlterm/libptyssh

CFLAGS = $(CFLAGS_LOCAL) @DEB_CFLAGS@ @KIK_CFLAGS@ @MKF_CFLAGS@ \
	@SSH2_CFLAGS@ @CFLAGS@ @CPPFLAGS@ \
	-I/usr/local/include -DLIBDIR=\"$(libdir)\"

LIBS = $(LIBS_LOCAL) @LKIK@ @SSH2_LIBS@

OBJ = ml_pty_ssh.o

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

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

all: libptyssh.la

libptyssh.la: $(OBJ)
	$(LIBTOOL_LINK) -o libptyssh.la $(OBJ:.o=.lo) \
	-rpath $(libdir)/mlterm -module -avoid-version @NO_UNDEFINED_FLAG@ \
	$(LIBS)

.SUFFIXES: .o .c

.c.o:
	$(LIBTOOL_CC) -c $(CFLAGS) $<

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

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

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

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

distclean: clean
	rm -f Makefile
