1# $Id: Makefile.in,v 1.22 2002/12/09 09:38:23 miyayama 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
43.SUFFIXES:
44.SUFFIXES: .tsy .c
45
46top_builddir = ../..
47
48srcdir = @srcdir@
49VPATH = @srcdir@
50
51CC = @CC@
52SHELL = @SHELL@
53LIBTOOL = @LIBTOOL@
54
55ICONVINC = @ICONVINC@
56ICONVLIB = @ICONVLIB@
57IDNLIB = ../libidntest.la
58IDNLITELIB = ../libidntestlite.la
59
60INCS = -I. -I$(srcdir) -I$(srcdir)/../../include -I../../include $(ICONVINC)
61DEFS =
62
63CFLAGS = $(INCS) $(DEFS) @CPPFLAGS@ @CFLAGS@
64LDFLAGS = @LDFLAGS@
65TSYFLAGS =
66
67PERL = @PERL@
68
69COMMONSRCS = testsuite.c testutil.c setenv.c
70COMMONOBJS = testsuite.lo testutil.lo setenv.lo
71BUILTSRCS = api.c api-init1.c api-init2.c api-init3.c \
72	api-init4-1.c api-init4-2.c api-init4-3.c \
73	api-init5-1.c api-init5-2.c api-init5-3.c \
74	res.c resconf.c mapselector.c checker.c converter.c mapper.c \
75	normalizer.c delimitermap.c ucs4.c nameprep.c \
76	testconfig.h
77
78TESTS = api-test \
79	api-init1-test \
80	api-init2-test \
81	api-init3-test \
82	api-init4-1-test \
83	api-init4-2-test \
84	api-init4-3-test \
85	api-init5-1-test \
86	api-init5-2-test \
87	api-init5-3-test \
88	res-test \
89	resconf-test \
90	mapselector-test \
91	converter-test \
92	checker-test \
93	mapper-test \
94	normalizer-test \
95	delimitermap-test \
96	ucs4-test \
97	nameprep-test
98
99LITETESTS = apilite-test \
100	reslite-test \
101	resconflite-test \
102	converterlite-test
103
104.tsy.c:
105	rm -f $@ $@.tmp
106	$(PERL) $(srcdir)/testygen -o $@ $(TSYFLAGS) $<
107	$(PERL) $(srcdir)/utffilter $@ > $@.tmp
108	mv -f $@.tmp $@
109
110all:
111
112install:
113
114clean:
115	rm -f *.o *.lo *.tmp core *.core *~
116	rm -f $(TESTS) $(LITETESTS) $(BUILTSRCS)
117	rm -f test.conf testalias.conf test.map
118	rm -f iconvchk
119	rm -fr .libs/
120
121distclean: clean
122	rm -f Makefile
123
124@LITEONLY_TRUE@test check: test-lite
125@LITEONLY_FALSE@test check: test-nolite
126
127test-lite: $(LITETESTS)
128	@for i in $(LITETESTS); do \
129	    echo "Run test program: $$i"; \
130	    ./$$i; \
131	    echo; \
132	done
133
134test-nolite: $(TESTS) $(LITETESTS) iconvchk
135	@./iconvchk
136	@for i in $(TESTS) $(LITETESTS); do \
137	    echo "Run test program: $$i"; \
138	    ./$$i; \
139	    echo; \
140	done
141
142api-test: api.lo $(IDNLIB) $(COMMONOBJS)
143	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
144		api.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
145api.lo: api.c testconfig.h
146	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api.c
147
148apilite-test: apilite.lo $(IDNLITELIB) $(COMMONOBJS)
149	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
150		apilite.lo $(COMMONOBJS) $(IDNLITELIB)
151apilite.lo: api.c testconfig.h
152	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -DWITHOUT_ICONV -o $@ \
153		-c api.c
154
155api-init1-test: api-init1.lo $(IDNLIB) $(COMMONOBJS)
156	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
157		api-init1.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
158api-init1.lo: api-init1.c testconfig.h
159	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init1.c
160
161api-init2-test: api-init2.lo $(IDNLIB) $(COMMONOBJS)
162	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
163		api-init2.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
164api-init2.lo: api-init2.c testconfig.h
165	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init2.c
166
167api-init3-test: api-init3.lo $(IDNLIB) $(COMMONOBJS)
168	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
169		api-init3.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
170api-init3.lo: api-init3.c testconfig.h
171	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init3.c
172
173api-init4-1-test: api-init4-1.lo $(IDNLIB) $(COMMONOBJS)
174	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
175		api-init4-1.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
176api-init4-1.lo: api-init4-1.c testconfig.h
177	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init4-1.c
178
179api-init4-2-test: api-init4-2.lo $(IDNLIB) $(COMMONOBJS)
180	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
181		api-init4-2.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
182api-init4-2.lo: api-init4-2.c testconfig.h
183	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init4-2.c
184
185api-init4-3-test: api-init4-3.lo $(IDNLIB) $(COMMONOBJS)
186	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
187		api-init4-3.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
188api-init4-3.lo: api-init4-3.c testconfig.h
189	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init4-3.c
190
191api-init5-1-test: api-init5-1.lo $(IDNLIB) $(COMMONOBJS)
192	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
193		api-init5-1.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
194api-init5-1.lo: api-init5-1.c testconfig.h
195	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init5-1.c
196
197api-init5-2-test: api-init5-2.lo $(IDNLIB) $(COMMONOBJS)
198	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
199		api-init5-2.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
200api-init5-2.lo: api-init5-2.c testconfig.h
201	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init5-2.c
202
203api-init5-3-test: api-init5-3.lo $(IDNLIB) $(COMMONOBJS)
204	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
205		api-init5-3.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
206api-init5-3.lo: api-init5-3.c testconfig.h
207	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c api-init5-3.c
208
209res-test: res.lo $(IDNLIB) $(COMMONOBJS)
210	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
211		res.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
212res.lo: res.c testconfig.h
213	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c res.c
214
215reslite-test: reslite.lo $(IDNLITELIB) $(COMMONOBJS)
216	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
217		reslite.lo $(COMMONOBJS) $(IDNLITELIB)
218reslite.lo: res.c testconfig.h
219	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -DWITHOUT_ICONV -o $@ \
220		-c res.c
221
222resconf-test: resconf.lo $(IDNLIB) $(COMMONOBJS)
223	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
224		resconf.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
225resconf.lo: resconf.c testconfig.h
226	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c resconf.c
227
228resconflite-test: resconflite.lo $(IDNLITELIB) $(COMMONOBJS)
229	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
230		resconflite.lo $(COMMONOBJS) $(IDNLITELIB)
231resconflite.lo: resconf.c testconfig.h
232	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -DWITHOUT_ICONV -o $@ \
233		-c resconf.c
234
235mapselector-test: mapselector.lo $(IDNLIB) $(COMMONOBJS)
236	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
237		mapselector.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
238mapselector.lo: mapselector.c
239	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c mapselector.c
240
241converter-test: converter.lo $(IDNLIB) $(COMMONOBJS)
242	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
243		converter.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
244converter.lo: converter.c
245	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c converter.c
246
247converterlite-test: converterlite.lo $(IDNLITELIB) $(COMMONOBJS)
248	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
249		converterlite.lo $(COMMONOBJS) $(IDNLITELIB)
250converterlite.lo: converter.c
251	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -DWITHOUT_ICONV -o $@ \
252		-c converter.c
253
254checker-test: checker.lo $(IDNLIB) $(COMMONOBJS)
255	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
256		checker.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
257checker.lo: checker.c
258	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c checker.c
259
260mapper-test: mapper.lo $(IDNLIB) $(COMMONOBJS)
261	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
262		mapper.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
263mapper.lo: mapper.c
264	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c mapper.c
265
266normalizer-test: normalizer.lo $(IDNLIB) $(COMMONOBJS)
267	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
268		normalizer.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
269normalizer.lo: normalizer.c
270	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c normalizer.c
271
272delimitermap-test: delimitermap.lo $(IDNLIB) $(COMMONOBJS)
273	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
274		delimitermap.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
275delimitermap.lo: delimitermap.c
276	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c delimitermap.c
277
278ucs4-test: ucs4.lo $(IDNLIB) $(COMMONOBJS)
279	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
280		ucs4.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
281ucs4.lo: ucs4.c
282	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c ucs4.c
283
284nameprep-test: nameprep.lo $(IDNLIB) $(COMMONOBJS)
285	$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ \
286		nameprep.lo $(COMMONOBJS) $(IDNLIB) $(ICONVLIB)
287nameprep.lo: nameprep.c
288	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c nameprep.c
289
290testsuite.lo: testsuite.c testsuite.h
291	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -o $@ -c $(srcdir)/testsuite.c
292testutil.lo: testutil.c testutil.h
293	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -o $@ -c $(srcdir)/testutil.c
294setenv.lo: setenv.c
295	$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -o $@ -c $(srcdir)/setenv.c
296
297testconfig.h: ../../include/config.h
298	rm -f testconfig.h
299	sed -n -e '/HAVE_SETENV/p' -e '/HAVE_UNSETENV/p' \
300		../../include/config.h > testconfig.h
301
302iconvchk: iconvchk.c codeset.h
303	$(LIBTOOL) --mode=link $(CC) $(CFLAGS) -o $@ \
304		$(srcdir)/iconvchk.c $(IDNLIB) $(ICONVLIB)
305