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