# $Id: Makefile.in,v 1.57.2.5 2002/02/20 05:28:47 m-kasahr Exp $
# Copyright (c) 2000 Japan Network Information Center.  All rights reserved.
#  
# By using this file, you agree to the terms and conditions set forth bellow.
# 
# 			LICENSE TERMS AND CONDITIONS 
# 
# The following License Terms and Conditions apply, unless a different
# license is obtained from Japan Network Information Center ("JPNIC"),
# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
# Chiyoda-ku, Tokyo 101-0047, Japan.
# 
# 1. Use, Modification and Redistribution (including distribution of any
#    modified or derived work) in source and/or binary forms is permitted
#    under this License Terms and Conditions.
# 
# 2. Redistribution of source code must retain the copyright notices as they
#    appear in each source code file, this License Terms and Conditions.
# 
# 3. Redistribution in binary form must reproduce the Copyright Notice,
#    this License Terms and Conditions, in the documentation and/or other
#    materials provided with the distribution.  For the purposes of binary
#    distribution the "Copyright Notice" refers to the following language:
#    "Copyright (c) Japan Network Information Center.  All rights reserved."
# 
# 4. Neither the name of JPNIC may be used to endorse or promote products
#    derived from this Software without specific prior written approval of
#    JPNIC.
# 
# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
#    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
#    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
#    PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL JPNIC BE LIABLE
#    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
#    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
#    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
#    BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#    ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
# 
# 6. Indemnification by Licensee
#    Any person or entities using and/or redistributing this Software under
#    this License Terms and Conditions shall defend indemnify and hold
#    harmless JPNIC from and against any and all judgements damages,
#    expenses, settlement liabilities, cost and other liabilities of any
#    kind as a result of use and redistribution of this Software or any
#    claim, suite, action, litigation or proceeding by any third party
#    arising out of or relates to this License Terms and Conditions.
# 
# 7. Governing Law, Jurisdiction and Venue
#    This License Terms and Conditions shall be governed by and and
#    construed in accordance with the law of Japan. Any person or entities
#    using and/or redistributing this Software under this License Terms and
#    Conditions hereby agrees and consent to the personal and exclusive
#    jurisdiction and venue of Tokyo District Court of Japan.

LIB_CURRENT = 9
LIB_REVISION = 0
LIB_AGE = 0

.SUFFIXES: .lo

top_builddir = ..

srcdir = @srcdir@
VPATH = @srcdir@

prefix = @prefix@
exec_prefix = @exec_prefix@

libdir = @libdir@
sysconfdir = @sysconfdir@
datadir = @datadir@
mapdir = $(datadir)/mdnkit
preference = @CONF_PREFERENCE@
install_conf = @INSTALL_DEFAULT_CONF@

CC = @CC@
RANLIB = @RANLIB@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
SHELL = @SHELL@
LIBTOOL = @LIBTOOL@

ICONVINC = @ICONVINC@
ICONVLIB = @ICONVLIB@

OPTS =
INCS = -I$(srcdir)/../include -I../include $(ICONVINC)
DEFS = -DMDN_RESCONF_DIR="\"$(sysconfdir)\""

CFLAGS = $(OPTS) $(INCS) $(DEFS) @CFLAGS@
LDFLAGS = @LDFLAGS@

SRCS =  \
	ace.c \
	altdude.c \
	amcacem.c \
	amcaceo.c \
	amcacer.c \
	amcacev.c \
	amcacew.c \
	amcacez.c \
	api.c \
	brace.c \
	checker.c \
	converter.c \
	debug.c \
	delimitermap.c \
	dn.c \
	dude.c \
	filechecker.c \
	filemapper.c \
	lace.c \
	localencoding.c \
	log.c \
	mace.c \
	mapper.c \
	mapselector.c \
	msgheader.c \
	msgtrans.c \
	nameprep.c \
	nameprep_template.c \
	nameprepdata.c \
	normalizer.c \
	race.c \
	res.c \
	resconf.c \
	result.c \
	selectiveencode.c \
	strhash.c \
	ucsmap.c \
	ucsset.c \
	unicode.c \
	unicode_template.c \
	unicodedata_301.c \
	unicodedata_310.c \
	unormalize.c \
	utf5.c \
	utf6.c \
	utf8.c \
	util.c \
	version.c

OBJS =  \
	ace.lo \
	altdude.lo \
	amcacem.lo \
	amcaceo.lo \
	amcacer.lo \
	amcacev.lo \
	amcacew.lo \
	amcacez.lo \
	api.lo \
	brace.lo \
	checker.lo \
	converter.lo \
	debug.lo \
	delimitermap.lo \
	dn.lo \
	dude.lo \
	filechecker.lo \
	filemapper.lo \
	lace.lo \
	localencoding.lo \
	log.lo \
	mace.lo \
	mapper.lo \
	mapselector.lo \
	msgheader.lo \
	msgtrans.lo \
	nameprep.lo \
	normalizer.lo \
	race.lo \
	res.lo \
	resconf.lo \
	result.lo \
	selectiveencode.lo \
	strhash.lo \
	ucsmap.lo \
	ucsset.lo \
	unicode.lo \
	unormalize.lo \
	utf5.lo \
	utf6.lo \
	utf8.lo \
	util.lo \
	version.lo

LIB = libmdn

LITELIBCFLAGS = $(CFLAGS) -DWITHOUT_ICONV
LITELIB_OBJS = \
	apilite.lo \
	converterlite.lo \
	reslite.lo \
	resconflite.lo \
	ace.lo \
	altdude.lo \
	amcacem.lo \
	amcaceo.lo \
	amcacer.lo \
	amcacev.lo \
	amcacew.lo \
	amcacez.lo \
	brace.lo \
	checker.lo \
	debug.lo \
	delimitermap.lo \
	dn.lo \
	dude.lo \
	filechecker.lo \
	filemapper.lo \
	lace.lo \
	log.lo \
	mace.lo \
	mapper.lo \
	mapselector.lo \
	msgheader.lo \
	msgtrans.lo \
	nameprep.lo \
	normalizer.lo \
	race.lo \
	result.lo \
	selectiveencode.lo \
	strhash.lo \
	ucsmap.lo \
	ucsset.lo \
	unicode.lo \
	unormalize.lo \
	utf5.lo \
	utf6.lo \
	utf8.lo \
	util.lo \
	version.lo

LITELIB = libmdnlite

.c.lo:
	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<

all: $(LIB).la $(LITELIB).la mdn.conf.sample

$(LIB).la: $(OBJS)
	$(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
		-version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
		-rpath $(libdir) $(OBJS)

apilite.lo: api.c
	$(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
		-c $(srcdir)/api.c
converterlite.lo: converter.c
	$(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
		-c $(srcdir)/converter.c
reslite.lo: res.c
	$(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
		-c $(srcdir)/res.c
resconflite.lo: resconf.c
	$(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
		-c $(srcdir)/resconf.c

$(LITELIB).la: $(LITELIB_OBJS)
	$(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
		-version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
		-rpath $(libdir) $(LITELIB_OBJS)

mdn.conf.sample: mdn.conf.sample.in
	sed -e 's%[@]mapdir[@]%$(mapdir)%' \
	    -e 's%[@]preference[@]%$(preference)%' \
            -e 's%^#\[$(preference)\] *%%' < $(srcdir)/mdn.conf.sample.in > $@

install: $(LIB).la $(LITELIB).la mdn.conf.sample
	$(MKINSTALLDIRS) $(libdir)
	$(LIBTOOL) $(INSTALL_DATA) $(LIB).la $(libdir)
	-[ -f $(libdir)/$(LIB).a ] && $(RANLIB) $(libdir)/$(LIB).a
	$(LIBTOOL) $(INSTALL_DATA) $(LITELIB).la $(libdir)
	-[ -f $(libdir)/$(LITELIB).a ] && $(RANLIB) $(libdir)/$(LITELIB).a
	$(MKINSTALLDIRS) $(sysconfdir)
	$(INSTALL_DATA) mdn.conf.sample $(sysconfdir)
	@if [ $(install_conf) = yes -a ! -f $(sysconfdir)/mdn.conf ]; then \
	    echo "** installing default mdn.conf"; \
	    $(INSTALL_DATA) mdn.conf.sample $(sysconfdir)/mdn.conf; \
	fi

clean:
	rm -f *.o *.lo *.la *.a core *.core *~
	rm -f mdn.conf.sample
	rm -fr .libs/
