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

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

BINDIR = $(DESTDIR)$(bindir)
LIBDIR = $(DESTDIR)$(libdir)

VPATH = $(top_srcdir)/mlterm

CFLAGS = $(CFLAGS_LOCAL) @DEB_CFLAGS@ @KIK_CFLAGS@ @MKF_CFLAGS@ @SSH2_CFLAGS@ \
	@UTMP_CFLAGS@ @CTL_CFLAGS@ @VT52_CFLAGS@ @IMAGE_CFLAGS@ @TOOLS_CFLAGS@ \
	@CFLAGS@ @CPPFLAGS@ \
	-I/usr/local/include -DLIBEXECDIR=\"$(libexecdir)\" -DBINDIR=\"$(bindir)\" \
	-DLIBDIR=\"$(libdir)\"

OBJ_CORE = ml_char.o ml_str.o ml_line.o ml_model.o @CTL_LOADER_OBJ@
OBJ = ml_char_encoding.o ml_color.o ml_edit.o ml_edit_util.o ml_edit_scroll.o \
	ml_cursor.o ml_logical_visual.o ml_logs.o ml_screen.o ml_shape.o \
	ml_str_parser.o ml_term.o ml_vt100_parser.o ml_term_manager.o \
	ml_bidi.o ml_iscii.o ml_config_menu.o ml_config_proto.o ml_drcs.o \
	ml_pty.o @ML_PTY_OBJ@

LIBNAME = libmlterm

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


all : @LMLTERM_CORE@ $(LIBNAME).a

debug : @LMLTERM_CORE@ $(LIBNAME).a

$(LIBNAME).a : $(OBJ)
	$(LIBTOOL_LINK) -o $(LIBNAME).a $(OBJ:.o=.lo)

$(LIBNAME)_core.a : $(OBJ_CORE)
	$(LIBTOOL_LINK) -o $(LIBNAME)_core.a $(OBJ_CORE:.o=.lo)

$(LIBNAME)_core.la : $(OBJ_CORE)
	$(LIBTOOL_LINK) -o $(LIBNAME)_core.la $(OBJ_CORE:.o=.lo) \
	@NO_UNDEFINED_FLAG@ -rpath $(libdir) -avoid-version @LKIK@ $(LIBS)

install : $(LIBDIR)
	if test "`echo @LMLTERM_CORE@|grep .la`" != "" ; then \
		$(LIBTOOL_INSTALL) @LMLTERM_CORE@ $(LIBDIR) ; \
	fi

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

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

clean :
	rm -rf $(OBJ) $(OBJ:.o=.lo) $(OBJ_CORE) $(OBJ_CORE:.o=.lo) .libs *.a *.la

distclean: clean
	rm -f Makefile

wc :
	find . -name "*.[ch]" -a \! -name "test_*" | xargs wc -l

.SUFFIXES : .c.o

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