#
#   $Id: Makefile.in,v 1.11 2004/08/15 09:38:23 aono Exp $
#

#
# FreeWnn is a network-extensible Kana-to-Kanji conversion system.
# This file is part of FreeWnn.
# 
# Copyright Kyoto University Research Institute for Mathematical Sciences
#                 1987, 1988, 1989, 1990, 1991, 1992
# Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
# Copyright ASTEC, Inc. 1987, 1988, 1989, 1990, 1991, 1992
# Copyright FreeWnn Project 1999, 2000, 2001, 2004
# 
# Maintainer:  FreeWnn Project   <freewnn@tomo.gr.jp>
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

include @top_builddir@/makerule.mk 
  top_srcdir = @top_srcdir@
top_builddir = @top_builddir@

INSTALL         = @INSTALL@ $(INSTALLFLAGS)
LT_INSTALL      = $(LIBTOOL) --mode=install $(INSTALL)
LT_LD           = $(LIBTOOL) --mode=link $(CCLINK)
LOCAL_INSTFLAGS = -o $(WNNOWNER)

       INCLUDES = -I$(CWNNINCLUDESRC) -I$(top_builddir)
        DEFINES = $(CWNNDEFINES) $(CWNNLANGDEF)
    HINSIDEFINE = -DHINSIDATA_FILE=\"/$(CWNNLANG)/cixing.data\"

CLIENTPROGRAMS = cwnnstat cwnnkill cwddel cwdreg

DICUTIL2PROGRAMS = catod catof cwnntouch

DICUTILPROGRAMS = cdtoa

PROGRAMS = $(CLIENTPROGRAMS) $(DICUTILPROGRAMS) $(DICUTIL2PROGRAMS)

LINKS = atod.c atorev.c dic_head.c dtoa.c sort.c ujisf.c     utilbdic.c wddel.c wdreg.c wnnkill.c wnnstat.c wnntouch.c     atof.c

SRC1= $(CWNNETCSRC)/bdic.c
OBJ1= bdic.o
SRC2= $(CWNNETCSRC)/strings.c
OBJ2= strings.o
SRC3= $(CWNNETCSRC)/sstrings.c
OBJ3= sstrings.o
SRC4= $(CWNNETCSRC)/gethinsi.c
OBJ4= gethinsi.o
SRC5= $(CWNNETCSRC)/revdic.c
OBJ5= revdic.o
SRC6= $(CWNNETCSRC)/hindo.c
OBJ6= hindo.o
SRC7= $(CWNNETCSRC)/pwd.c
OBJ7= pwd.o
SRC8= $(CWNNETCSRC)/dic_atojis.c
OBJ8= dic_atojis.o
SRC9= $(CWNNETCSRC)/xutoj.c
OBJ9= xutoj.o
SRC10= $(CWNNETCSRC)/bcopy.c
OBJ10= bcopy.o
SRC11= $(CWNNETCSRC)/server_env.c
OBJ11= server_env.o
YINCODESRCS= $(CWNNETCSRC)/yincoding.c $(CWNNETCSRC)/py_table.c 	     $(CWNNETCSRC)/zy_table.c

YINCODEOBJS= yincoding.o py_table.o zy_table.o

LOCAL_ETCSRCS3= $(SRC1) $(SRC2) $(SRC3) $(SRC4)         $(SRC7) $(SRC8) $(SRC9) $(SRC10) $(YINCODESRCS)

LOCAL_ETCOBJS3= $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4)         $(OBJ7) $(OBJ8) $(OBJ9) $(OBJ10) $(YINCODEOBJS)

LOCAL_ETCSRCS2= $(LOCAL_ETCSRCS3) $(SRC6)
LOCAL_ETCOBJS2= $(LOCAL_ETCOBJS3) $(OBJ6)
LOCAL_ETCSRCS1= $(LOCAL_ETCSRCS2) $(SRC5)
LOCAL_ETCOBJS1= $(LOCAL_ETCOBJS2) $(OBJ5)

SRCATOD= atod.c ujisf.c dic_head.c atorev.c $(LOCAL_ETCSRCS1)
OBJATOD= atod.o ujisf.o dic_head.o atorev.o $(LOCAL_ETCOBJS1)
SRCDTOA= dtoa.c ujisf.c dic_head.c $(LOCAL_ETCSRCS1)
OBJDTOA= dtoa.o ujisf.o dic_head.o $(LOCAL_ETCOBJS1)
SRCTOUCH= wnntouch.c $(LOCAL_ETCSRCS3)
OBJTOUCH= wnntouch.o $(LOCAL_ETCOBJS3)
SRCSTAT= wnnstat.c $(SRC3) $(SRC9) $(SRC10) $(SRC11)
OBJSTAT= wnnstat.o $(OBJ3) $(OBJ9) $(OBJ10) $(OBJ11)
SRCKILL= wnnkill.c $(SRC3) $(SRC9) $(SRC10) $(SRC11)
OBJKILL= wnnkill.o $(OBJ3) $(OBJ9) $(OBJ10) $(OBJ11)
SRCSORT= sort.c ujisf.c $(LOCAL_ETCSRCS2) $(YINCODESRC)
OBJSORT= sort.o ujisf.o $(LOCAL_ETCOBJS2) $(YINCODEOBJ)
SRCWDDEL= wddel.c $(SRC3) $(SRC9) $(SRC10)
OBJWDDEL= wddel.o $(OBJ3) $(OBJ9) $(OBJ10)
SRCWDREG= wdreg.c ujisf.c $(LOCAL_ETCSRCS3)
OBJWDREG= wdreg.o ujisf.o $(LOCAL_ETCOBJS3)
SRCATOF= atof.c $(LOCAL_ETCSRCS3)
OBJATOF= atof.o $(LOCAL_ETCOBJS3)

SRCS= atod.c dic_head.c wddel.c wnnkill.c atof.c dtoa.c ujisf.c       wdreg.c wnnstat.c atorev.c wnntouch.c       $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5) $(SRC6)       $(SRC7) $(SRC8) $(SRC9) $(SRC10) $(SRC11) $(YINCODESRCS)

OBJS= atod.o dic_head.o wddel.o wnnkill.o atof.o dtoa.o ujisf.o       wdreg.o wnnstat.o atorev.o wnntouch.o       $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(OBJ6)       $(OBJ7) $(OBJ8) $(OBJ9) $(OBJ10) $(OBJ11) $(YINCODEOBJS)

all:: $(PROGRAMS)

clean::
	$(RM) -r .libs
	$(RM) *.lo *.la

catod: $(OBJATOD)
	$(RM) $@
	$(LT_LD) -o $@ $(LDOPTIONS) $(OBJATOD) @LIBS@

clean::
	$(RM) catod

catof: $(OBJATOF)
	$(RM) $@
	$(LT_LD) -o $@ $(LDOPTIONS) $(OBJATOF) @LIBS@

clean::
	$(RM) catof

cwnntouch: $(OBJTOUCH)
	$(RM) $@
	$(LT_LD) -o $@ $(LDOPTIONS) $(OBJTOUCH) @LIBS@

clean::
	$(RM) cwnntouch

cdicsort: $(OBJSORT)
	$(RM) $@
	$(LT_LD) -o $@ $(LDOPTIONS) $(OBJSORT)

clean::
	$(RM) cdicsort

cdtoa: $(OBJDTOA)
	$(RM) $@
	$(LT_LD) -o $@ $(LDOPTIONS) $(OBJDTOA) @LIBS@

clean::
	$(RM) cdtoa

cwnnstat: $(OBJSTAT) @DEPCWNNJLIB@
	$(RM) $@
	$(LT_LD) -o $@ $(LDOPTIONS) $(OBJSTAT) $(CWNNJLIB) @LIBS@

clean::
	$(RM) cwnnstat

cwnnkill: $(OBJKILL) @DEPCWNNJLIB@
	$(RM) $@
	$(LT_LD) -o $@ $(LDOPTIONS) $(OBJKILL) $(CWNNJLIB) @LIBS@

clean::
	$(RM) cwnnkill

cwddel: $(OBJWDDEL) @DEPCWNNJLIB@
	$(RM) $@
	$(LT_LD) -o $@ $(LDOPTIONS) $(OBJWDDEL) $(CWNNJLIB) @LIBS@

clean::
	$(RM) cwddel

cwdreg: $(OBJWDREG) @DEPCWNNJLIB@
	$(RM) $@
	$(LT_LD) -o $@ $(LDOPTIONS) $(OBJWDREG) $(CWNNJLIB) @LIBS@

clean::
	$(RM) cwdreg

includes:: $(LINKS)

atod.c:  $(WNNJUTILSRC)/atod.c
	$(RM) $@
	$(LN) $? $@

includes:: atod.c

depend:: atod.c

clean::
	$(RM) atod.c

atorev.c:  $(WNNJUTILSRC)/atorev.c
	$(RM) $@
	$(LN) $? $@

includes:: atorev.c

depend:: atorev.c

clean::
	$(RM) atorev.c

dic_head.c:  $(WNNJUTILSRC)/dic_head.c
	$(RM) $@
	$(LN) $? $@

includes:: dic_head.c

depend:: dic_head.c

clean::
	$(RM) dic_head.c

dtoa.c:  $(WNNJUTILSRC)/dtoa.c
	$(RM) $@
	$(LN) $? $@

includes:: dtoa.c

depend:: dtoa.c

clean::
	$(RM) dtoa.c

sort.c:  $(WNNJUTILSRC)/sort.c
	$(RM) $@
	$(LN) $? $@

includes:: sort.c

depend:: sort.c

clean::
	$(RM) sort.c

ujisf.c:  $(WNNJUTILSRC)/ujisf.c
	$(RM) $@
	$(LN) $? $@

includes:: ujisf.c

depend:: ujisf.c

clean::
	$(RM) ujisf.c

utilbdic.c:  $(WNNJUTILSRC)/utilbdic.c
	$(RM) $@
	$(LN) $? $@

includes:: utilbdic.c

depend:: utilbdic.c

clean::
	$(RM) utilbdic.c

wddel.c:  $(WNNJUTILSRC)/wddel.c
	$(RM) $@
	$(LN) $? $@

includes:: wddel.c

depend:: wddel.c

clean::
	$(RM) wddel.c

wdreg.c:  $(WNNJUTILSRC)/wdreg.c
	$(RM) $@
	$(LN) $? $@

includes:: wdreg.c

depend:: wdreg.c

clean::
	$(RM) wdreg.c

wnnkill.c:  $(WNNJUTILSRC)/wnnkill.c
	$(RM) $@
	$(LN) $? $@

includes:: wnnkill.c

depend:: wnnkill.c

clean::
	$(RM) wnnkill.c

wnnstat.c:  $(WNNJUTILSRC)/wnnstat.c
	$(RM) $@
	$(LN) $? $@

includes:: wnnstat.c

depend:: wnnstat.c

clean::
	$(RM) wnnstat.c

wnntouch.c:  $(WNNJUTILSRC)/wnntouch.c
	$(RM) $@
	$(LN) $? $@

includes:: wnntouch.c

depend:: wnntouch.c

clean::
	$(RM) wnntouch.c

atof.c:  $(WNNJUTILSRC)/atof.c
	$(RM) $@
	$(LN) $? $@

includes:: atof.c

depend:: atof.c

clean::
	$(RM) atof.c

instclient:: install

install:: $(PROGRAMS)
	@if [ -d $(DESTDIR)$(CWNNBINDIR) ]; then set +x; \
	else (set -x; $(MKDIRHIER) $(DESTDIR)$(CWNNBINDIR)); fi
	@for flag in ${MAKEFLAGS} ''; do \
	case "$$flag" in *=*) ;; *[i]*) set +e;; esac; done; \
	for i in $(PROGRAMS); do \
	(set -x; $(LT_INSTALL) $(INSTBINFLAGS) $(INSTPGMFLAGS) $(LOCAL_INSTFLAGS) $$i $(DESTDIR)$(CWNNBINDIR)); \
	done

$(OBJ1) : $(SRC1)
	$(CC) -c $(CFLAGS)  $(CWNNETCSRC)/`basename $@ .o`.c

$(OBJ2) : $(SRC2)
	$(CC) -c $(CFLAGS)  $(CWNNETCSRC)/`basename $@ .o`.c

$(OBJ3) : $(SRC3)
	$(CC) -c $(CFLAGS)  $(CWNNETCSRC)/`basename $@ .o`.c

$(OBJ4) : $(SRC4)
	$(CC) -c $(CFLAGS) $(HINSIDEFINE) $(CWNNETCSRC)/`basename $@ .o`.c

$(OBJ5) : $(SRC5)
	$(CC) -c $(CFLAGS)  $(CWNNETCSRC)/`basename $@ .o`.c

$(OBJ6) : $(SRC6)
	$(CC) -c $(CFLAGS)  $(CWNNETCSRC)/`basename $@ .o`.c

$(OBJ7) : $(SRC7)
	$(CC) -c $(CFLAGS)  $(CWNNETCSRC)/`basename $@ .o`.c

$(OBJ8) : $(SRC8)
	$(CC) -c $(CFLAGS)  $(CWNNETCSRC)/`basename $@ .o`.c

$(OBJ9) : $(SRC9)
	$(CC) -c $(CFLAGS) $(WNNLANGDEF) $(CWNNETCSRC)/`basename $@ .o`.c

$(OBJ10) : $(SRC10)
	$(CC) -c $(CFLAGS)  $(CWNNETCSRC)/`basename $@ .o`.c

$(OBJ11) : $(SRC11)
	$(CC) -c $(CFLAGS)  $(CWNNETCSRC)/`basename $@ .o`.c

$(YINCODEOBJS) : $(YINCODESRCS)
	$(CC) -c $(CFLAGS)  $(CWNNETCSRC)/`basename $@ .o`.c

depend:: .depend

clean::
	$(RM) $(LINKS)

