xref: /freebsd/tools/test/iconv/Makefile (revision b9f654b163bce26de79705e77b872427c9f2afa1)
1# $FreeBSD$
2
3SUBDIR=	tablegen refgen	posix gnu
4
5ENCODING= ASCII ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4	ISO8859-5 ISO8859-6 \
6	ISO8859-7 ISO8859-8 ISO8859-9 ISO8859-10 ISO8859-11 ISO8859-13 \
7	ISO8859-14 ISO8859-15 ISO8859-16 ARMSCII-8 BIG5 BIG5-HKSCS \
8	CP1131 CP1251 CP866 CP949 GB18030 GB2312 GBK VISCII KOI8-R KOI8-U \
9	PT154 SHIFT_JIS EUC-CN EUC-JP EUC-KR
10
11.if defined(EXTRA_CHECK)
12ENCODING+= ATARIST BIG5-2003 C99 CP1046 CP1124 CP1125 CP1129 CP1131 CP1133 \
13	CP1161 CP1162 CP1163 CP1250 CP1251 CP1252 CP1253 CP1254 CP1255 \
14	CP1256 CP1257 CP1258 CP437 CP737 CP775 CP850 CP852 CP853 CP855 \
15	CP856 CP857 CP858 CP860 CP861 CP862 CP863 CP864 CP865 CP866 CP869 \
16	CP874 CP922 CP932 CP936 CP943 CP949 CP950 DEC-HANYU EUC-TW \
17	EUC-JIS-2004 GB18030 GBK GEORGIAN-ACADEMY GEORGIAN-PS HP-ROMAN8 \
18	HZ ISO-2022-CN ISO-2022-CN-EXT ISO-2022-JP ISO-2022-JP-1 \
19	ISO-2022-JP-2 ISO-2022-JP-2004 ISO-2022-KR ISO-IR-14 ISO-IR-57 \
20	ISO-IR-165 JAVA JIS_X0201 JIS_X0208-1990 JOHAB KOI8-RU KOI8-T \
21	KZ-1048 MULELAO-1 NEXTSTEP PT154 RISCOS-LATIN1 TCVN5712-1 \
22	TDS565
23#
24# MAC encodings are known to be outdated in GNU so it's no good
25# to ensure compatibility blindly here
26#
27#ENCODING+= MACARABIC MACCENTRALEUROPE MACCROATIAN MACCYRILLIC MACGREEK \
28#	MACICELAND MACROMANIA MACROMAN MACTHAI MACTURKISH MACUKRAINE \
29#	MACHEBREW
30.endif
31
32GEN_FWD?= ${.CURDIR}/tablegen/tablegen -t
33GEN_REV?= ${.CURDIR}/tablegen/tablegen -tr
34REF_FWD?= ${.CURDIR}/refgen/refgen -t
35REF_REV?= ${.CURDIR}/refgen/refgen -tr
36CMP?=	${.CURDIR}/tablegen/cmp.sh
37
38make-ref: refgen
39	mkdir -p ref
40.for enc in ${ENCODING}
41	@echo "Generating ${enc} --> UTF-32 ..."
42	-@${REF_FWD} ${enc} >ref/${enc}
43	@echo "Generating UTF-32 --> ${enc} ..."
44	-@${REF_REV} ${enc} >ref/${enc}-rev
45.endfor
46
47check: tablegen
48	mkdir -p output
49.for enc in ${ENCODING}
50	@echo "Checking ${enc} --> UTF-32 ..."
51	-@${GEN_FWD} ${enc} >output/${enc}
52	@${CMP} ref/${enc} output/${enc}
53	@echo "Checking UTF-32 --> ${enc} ..."
54	-@${GEN_REV} ${enc} >output/${enc}-rev
55	@${CMP} ref/${enc}-rev output/${enc}-rev
56.endfor
57
58perftest: refgen tablegen
59.for enc in ${ENCODING}
60	@echo "Checking ${enc} --> UTF-32 ..."
61	@echo "GNU runtime:"
62	@/usr/bin/time -h ${REF_FWD} ${enc} >/dev/null
63	@echo "BSD runtime:"
64	@/usr/bin/time -h ${GEN_FWD} ${enc} >/dev/null
65	@echo "Checking UTF-32 --> ${enc} ..."
66	@echo "GNU runtime:"
67	@/usr/bin/time -h ${REF_REV} ${enc} >/dev/null
68	@echo "BSD runtime:"
69	@/usr/bin/time -h ${GEN_REV} ${enc} >/dev/null
70.endfor
71
72posixtest: posix
73	@${.CURDIR}/posix/posix
74
75gnutest: gnu
76	@${.CURDIR}/gnu/gnu
77
78test-everything: check perftest posixtest gnutest
79
80CLEANDIRS+= output
81
82.include <bsd.prog.mk>
83