# FreeWnn is a network-extensible Kana-to-Kanji conversion system.
# This file is part of FreeWnn.
#
# Copyright OMRON Corporation. 1987, 1988, 1989, 1990, 1991, 1992, 1999
# Copyright 1991, 1992 by Massachusetts Institute of Technology
# Copyright FreeWnn Project 2001
#
# Author: OMRON SOFTWARE Co., Ltd. <freewnn@rd.kyoto.omronsoft.co.jp>
# 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, 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 GNU Emacs; see the file COPYING.  If not, write to the
# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

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

INSTALL         = @INSTALL@ $(INSTALLFLAGS)
LOCAL_INSTFLAGS = -o $(WNNOWNER)

       INCLUDES = $(XWNMOINCLUDES)

        DEPLIBS = $(XWNMOJLIB)

XAPPLOADDIR = $(LIBDIR)/app-defaults

LOCAL_DEFINES = -DUSING_XJUTIL -DXML -DCALLBACKS -DSPOT 		 -DXJPLIB -DXJPLIB_DIRECT $(XWNMODEF)

        DEFINES = $(WNNDEFINES) $(ALLLANGDEF) -DTCPCONN -DUNIXCONN $(LOCAL_DEFINES)
LOCAL_LIBRARIES = $(XWNMOJLIB) -lXmu -L/usr/X11R6/lib -lXt -lX11 -lXt -lSM -lICE
   XJUTILBINDIR = -DXJUTILBINDIR=\"$(BINDIR)\"
#   NOTFORKFLAGS = -DNOTFORK
# XJUTILNOTFORKFLAGS = -DNOTFORK_XJUTIL
# ALLOCDEBUGFLAGS = -DALLOC_DEBUG
    XJUTILFLAGS = $(XJUTILBINDIR) $(XJUTILNOTFORKFLAGS)
       LOCALMAN = man.en

LINKS = cvtfun.man cvtmt.man ximrc.man xwnmo.man killxw.man 	ximconf.man cvtxim.man

SRCS1 = basic_op.c 	box.c 	byte_swap.c 	callback.c 	change.c 	client.c 	cursor.c 	display.c 	do_socket.c 	evdispatch.c 	functions.c 	header.c 	history.c 	ichiran.c 	init.c 	init_w.c 	inspect.c 	jikouho.c 	jis_in.c 	jutil.c 	key_bind.c 	keyin.c 	kuten.c 	message.c 	multi_lang.c 	printf.c 	prologue.c 	readximrc.c 	screen.c 	select_ele.c 	termio.c 	touroku.c 	uif.c 	uif1.c 	util.c 	w_string.c 	wnnrc_op.c 	write.c 	xcvtkey.c 	xlc_util.c 	ximdispt.c

OBJS1 = basic_op.o 	box.o 	byte_swap.o 	callback.o 	change.o 	client.o 	cursor.o 	display.o 	do_socket.o 	evdispatch.o 	functions.o 	header.o 	history.o 	ichiran.o 	init.o 	init_w.o 	inspect.o 	jikouho.o 	jis_in.o 	jutil.o 	key_bind.o 	keyin.o 	kuten.o 	message.o 	multi_lang.o 	printf.o 	prologue.o 	readximrc.o 	screen.o 	select_ele.o 	termio.o 	touroku.o 	uif.o 	uif1.o 	util.o 	w_string.o 	wnnrc_op.o 	write.o 	xcvtkey.o 	xlc_util.o 	ximdispt.o

SRCS2 = do_xjutil.c
OBJS2 = do_xjutil.o
SRCS3 = do_xjplib.c
OBJS3 = do_xjplib.o
SRCS4 = do_xjpdrct.c
OBJS4 = do_xjpdrct.o
SRCS5 = jhlp.c
OBJS5 = jhlp.o
SRCS6 = localalloc.c
OBJS6 = localalloc.o

ETC_SRCS1 = $(WNNETCSRC)/server_env.c
ETC_SRCS2 = $(WNNETCSRC)/xutoj.c
ETC_SRCS3 = $(WNNETCSRC)/sstrings.c
ETC_OBJS1 = server_env.o
ETC_OBJS2 = xutoj.o
ETC_OBJS3 = sstrings.o

SPOTLIBSRC = spotlib.c
SPOTLIBOBJ = spotlib.o

KILLXWNMOSRC = killxwnmo.c
KILLXWNMOOBJ = killxwnmo.o

LOCAL_ETCSRCS= $(ETC_SRCS1) $(ETC_SRCS2) $(ETC_SRCS3)
LOCAL_ETCOBJS= $(ETC_OBJS1) $(ETC_OBJS2) $(ETC_OBJS3)
SRCS= $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) $(SRCS6) $(LOCAL_ETCSRCS)
OBJS= $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) $(OBJS6) $(LOCAL_ETCOBJS)

PROGRAMS = xwnmo $(SPOTLIBOBJ) killxwnmo
PROGRAMS = xwnmo killxwnmo

all:: $(PROGRAMS)

xwnmo: $(OBJS) $(DEPLIBS)
	$(RM) $@
	$(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LOCAL_LIBRARIES) @LIBS@ $(SYSLIBS)

clean::
	$(RM) xwnmo

killxwnmo: $(KILLXWNMOOBJ)
	$(RM) $@
	$(CCLINK) -o $@ $(LDOPTIONS) $(KILLXWNMOOBJ) @LIBS@ $(XLIB) $(SYSLIBS)

clean::
	$(RM) killxwnmo

includes:: $(LINKS)

xwnmo.man:  $(LOCALMAN)/xwnmo.man
	$(RM) $@
	$(LN) $? $@

includes:: xwnmo.man

depend:: xwnmo.man

clean::
	$(RM) xwnmo.man

ximrc.man:  $(LOCALMAN)/ximrc.man
	$(RM) $@
	$(LN) $? $@

includes:: ximrc.man

depend:: ximrc.man

clean::
	$(RM) ximrc.man

cvtfun.man:  $(LOCALMAN)/cvtfun.man
	$(RM) $@
	$(LN) $? $@

includes:: cvtfun.man

depend:: cvtfun.man

clean::
	$(RM) cvtfun.man

cvtmt.man:  $(LOCALMAN)/cvtmt.man
	$(RM) $@
	$(LN) $? $@

includes:: cvtmt.man

depend:: cvtmt.man

clean::
	$(RM) cvtmt.man

killxw.man:  $(LOCALMAN)/killxw.man
	$(RM) $@
	$(LN) $? $@

includes:: killxw.man

depend:: killxw.man

clean::
	$(RM) killxw.man

ximconf.man:  $(LOCALMAN)/ximconf.man
	$(RM) $@
	$(LN) $? $@

includes:: ximconf.man

depend:: ximconf.man

clean::
	$(RM) ximconf.man

cvtxim.man:  $(LOCALMAN)/cvtxim.man
	$(RM) $@
	$(LN) $? $@

includes:: cvtxim.man

depend:: cvtxim.man

clean::
	$(RM) cvtxim.man

install:: xwnmo
	@if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
	else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
	$(INSTALL) $(INSTPGMFLAGS) $(INSTBINFLAGS) $(LOCAL_INSTFLAGS) xwnmo $(DESTDIR)$(BINDIR)/xwnmo

install:: killxwnmo
	@if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
	else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
	$(INSTALL) $(INSTPGMFLAGS) $(INSTBINFLAGS) $(LOCAL_INSTFLAGS) killxwnmo $(DESTDIR)$(BINDIR)/killxwnmo

install:: Xwnmo.ad
	@if [ -d $(DESTDIR)$(XAPPLOADDIR) ]; then set +x; \
	else (set -x; $(MKDIRHIER) $(DESTDIR)$(XAPPLOADDIR)); fi
	$(INSTALL) $(INSTDATFLAGS) Xwnmo.ad $(DESTDIR)$(XAPPLOADDIR)/Xwnmo

install.man:: xwnmo.man
	@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
	else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
	$(RM) $(DESTDIR)$(MANDIR)/xwnmo.$(MANSUFFIX)*
	$(INSTALL) $(INSTMANFLAGS) xwnmo.man \
 $(DESTDIR)$(MANDIR)/xwnmo.$(MANSUFFIX)
	-$(COMPRESSMANCMD) $(DESTDIR)$(MANDIR)/xwnmo.$(MANSUFFIX)

install.man:: ximrc.man
	@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
	else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
	$(RM) $(DESTDIR)$(MANDIR)/ximrc.$(MANSUFFIX)*
	$(INSTALL) $(INSTMANFLAGS) ximrc.man \
 $(DESTDIR)$(MANDIR)/ximrc.$(MANSUFFIX)
	-$(COMPRESSMANCMD) $(DESTDIR)$(MANDIR)/ximrc.$(MANSUFFIX)

install.man:: ximconf.man
	@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
	else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
	$(RM) $(DESTDIR)$(MANDIR)/ximconf.$(MANSUFFIX)*
	$(INSTALL) $(INSTMANFLAGS) ximconf.man \
 $(DESTDIR)$(MANDIR)/ximconf.$(MANSUFFIX)
	-$(COMPRESSMANCMD) $(DESTDIR)$(MANDIR)/ximconf.$(MANSUFFIX)

install.man:: cvtfun.man
	@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
	else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
	$(RM) $(DESTDIR)$(MANDIR)/cvt_fun_tbl.$(MANSUFFIX)*
	$(INSTALL) $(INSTMANFLAGS) cvtfun.man \
 $(DESTDIR)$(MANDIR)/cvt_fun_tbl.$(MANSUFFIX)
	-$(COMPRESSMANCMD) $(DESTDIR)$(MANDIR)/cvt_fun_tbl.$(MANSUFFIX)

install.man:: cvtmt.man
	@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
	else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
	$(RM) $(DESTDIR)$(MANDIR)/cvt_meta_tbl.$(MANSUFFIX)*
	$(INSTALL) $(INSTMANFLAGS) cvtmt.man \
 $(DESTDIR)$(MANDIR)/cvt_meta_tbl.$(MANSUFFIX)
	-$(COMPRESSMANCMD) $(DESTDIR)$(MANDIR)/cvt_meta_tbl.$(MANSUFFIX)

install.man:: killxw.man
	@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
	else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
	$(RM) $(DESTDIR)$(MANDIR)/killxwnmo.$(MANSUFFIX)*
	$(INSTALL) $(INSTMANFLAGS) killxw.man \
 $(DESTDIR)$(MANDIR)/killxwnmo.$(MANSUFFIX)
	-$(COMPRESSMANCMD) $(DESTDIR)$(MANDIR)/killxwnmo.$(MANSUFFIX)

install.man:: cvtxim.man
	@if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \
	else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi
	$(RM) $(DESTDIR)$(MANDIR)/cvt_xim_tbl.$(MANSUFFIX)*
	$(INSTALL) $(INSTMANFLAGS) cvtxim.man \
 $(DESTDIR)$(MANDIR)/cvt_xim_tbl.$(MANSUFFIX)
	-$(COMPRESSMANCMD) $(DESTDIR)$(MANDIR)/cvt_xim_tbl.$(MANSUFFIX)

lint:
	$(LINT) $(LINTFLAGS) *.c $(LINTLIBS)
lint1:
	$(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)

depend:: .depend

clean::
	$(RM) $(LINKS)

$(OBJS2) : $(SRCS2)
	$(CC) -c $(CFLAGS) $(XJUTILFLAGS) ./`basename $@ .o`.c

$(OBJS5) : $(SRCS5)
	$(CC) -c $(CFLAGS) $(NOTFORKFLAGS) ./`basename $@ .o`.c

$(OBJS6) : $(SRCS6)
	$(CC) -c $(CFLAGS) $(ALLOCDEBUGFLAGS) ./`basename $@ .o`.c

$(ETC_OBJS1) : $(ETC_SRCS1)
	$(CC) -c $(CFLAGS)  $(WNNETCSRC)/`basename $@ .o`.c

$(ETC_OBJS2) : $(ETC_SRCS2)
	$(CC) -c $(CFLAGS)  $(WNNETCSRC)/`basename $@ .o`.c

$(ETC_OBJS3) : $(ETC_SRCS3)
	$(CC) -c $(CFLAGS)  $(WNNETCSRC)/`basename $@ .o`.c

