xref: /freebsd/contrib/nvi/catalog/Makefile (revision 134e17798c9af53632b372348ab828e75e65bf46)
1#	$Id: Makefile,v 9.0 2012/10/19 15:13:11 zy Exp $
2
3CAT=	dutch english french german polish ru_RU.KOI8-R spanish swedish \
4	uk_UA.KOI8-U zh_CN.GB2312
5FILES=	../cl/*.c ../common/*.c ../ex/*.c ../vi/*.c
6
7all: dump ${CAT}
8
9${CAT}: english.base
10	@echo "... $@";							\
11	rm -f $@;							\
12	sort -u $@.base |						\
13	awk '{								\
14		if ($$1 == 1) {						\
15			print "\nMESSAGE NUMBER 1 IS NOT LEGAL";	\
16			exit 1;						\
17		}							\
18		if (++nline > $$1) {					\
19			print "DUPLICATE MESSAGE NUMBER " $$1;		\
20			exit 1;						\
21		}							\
22		print $0;						\
23	}' |								\
24	sed -e '1s/^/$$set 1~$$quote "~/; 1y/~/\n/' |			\
25	gencat $@ /dev/stdin;						\
26	chmod 444 $@;							\
27	if grep DUPLICATE $@ > /dev/null; then				\
28		grep DUPLICATE $@;					\
29	fi;								\
30	if grep 'NOT LEGAL' $@ > /dev/null; then			\
31		grep 'NOT LEGAL' $@;					\
32	fi
33
34CHK=	dutch.check english.check french.check german.check \
35	polish.check ru_RU.KOI8-R.check spanish.check swedish.check \
36	uk_UA.KOI8-U.check zh_CN.GB2312.check
37check: ${CHK}
38${CHK}: ${CAT}
39	@echo "... $@";							\
40	f=`basename $@ .check`;						\
41	(echo "Unused message id's (this is okay):";			\
42	awk '{								\
43		while (++nline < $$1)					\
44			printf "%03d\n", nline;				\
45	}' < $$f.base;							\
46	echo =========================;					\
47	echo "MISSING ERROR MESSAGES (Please add!):";			\
48	awk '{print $$1}' < $$f.base | sort -u > __ck1;			\
49	awk '{print $$1}' < english.base | sort -u > __ck2;		\
50	comm -13 __ck1 __ck2;						\
51	echo =========================;					\
52	echo "Extra error messages (just delete them):";		\
53	comm -23 __ck1 __ck2;						\
54	echo =========================;					\
55	echo "MESSAGES WITH THE SAME MESSAGE ID's (FIX!):";		\
56	for j in							\
57	    `sed '/^$$/d' < $$f.base | sort -u |			\
58	    awk '{print $$1}' | uniq -d`; do				\
59		egrep $$j $$f.base;					\
60	done;								\
61	echo =========================;					\
62	echo "Duplicate messages, both id and message (this is okay):";	\
63	sed '/^$$/d' < $$f.base | sort | uniq -c |			\
64	awk '$$1 != 1 { print $$0 }' | sort -n;				\
65	echo =========================) > $@
66
67english.base: dump ${FILES} #Makefile
68	./dump ${FILES} |\
69	sed -e '/|/!d' \
70	    -e 's/|/ "/' \
71	    -e 's/^"//' |\
72	sort -nu > $@
73
74dump: dump.c
75	${CC} -O -o dump dump.c
76
77clean:
78	rm -f dump dump.o ${CAT} english.base *.check __ck1 __ck2
79