#
# This is Makefile.in for autoconf configure program.
#
CC              = @CC@
CFLAGS          = @CFLAGS@
CPPFLAGS        = @CPPFLAGS@
DEFS	        = @DEFS@
LDFLAGS         = @LDFLAGS@
INSTALL	        = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA	= @INSTALL_DATA@
ld_shareexe 	= @ld_shareexe@
@SET_MAKE@

x_includes      = @x_includes@
x_libraries     = @x_libraries@
extra_inc	= @extra_include@
extra_lib	= @extra_library@
dl_lib		= @dl_library@
locale_lib      = @locale_lib@
intl_lib	= @intl_library@
tabe_lib	= @tabe_library@
db_lib		= @db_library@
linktabe	= @linktabe@
# socket_lib	= @socket_lib@

#
# XCIN installation path.
#
program_prefix	= @program_prefix@
srcdir		= @srcdir@
top_srcdir	= @top_srcdir@
prefix		= @prefix@
exec_prefix	= @exec_prefix@

xcin_binp	= $(program_prefix)@bindir@
xcin_libp	= $(program_prefix)@xcin_dir@
xcin_datap	= ${xcin_libp}/tab
xcin_rcp	= $(program_prefix)@xcin_rcdir@
xcin_manp	= $(program_prefix)@mandir@

#
# Compiling valuables.
#
xcininc = -I${top_srcdir}/src/include
xcinlib = -L${top_srcdir}/src/lib

INC = ${x_includes} ${xcininc} ${extra_inc}
LIB = ${extra_lib} ${xcinlib} -lXimd -lim_comm -lxcintool -lsiod ${linktabe} \
      ${x_libraries} ${locale_lib} ${dl_lib} ${intl_lib} -lm

BIN    = xcin
SRC    = xcin_main.c module.c gui.c xim.c xim_IC.c fkey.c gui_main.c \
	 gui_menusel.c gui_overspot.c gui_main2.c
OBJ    = xcin_main.o module.o gui.o xim.o xim_IC.o fkey.o gui_main.o \
	 gui_menusel.o gui_overspot.o gui_main2.o
SUBSYS = lib Cinput
UTIL   = util

#
# Compiling Rules.
#
.c.o:
	$(CC) -c $(CFLAGS) $(DEFS) $(INC) -o $@ $<

all: $(BIN) util_bin

$(BIN): subsys $(OBJ)
	$(CC) $(ld_shareexe) -o $@ $(OBJ) $(LIB)

subsys:
	@for d in ${SUBSYS}; do ( cd $$d; ${MAKE} ); done

util_bin: 
	@( cd ${UTIL}; ${MAKE} )

fkey.o: fkey.c include/xcintool.h include/config.h include/fkey.h \
  include/imodule.h include/module.h include/Ximd/IMdkit.h

gui.o: gui.c include/gui.h include/xcintool.h \
  include/xcin.h include/IC.h include/Ximd/IMdkit.h include/Ximd/Xi18n.h \
  include/Ximd/XimProto.h include/imodule.h include/module.h

gui_main.o: gui_main.c include/constant.h include/config.h include/xcintool.h \
  include/xcin.h include/gui.h include/IC.h include/Ximd/IMdkit.h \
  include/Ximd/Xi18n.h include/Ximd/XimProto.h include/imodule.h \
  include/module.h

gui_main2.o: gui_main2.c include/constant.h include/config.h include/xcintool.h\
  include/xcin.h include/gui.h include/IC.h include/Ximd/IMdkit.h \
  include/Ximd/Xi18n.h include/Ximd/XimProto.h include/imodule.h \
  include/module.h

gui_menusel.o: gui_menusel.c include/constant.h include/config.h \
  include/xcintool.h include/gui.h include/IC.h include/Ximd/IMdkit.h \
  include/Ximd/Xi18n.h include/Ximd/XimProto.h include/imodule.h \
  include/module.h

gui_overspot.o: gui_overspot.c include/constant.h include/config.h \
  include/xcintool.h include/xcin.h include/gui.h include/IC.h \
  include/Ximd/IMdkit.h include/Ximd/Xi18n.h include/Ximd/XimProto.h \
  include/imodule.h include/module.h

module.o: module.c include/config.h include/xcintool.h include/imodule.h \
  include/module.h

xcin_main.o: xcin_main.c include/constant.h include/config.h \
  include/xcintool.h include/xcin.h include/gui.h include/IC.h \
  include/Ximd/IMdkit.h include/Ximd/Xi18n.h include/Ximd/XimProto.h \
  include/imodule.h include/module.h include/fkey.h include/syscin.h

xim.o: xim.c include/Ximd/IMdkit.h include/Ximd/Xi18n.h \
  include/Ximd/XimProto.h include/config.h include/constant.h \
  include/xcintool.h include/fkey.h include/imodule.h include/module.h \
  include/xcin.h include/gui.h include/IC.h

xim_IC.o: xim_IC.c include/Ximd/IMdkit.h include/Ximd/Xi18n.h \
  include/Ximd/XimProto.h include/config.h include/xcintool.h include/xcin.h \
  include/gui.h include/IC.h include/imodule.h include/module.h



.PHONY: install clean distclean subsys

install: install_path install_xcin install_subsys

install_path:
	if [ ! -d "$(xcin_binp)" ];  then $(INSTALL) -d $(xcin_binp);  fi
	if [ ! -d "$(xcin_libp)" ];  then $(INSTALL) -d $(xcin_libp);  fi
	if [ ! -d "$(xcin_datap)" ]; then $(INSTALL) -d $(xcin_datap); fi

install_xcin: $(BIN)
	$(INSTALL_PROGRAM) $(BIN) $(xcin_binp)

install_subsys:
	@for d in ${SUBSYS} ${UTIL}; do ( cd $$d; ${MAKE} install ); done

clean:
	rm -f $(OBJ) $(BIN) core
	@for d in ${SUBSYS} ${UTIL}; do ( cd $$d; ${MAKE} clean ); done
distclean:
	rm -f $(OBJ) $(BIN) core
	rm -f Makefile .depend
	@for d in ${SUBSYS} ${UTIL}; do ( cd $$d; ${MAKE} distclean ); done

