1# Id: Makefile.in,v 1.2 2004/07/20 07:13:39 marka Exp
2# Copyright (c) 2000, 2002 Japan Network Information Center.
3# All rights reserved.
4#
5# By using this file, you agree to the terms and conditions set forth bellow.
6#
7# 			LICENSE TERMS AND CONDITIONS
8#
9# The following License Terms and Conditions apply, unless a different
10# license is obtained from Japan Network Information Center ("JPNIC"),
11# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
12# Chiyoda-ku, Tokyo 101-0047, Japan.
13#
14# 1. Use, Modification and Redistribution (including distribution of any
15#    modified or derived work) in source and/or binary forms is permitted
16#    under this License Terms and Conditions.
17#
18# 2. Redistribution of source code must retain the copyright notices as they
19#    appear in each source code file, this License Terms and Conditions.
20#
21# 3. Redistribution in binary form must reproduce the Copyright Notice,
22#    this License Terms and Conditions, in the documentation and/or other
23#    materials provided with the distribution.  For the purposes of binary
24#    distribution the "Copyright Notice" refers to the following language:
25#    "Copyright (c) 2000-2002 Japan Network Information Center.  All rights reserved."
26#
27# 4. The name of JPNIC may not be used to endorse or promote products
28#    derived from this Software without specific prior written approval of
29#    JPNIC.
30#
31# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
32#    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33#    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
34#    PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL JPNIC BE LIABLE
35#    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36#    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37#    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
38#    BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
39#    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
40#    OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
41#    ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
42
43build = @build@
44
45LIB_CURRENT = 1
46LIB_REVISION = 2
47LIB_AGE = 0
48
49.SUFFIXES:
50.SUFFIXES: .c .lo .to
51
52top_builddir = ..
53
54srcdir = @srcdir@
55VPATH = @srcdir@
56
57prefix = @prefix@
58exec_prefix = @exec_prefix@
59
60libdir = @libdir@
61sysconfdir = @sysconfdir@
62datadir = @datadir@
63mapdir = $(datadir)/idnkit
64utf8_name = @UTF8_NAME@
65
66SUBDIRS = tests
67
68SHELL = @SHELL@
69CC = @CC@
70RANLIB = @RANLIB@
71INSTALL = @INSTALL@
72INSTALL_PROGRAM = @INSTALL_PROGRAM@
73INSTALL_DATA = @INSTALL_DATA@
74MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
75LIBTOOL = @LIBTOOL@
76
77ICONVINC = @ICONVINC@
78ICONVLIB = @ICONVLIB@
79
80INCS = -I$(srcdir)/../include -I../include $(ICONVINC)
81DEFS = -DIDN_RESCONF_DIR="\"$(sysconfdir)\""
82
83CFLAGS = $(OPTS) $(INCS) $(DEFS) @CPPFLAGS@ @CFLAGS@
84LDFLAGS = @LDFLAGS@
85
86SRCS =  \
87	aliaslist.c \
88	api.c \
89	checker.c \
90	converter.c \
91	debug.c \
92	delimitermap.c \
93	filechecker.c \
94	filemapper.c \
95	localencoding.c \
96	log.c \
97	mapper.c \
98	mapselector.c \
99	nameprep.c \
100	nameprep_template.c \
101	nameprepdata.c \
102	normalizer.c \
103	punycode.c \
104	race.c \
105	res.c \
106	resconf.c \
107	result.c \
108	strhash.c \
109	ucs4.c \
110	ucsmap.c \
111	ucsset.c \
112	unicode.c \
113	unicode_template.c \
114	unicodedata_320.c \
115	unormalize.c \
116	util.c \
117	utf8.c \
118	version.c
119
120OBJS =  \
121	aliaslist.lo \
122	api.lo \
123	checker.lo \
124	converter.lo \
125	debug.lo \
126	delimitermap.lo \
127	filechecker.lo \
128	filemapper.lo \
129	localencoding.lo \
130	log.lo \
131	mapper.lo \
132	mapselector.lo \
133	nameprep.lo \
134	normalizer.lo \
135	punycode.lo \
136	race.lo \
137	res.lo \
138	resconf.lo \
139	result.lo \
140	strhash.lo \
141	ucs4.lo \
142	ucsmap.lo \
143	ucsset.lo \
144	unicode.lo \
145	unormalize.lo \
146	utf8.lo \
147	util.lo \
148	version.lo
149
150LIB = libidnkit
151TESTLIB = libidntest
152
153LITELIBCFLAGS = $(CFLAGS) -DWITHOUT_ICONV
154LITELIB_OBJS = \
155	apilite.lo \
156	converterlite.lo \
157	reslite.lo \
158	resconflite.lo \
159	aliaslist.lo \
160	checker.lo \
161	debug.lo \
162	delimitermap.lo \
163	filechecker.lo \
164	filemapper.lo \
165	log.lo \
166	mapper.lo \
167	mapselector.lo \
168	nameprep.lo \
169	normalizer.lo \
170	punycode.lo \
171	race.lo \
172	result.lo \
173	strhash.lo \
174	ucsmap.lo \
175	ucsset.lo \
176	unicode.lo \
177	unormalize.lo \
178	ucs4.lo \
179	utf8.lo \
180	util.lo \
181	version.lo
182
183LITELIB = libidnkitlite
184TESTLITELIB = libidntestlite
185
186SAMPLES = idn.conf.sample idnalias.conf.sample
187
188.c.lo:
189	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c $<
190
191.c.to:
192	$(CC) -o $@ -DTEST $(CFLAGS) $(LDFLAGS) -c $<
193
194all: all-localdir all-subdirs
195@LITEONLY_TRUE@all-localdir: $(LITELIB).la $(SAMPLES)
196@LITEONLY_FALSE@all-localdir: $(LIB).la $(LITELIB).la $(SAMPLES)
197
198$(LIB).la: $(OBJS)
199	$(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
200	    -version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
201	    -rpath $(libdir) $(OBJS)
202
203$(TESTLIB).la: $(OBJS)
204	$(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
205	    -version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
206	    -rpath $(libdir) $(OBJS)
207
208apilite.lo: api.c
209	$(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
210		-c $(srcdir)/api.c
211converterlite.lo: converter.c
212	$(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
213		-c $(srcdir)/converter.c
214reslite.lo: res.c
215	$(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
216	    -c $(srcdir)/res.c
217resconflite.lo: resconf.c
218	$(LIBTOOL) --mode=compile $(CC) $(LITELIBCFLAGS) -o $@ \
219	    -c $(srcdir)/resconf.c
220
221$(LITELIB).la: $(LITELIB_OBJS)
222	$(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
223	    -version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
224	    -rpath $(libdir) $(LITELIB_OBJS)
225
226$(TESTLITELIB).la: $(LITELIB_OBJS)
227	$(LIBTOOL) --mode=link $(LD) $(LDFLAGS) -o $@ \
228	    -version-info $(LIB_CURRENT):$(LIB_REVISION):$(LIB_AGE) \
229	    -rpath $(libdir) $(LITELIB_OBJS)
230
231idn.conf.sample: idn.conf.sample.in
232	sed -e 's%[@]mapdir[@]%$(mapdir)%' \
233	    < $(srcdir)/idn.conf.sample.in > $@
234
235idnalias.conf.sample: Makefile
236	$(SHELL) $(srcdir)/aliaslist.sh $(build) $(utf8_name) > $@
237
238install: install-localdir install-subdirs
239@LITEONLY_TRUE@install-localdir: all install-common
240@LITEONLY_FALSE@install-localdir: all install-common install-nolite
241
242install-common:
243	$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
244	$(LIBTOOL) $(INSTALL_DATA) $(LITELIB).la \
245	    $(DESTDIR)$(libdir)/$(LITELIB).la
246	-[ -f $(DESTDIR)$(libdir)/$(LITELIB).a ] \
247	    && $(RANLIB) $(DESTDIR)$(libdir)/$(LITELIB).a
248	$(MKINSTALLDIRS) $(DESTDIR)$(sysconfdir)
249	$(INSTALL_DATA) idn.conf.sample \
250	    $(DESTDIR)$(sysconfdir)/idn.conf.sample
251	$(INSTALL_DATA) idnalias.conf.sample \
252	    $(DESTDIR)$(sysconfdir)/idnalias.conf.sample
253	@if [ ! -f $(DESTDIR)$(sysconfdir)/idn.conf ]; then \
254	    echo "** installing default idn.conf"; \
255	    $(INSTALL_DATA) idn.conf.sample $(DESTDIR)$(sysconfdir)/idn.conf; \
256	fi
257	@if [ ! -f $(DESTDIR)$(sysconfdir)/idnalias.conf ]; then \
258	    echo "** installing default idnalias.conf"; \
259	    $(INSTALL_DATA) idnalias.conf.sample \
260		$(DESTDIR)$(sysconfdir)/idnalias.conf; \
261	fi
262
263install-nolite:
264	$(MKINSTALLDIRS) $(DESTDIR)$(libdir)
265	$(LIBTOOL) $(INSTALL_DATA) $(LIB).la \
266	    $(DESTDIR)$(libdir)/$(LIB).la
267	-[ -f $(DESTDIR)$(libdir)/$(LIB).a ] \
268	    && $(RANLIB) $(DESTDIR)$(libdir)/$(LIB).a
269
270install-config:
271	@if [ -f $(DESTDIR)$(sysconfdir)/idn.conf ]; then \
272	    echo "** backing up old idn.conf as idn.conf.old"; \
273	    mv -f $(DESTDIR)$(sysconfdir)/idn.conf \
274		$(DESTDIR)$(sysconfdir)/idn.conf.old; \
275	fi
276	@echo "** installing default idn.conf forcibly"
277	$(INSTALL_DATA) idn.conf.sample $(DESTDIR)$(sysconfdir)/idn.conf
278	@if [ -f $(DESTDIR)$(sysconfdir)/idnalias.conf ]; then \
279	    echo "** backing up old idnalias.conf as idnalias.conf.old"; \
280	    mv -f $(DESTDIR)$(sysconfdir)/idnalias.conf \
281		$(DESTDIR)$(sysconfdir)/idnalias.conf.old; \
282	fi
283	@echo "** installing default idnalias.conf forcibly"
284	$(INSTALL_DATA) idnalias.conf.sample \
285	    $(DESTDIR)$(sysconfdir)/idnalias.conf
286
287clean: clean-localdir clean-subdirs
288clean-localdir: force
289	rm -f *.o *.lo *.la *.a core *.core *~
290	rm -f *.to *_test.c *_test
291	rm -f idn.conf.sample idnalias.conf.sample
292	rm -fr .libs/
293
294distclean: distclean-localdir distclean-subdirs
295distclean-localdir: force clean-localdir
296	rm -f Makefile
297
298test check: test-localdir test-subdirs
299
300@LITEONLY_TRUE@test-localdir: $(TESTLITELIB).la $(SAMPLES)
301@LITEONLY_FALSE@test-localdir: $(TESTLIB).la $(TESTLITELIB).la $(SAMPLES)
302
303all-subdirs install-subdirs clean-subdirs distclean-subdirs test-subdirs:
304	@target=`echo $@ | sed 's/-subdirs$$//'`; \
305	for d in $(SUBDIRS) ; do \
306	    (cd $$d; $(MAKE) DESTDIR=$(DESTDIR) $$target); \
307	done
308
309force:
310