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