#
# Copyright 1999, TaBE Project, All Rights Reserved.
# Copyright 1999, Pai-Hsiang Hsiao, All Rights Reserved.
#
# $Id: Makefile.in,v 1.7 2001/12/04 15:05:14 thhsieh Exp $
#
CC              = @CC@
CFLAGS          = @CFLAGS@
CPPFLAGS        = @CPPFLAGS@
DEFS            = @DEFS@
RANLIB          = @RANLIB@
LN_S            = @LN_S@
LDFLAGS	        = @with_db_lib@
INC	        = @with_db_inc@
INSTALL         = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA    = @INSTALL_DATA@
@SET_MAKE@

program_prefix	= @program_prefix@
srcdir		= @srcdir@
top_srcdir	= @top_srcdir@
prefix		= $(program_prefix)@prefix@
exec_prefix	= @exec_prefix@
libdir		= @libdir@
bindir		= @bindir@
includedir	= @includedir@
LIBTOOL		= $(top_srcdir)/libtool

RELEASE_VER	= @RELEASE_VER@
CURRENT_VER	= @CURRENT_VER@
REVISION_VER	= @REVISION_VER@
AGE_VER		= @AGE_VER@

#
# libtabe main makefile.
#
AR          =   ar cr
RM          =   rm -rf
LIBNAME	    =	libtabe.la
LIBSRCS	    =	tabe_util.c tabe_zuyin.c tabe_yin.c \
		tabe_tsi.c tabe_tsidbint.c tabe_tsiyindbint.c \
                tabe_chu.c
LIBOBJS     =   $(LIBSRCS:.c=.lo)
INCLUDES    =	tabe.h

#TESTPRG    =	testtabe
#TESTSRC    =	testtabe.c
#TESTOBJ    =	testtabe.o

#
# Over all targets.
#
all: $(LIBNAME) bims

$(LIBNAME): $(LIBOBJS)
	$(LIBTOOL) --mode=link $(CC) -o $@ $(LIBOBJS) -rpath $(libdir) \
		-version-info $(CURRENT_VER):$(REVISION_VER):$(AGE_VER)

bims:
	(cd supports/bims; $(MAKE))

#
# Unshared objects
#
tabe_util.lo: tabe_util.c tabe.h tabe_charref.h
	$(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $(DEFS) $(INC) -o $@ tabe_util.c

tabe_zuyin.lo: tabe_zuyin.c tabe.h
	$(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $(DEFS) $(INC) -o $@ tabe_zuyin.c

tabe_yin.lo: tabe_yin.c tabe.h tabe_yin2zhi.h
	$(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $(DEFS) $(INC) -o $@ tabe_yin.c

tabe_tsi.lo: tabe_tsi.c tabe.h
	$(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $(DEFS) $(INC) -o $@ tabe_tsi.c

tabe_tsidbint.lo: tabe_tsidbint.c tabe.h
	$(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $(DEFS) $(INC) -o $@ tabe_tsidbint.c

tabe_tsiyindbint.lo: tabe_tsiyindbint.c tabe.h
	$(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $(DEFS) $(INC) -o $@ tabe_tsiyindbint.c

tabe_chu.lo: tabe_chu.c tabe.h
	$(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $(DEFS) $(INC) -o $@ tabe_chu.c

#
# Other targets.
#
.PHONY: clean distclean install
clean:
	$(RM) $(LIBNAME) $(TESTPRG) $(TESTOBJ) $(LIBOBJS) *.o .libs *~ core
	(cd supports/bims; $(MAKE) clean)

distclean:
	$(RM) $(LIBNAME) $(TESTPRG) $(TESTOBJ) $(LIBOBJS) *.o .libs *~ core
	$(RM) Makefile
	(cd supports/bims; $(MAKE) distclean)

install: all
	if [ ! -d $(libdir) ]; then $(INSTALL) -d $(libdir); fi
	if [ ! -d $(includedir) ]; then $(INSTALL) -d $(includedir); fi
	$(LIBTOOL) --mode=install $(INSTALL_DATA) $(LIBNAME) $(libdir)
	$(INSTALL_DATA) $(INCLUDES) $(includedir)
	(cd supports/bims; $(MAKE) install)

