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