Makefile revision 1.1
1#	$NetBSD: Makefile,v 1.1 2013/11/22 16:00:45 christos Exp $
2#
3#	@(#)Makefile	8.29 (Berkeley) 10/19/96
4
5NOMAN=		# defined
6
7.include "../Makefile.inc"
8
9.PATH:	${DIST}/catalog
10
11CATALOG=	dutch english french german ru_RU.KOI8-R ru_SU.KOI8-R \
12		spanish swedish
13
14VI_FILES=	${DIST}/cl/*.c ${DIST}/common/*.c \
15		${DIST}/ex/*.c ${DIST}/vi/*.c
16FILES=		${CATALOG}
17FILESDIR=	/usr/share/nvi/catalog
18
19HOSTPROG=	dump
20SRCS=		dump.c
21
22CLEANFILES+=	${CATALOG} english.base *.check __ck1 __ck2
23
24realall: ${CATALOG}
25
26${CATALOG}: ${CATALOG:S/$/.base/}
27	@echo "... $@";							\
28	rm -f $@;							\
29	if test -f $@.base; then					\
30		f=$@.base;						\
31	else								\
32		f=${DIST}/catalog/$@.base;				\
33	fi;								\
34	sort -u $$f |							\
35	${TOOL_AWK} '{							\
36		if ($$1 == 1) {						\
37			print "\nMESSAGE NUMBER 1 IS NOT LEGAL";	\
38			exit 1;						\
39		}							\
40		if (++nline > $$1) {					\
41			print "DUPLICATE MESSAGE NUMBER " $$1;		\
42			exit 1;						\
43		}							\
44		for (; nline < $$1; ++nline)				\
45			print "";					\
46		print $0;						\
47	}' |								\
48	${TOOL_SED} -e '1s/^/VI_MESSAGE_CATALOG/'			\
49	    -e '/"/s/^[^"]*"//'						\
50	    -e '1!s/"$$/X/' > $@;					\
51	if grep DUPLICATE $@ > /dev/null; then				\
52		grep DUPLICATE $@;					\
53	fi;								\
54	if grep 'NOT LEGAL' $@ > /dev/null; then			\
55		grep 'NOT LEGAL' $@;					\
56	fi
57
58CHK=	dutch.check english.check french.check german.check \
59	ru_RU.KOI8-R.check spanish.check swedish.check
60check: ${CHK}
61${CHK}: ${CATALOG}
62	@echo "... $@";							\
63	f=${DIST}/catalog/`basename $@ .check`;				\
64	(echo "Unused message id's (this is okay):";			\
65	${TOOL_AWK} '{							\
66		while (++nline < $$1)					\
67			printf "%03d\n", nline;				\
68	}' < ${DIST}/catalog/$$f.base;					\
69	echo =========================;					\
70	echo "MISSING ERROR MESSAGES (Please add!):";			\
71	${TOOL_AWK} '{print $$1}' < $$f.base | sort -u > __ck1;		\
72	${TOOL_AWK} '{print $$1}' < english.base | sort -u > __ck2;	\
73	comm -13 __ck1 __ck2;						\
74	echo =========================;					\
75	echo "Extra error messages (just delete them):";		\
76	comm -23 __ck1 __ck2;						\
77	echo =========================;					\
78	echo "MESSAGES WITH THE SAME MESSAGE ID's (FIX!):";		\
79	for j in							\
80	    `${TOOL_SED} '/^$$/d' < $$f.base | sort -u |		\
81	    ${TOOL_AWK} '{print $$1}' | uniq -d`; do			\
82		egrep $$j $$f.base;					\
83	done;								\
84	echo =========================;					\
85	echo "Duplicate messages, both id and message (this is okay):";	\
86	${TOOL_SED} '/^$$/d' < $$f.base | sort | uniq -c |		\
87	${TOOL_AWK} '$$1 != 1 { print $$0 }' | sort -n;			\
88	echo =========================;					\
89	echo "Duplicate messages, just message (this is okay):";	\
90	${TOOL_SED} '/^$$/d' < $$f | sort | uniq -c |			\
91	${TOOL_AWK} '$$1 != 1 { print $$0 }' | sort -n;			\
92	echo =========================) > $@
93
94english.base: dump ${VI_FILES} #Makefile
95	${_MKTARGET_CREATE}
96	./dump ${VI_FILES} |\
97	${TOOL_SED} -e '/|/!d' \
98	    -e 's/|/ "/' \
99	    -e 's/^"//' \
100	    -e 's/\\"/"/g' |\
101	sort -n > $@
102
103.include <bsd.hostprog.mk>
104