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

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

VPATH = ${top_srcdir}/inputmethod/scim

IM_SCIM_OBJ = im_scim_mod_if.o im_scim.o

CFLAGS = $(CFLAGS_LOCAL) 		\
	 @DEB_CFLAGS@			\
	 @POBL_CFLAGS@			\
	 @MEF_CFLAGS@			\
	 @X_CFLAGS@			\
	 @GUI_CFLAGS@			\
	 @SDL2_CFLAGS@		\
	 @CFLAGS@			\
	 @CPPFLAGS@			\
	 @CXXFLAGS@			\
	 @IM_CFLAGS@			\
	 @SCIM_CFLAGS@			\
	 -I$(top_srcdir)/vtemu		\
	 -I${top_srcdir}/uitoolkit	\
	 -I/usr/local/include

LIBS = $(LIBS_LOCAL) @LPOBL@ @SCIM_LIBS@

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

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

.SUFFIXES: .o .c .cpp

all: libim-scim.la

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

.cpp.o:
	$(LIBTOOL_CXX) -c $<

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

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

install: $(LIBDIR)
	$(LIBTOOL_INSTALL) libim-scim.la $(LIBDIR)

uninstall:
	rm -f $(LIBDIR)/*im-scim*

clean:
	rm -rf $(IM_SCIM_OBJ) $(IM_SCIM_OBJ:.o=.lo) *im-scim* *.core .libs

distclean: clean
	rm -f Makefile

