#
# Copyright 1999, TaBE Project, All Rights Reserved.
# Copyright 1999, Pai-Hsiang Hsiao, All Rights Reserved.
#
# $Id: Makefile.in,v 1.8 2004/09/20 03:25:49 kcwu 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) @build_supports@

$(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
	for i in @build_supports@; do cd supports/$$i; $(MAKE) clean; done

distclean:
	$(RM) $(LIBNAME) $(TESTPRG) $(TESTOBJ) $(LIBOBJS) *.o .libs *~ core
	$(RM) Makefile
	for i in @build_supports@; do cd supports/$$i; $(MAKE) distclean; done

install: all
	if [ ! -d $(DESTDIR)$(libdir) ]; then $(INSTALL) -d $(DESTDIR)$(libdir); fi
	if [ ! -d $(DESTDIR)$(includedir) ]; then $(INSTALL) -d $(DESTDIR)$(includedir); fi
	$(LIBTOOL) --mode=install $(INSTALL_DATA) $(LIBNAME) $(DESTDIR)$(libdir)
	$(INSTALL_DATA) $(INCLUDES) $(DESTDIR)$(includedir)
	for i in @build_supports@; do cd supports/$$i; $(MAKE) install; done

