1#############################################################################
2# mined text editor make actions (make include file for make targets)
3
4
5#############################################################################
6# components to be compiled
7
8# Mined modules
9PROGOBJS = \
10	$(OBJDIR)/minedaux.o $(OBJDIR)/legacy.o \
11	$(OBJDIR)/mined1.o $(OBJDIR)/textfile.o \
12	$(OBJDIR)/mousemen.o \
13	$(OBJDIR)/edit.o $(OBJDIR)/pastebuf.o $(OBJDIR)/textbuf.o \
14	$(OBJDIR)/justify.o $(OBJDIR)/search.o $(OBJDIR)/charprop.o \
15	$(OBJDIR)/output.o $(OBJDIR)/prompt.o $(OBJDIR)/compose.o \
16	$(OBJDIR)/charcode.o \
17	$(OBJDIR)/keymaps.o $(OBJDIR)/keydefs.o $(OBJDIR)/dispatch.o \
18	$(OBJDIR)/termprop.o $(OBJDIR)/width.o $(OBJDIR)/encoding.o \
19	$(OBJDIR)/handescr.o
20ALLPROGOBJS = $(PROGOBJS) $(OBJDIR)/timestmp.o
21#OBJS = $(PROGOBJS) $(CHARMAPS)
22
23# make target parameters that may be overriden in makefile
24# (could be set to default with the ?= syntax but that doesn't work
25# in all versions of make)
26
27SCREENOBJ=$(OBJDIR)/io.o $(OBJDIR)/keyboard.o
28SCREENOBJANSI=$(OBJDIR)/ioansi.o $(OBJDIR)/keyboard.o
29SCREENOBJCURS=$(OBJDIR)/iocurses.o $(OBJDIR)/keycurs.o
30
31MOUSELIB=
32
33#KEYMAPSDEP?=keymaps.t
34
35
36#############################################################################
37# commands
38
39#WGET=curl -R -O --connect-timeout 55
40WGET=wget -N -t 1 --timeout=55
41
42SH=sh
43#SH=${SHELL}
44
45
46#############################################################################
47# target properties, default target, auxiliary targets
48
49# functional or abbreviated (non-file) targets:
50.PHONY:	mkcharmaps mkkeymaps mnemodoc quotesdoc help man bin install localinstall optinstall links clean clear debianclean update all clean_unidata clean_unihan clean_udata vni viqr vtelex
51
52# Default make target:
53all:	$(MAKEMAPS) mined
54
55DOC=../usrshare/doc_user
56
57
58#############################################################################
59# Unicode data tables:
60
61# With Unicode 7.0, there is no UCD.zip anymore, so downloaded separately
62#UCD.zip:
63#	echo Trying to retrieve Unicode data file via Internet
64#	$(WGET) http://unicode.org/Public/UNIDATA/UCD.zip
65#UnicodeData.txt:	UCD.zip
66#	unzip UCD UnicodeData.txt
67#Scripts.txt:	UCD.zip
68#	unzip UCD Scripts.txt
69#Blocks.txt:	UCD.zip
70#	unzip UCD Blocks.txt
71#SpecialCasing.txt:	UCD.zip
72#	unzip UCD SpecialCasing.txt
73#PropList.txt:	UCD.zip
74#	unzip UCD PropList.txt
75#EastAsianWidth.txt:	UCD.zip
76#	unzip UCD EastAsianWidth.txt
77#PropertyValueAliases.txt:	UCD.zip
78#	unzip UCD PropertyValueAliases.txt
79#DerivedBidiClass.txt:	UCD.zip
80#	unzip -j UCD extracted/DerivedBidiClass.txt
81#NameAliases.txt:	UCD.zip
82#	unzip UCD NameAliases.txt
83
84%.txt:
85	$(WGET) http://unicode.org/Public/UNIDATA/$@
86
87Unihan.zip:
88	echo Trying to retrieve Unicode data file via Internet
89	$(WGET) http://unicode.org/Public/UNIDATA/Unihan.zip
90
91BIG5.TXT:
92	echo Trying to retrieve Unicode data file via Internet
93	$(WGET) http://unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT
94
95check_ccc:
96	grep "^ccc; *230;.*; *Above$$" PropertyValueAliases.txt
97
98clean_unidata:	UnicodeData.txt SpecialCasing.txt Scripts.txt PropList.txt PropertyValueAliases.txt check_ccc
99	rm -f casetabl.t casespec.t softdot.t combin.t
100	rm -f scripts.t scriptdf.t charname.t charseqs.t categors.sed categors.t
101	rm -f UniWITH
102
103clean_unihan:	Unihan.zip
104	echo "Regenerate Han info data (may take long time)? (yes/n) " | tr -d '\n' ; read a; [ "$$a" != yes ] || rm -f handescr.t handescr/descriptions.uni
105	echo "Regenerate Radical/Stroke input method (may take very long time)? (yes/n) " | tr -d '\n' ; read a; [ "$$a" != yes ] || rm -f keymaps?/Radical_Stroke.h
106
107clean_udata:
108	rm -f udata_* udata-*
109
110uniset:	uniset.tar.gz
111	gzip -dc uniset.tar.gz | tar xvf - uniset
112
113uniset.tar.gz:
114	$(WGET) http://www.cl.cam.ac.uk/~mgk25/download/uniset.tar.gz
115
116#WIDTH-A:	uniset.tar.gz
117#	tar xvzf uniset.tar.gz WIDTH-A
118
119WIDTH-A:	EastAsianWidth.txt
120	$(SH) ./mkwidthA
121
122
123udata:	udata_combining.t udata_spacingcombining.t udata_ambiguous.t udata_assigned.t
124	cat udata_combining.t udata_spacingcombining.t udata_assigned.t > width.t.add
125
126univer = `sed -e '/^\# Blocks-/ s,[^0-9],,g' -e t -e d Blocks.txt`
127univer_prev = `sed -e '/^\# Blocks-/ s,[^0-9],,g' -e t -e d unicode-previous/Blocks.txt`
128
129# (Blocks.txt is a dummy dependency of uniset)
130
131# Hangul JUNGSEONG and JONGSEONG combining characters:
132#Unicode < 5.2: extracomb=+1160-11FF
133extracomb=+1160-11FF +D7B0-D7C6 +D7CB-D7FB
134
135udata_combining.t:	UnicodeData.txt Blocks.txt
136	echo > udata_combining.t
137	echo "static struct interval" >> udata_combining.t
138	echo "combining_$(univer) [] =" >> udata_combining.t
139	uniset +cat=Me +cat=Mn +cat=Cf -00AD $(extracomb) +200B c >> udata_combining.t
140
141udata_ambiguous.t:	UnicodeData.txt Blocks.txt WIDTH-A
142	echo > udata_ambiguous.t
143	echo "static struct interval" >> udata_ambiguous.t
144	echo "ambiguous_$(univer) [] =" >> udata_ambiguous.t
145	uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c >> udata_ambiguous.t
146
147udata_spacingcombining.t:	UnicodeData.txt Blocks.txt
148	echo > udata_spacingcombining.t
149	echo "static struct interval" >> udata_spacingcombining.t
150	echo "spacing_combining_$(univer) [] =" >> udata_spacingcombining.t
151	uniset +cat=Mc c >> udata_spacingcombining.t
152
153# not strictly needed for current Unicode version;
154# same range of characters as listed in scripts.t
155udata_assigned.t:	UnicodeData.txt Blocks.txt
156	echo > udata_assigned.t
157	echo "static struct interval" >> udata_assigned.t
158	echo "assigned_$(univer) [] =" >> udata_assigned.t
159	uniset +0000-10FFFF clean c >> udata_assigned.t
160
161udata-update:	Blocks.txt udata-add_assigned udata-add_combining WIDTH-A udata-add_ambiguous udata-add_right-to-left
162
163unicode-previous/WIDTH-A:
164	(cd unicode-previous; ${PWD}/mkwidthA)
165
166udata-add_assigned:
167	(cd unicode-previous >&2; uniset +0000-10FFFF clean table) > udata-old_assigned
168	uniset +0000-10FFFF clean table > udata-new_assigned
169	uniset +udata-new_assigned -udata-old_assigned ucs table > udata-add_assigned
170
171udata-add_combining:
172	(cd unicode-previous >&2; uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B table) > udata-old_combining
173	uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B table > udata-new_combining
174	uniset +udata-new_combining -udata-old_combining ucs table > udata-add_combining
175
176udata-add_ambiguous:	WIDTH-A unicode-previous/WIDTH-A
177	(cd unicode-previous >&2; uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf table) > udata-old_ambiguous
178	uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf table > udata-new_ambiguous
179	uniset +udata-new_ambiguous -udata-old_ambiguous ucs table > udata-add_ambiguous
180
181udata-add_right-to-left:
182	(cd unicode-previous >&2; sed -e 's-^\([^;]*\);\([^;]*\);\([^;]*\);\([^;]*\);R;.*-	\1-' -e t -e 's-^\([^;]*\);\([^;]*\);\([^;]*\);\([^;]*\);AL;.*-	\1-' -e t -e d UnicodeData.txt | uniset +- table) > udata-old_right-to-left
183	sed -e 's-^\([^;]*\);\([^;]*\);\([^;]*\);\([^;]*\);R;.*-	\1-' -e t -e 's-^\([^;]*\);\([^;]*\);\([^;]*\);\([^;]*\);AL;.*-	\1-' -e t -e d UnicodeData.txt | uniset +- table > udata-new_right-to-left
184	uniset +udata-new_right-to-left -udata-old_right-to-left ucs table > udata-add_right-to-left
185
186
187u/full-unicode.txt:	UnicodeData.txt Blocks.txt
188	(uniset +0000-FFFF utf8-list ; uniset +10000..10FFFF clean utf8-list) > u/full-unicode.txt
189
190
191# Vietnamese input methods:
192
193UniWITH:	UnicodeData.txt
194	sed -e "s,^\([^;]*\);\([^;]* LETTER [^;]* WITH [^;]*\);.*,U+\1	\2 AND," -e t -e d UnicodeData.txt | CC=$(CC) $(SH) ./insutf8 > UniWITH
195
196vni:	keymaps/VNI.h
197
198categors.sed:	mkcategs # PropertyValueAliases.txt
199	$(SH) ./mkcategs -sed
200
201categors.t:	mkcategs # PropertyValueAliases.txt
202	$(SH) ./mkcategs -h
203
204keymaps/VNI.h:	UniWITH vni.sev vni.sed vni.seh
205	mkdir -p keymaps
206	(sed -f vni.sev UniWITH ; cat UniWITH) | LC_ALL=C sed -f vni.sed | sed -f vni.seh > keymaps/VNI.h
207
208viqr:	keymaps/VIQR.h
209
210keymaps/VIQR.h:	keymaps/VNI.h
211	mkdir -p keymaps
212	sed -e "s,VNI,VIQR," keymaps/VNI.h | LC_ALL=C tr "6879125340" "^(+d\'\`.?~-" > keymaps/VIQR.h
213
214vtelex:	keymaps/Vtelex.h
215
216keymaps/Vtelex.h:	keymaps/VNI.h
217	mkdir -p keymaps
218	sed -e "s,VNI,Vtelex," -e "s,\([Aa]\)6,\1a," -e "s,\([Ee]\)6,\1e," -e "s,\([Oo]\)6,\1o," keymaps/VNI.h | LC_ALL=C tr "879125340" "wwdsfjrxz" > keymaps/Vtelex.h
219
220# Case conversion tables:
221
222casetabl.t:	mkcasetb # UnicodeData.txt
223	$(SH) ./mkcasetb
224
225casespec.t:	mkcasesp # SpecialCasing.txt
226	$(SH) ./mkcasesp
227
228# Unicode character information tables:
229wide.t:	mkwidthW # EastAsianWidth.txt
230	$(SH) ./mkwidthW
231
232softdot.t:	mkpropl # PropList.txt
233	$(SH) ./mkpropl Soft_Dotted > softdot.t
234
235combin.t:	mkcombin # UnicodeData.txt
236	CC=$(CC) $(SH) ./mkcombin
237
238typoprop.t:	mkpropl # PropList.txt
239	$(SH) ./mkpropl Quotation_Mark > typoprop.t
240	$(SH) ./mkpropl Dash >> typoprop.t
241	$(SH) ./mkpropl Ps >> typoprop.t
242
243#scriptdf.t and scripts.t are made together by mkscript2
244scriptdf.t:	scripts.t	# mkscript2 scripts.tt
245
246scripts.t:	mkscript mkscript2 categors.sed # Scripts.txt
247	CC=$(CC) $(SH) ./mkscript
248	$(SH) ./mkscript2
249	rm -f scripts.tt
250
251charname.t:	mkchname # UnicodeData.txt
252	CC=$(CC) $(SH) ./mkchname
253
254charseqs.t:	mkchseqs # UnicodeData.txt
255	CC=$(CC) $(SH) ./mkchseqs
256
257decompos.t:	mkdecompose # UnicodeData.txt
258	CC=$(CC) $(SH) ./mkdecompose
259
260# from:		Greek		124 64
261# generate:		{"Greek", 124, 64},
262colours.t:	colours.cfg # mkinclud.mak
263	sed -e 's/^[ 	"]*\([A-Z][A-Za-z_]*\)[ 	,"]*\([0-9][0-9]*\)[	 ][	 ]*\([0-9][0-9]*\).*/	{"\1", \2, \3},/' -e t -e 's/^[ 	"]*\([A-Z][A-Za-z_]*\)[ 	,"]*\([0-9][0-9]*\).*/	{"\1", \2, -1},/' -e t -e d colours.cfg | sort > colours.t
264
265# quotation marks styles:
266quotes.t:	quotes.cfg mkquotes
267	$(SH) ./mkquotes quotes.cfg > quotes.t
268	# to keep web doc consistent:
269	$(SH) ./mkquotesdoc quotes.cfg > $(DOC)/quotesdoc.html
270
271# Unihan database dependent information:
272unihan:	handescr.t radical_stroke
273	echo "mkkbmap Cangjie [+]"
274
275# Unihan character description table:
276handescr.t:	# handescr/mkdescriptions handescr/descriptions.sed handescr/descriptions.uni # Unihan.zip
277	cd handescr && $(MAKE) descriptions.h
278	ln handescr/descriptions.h handescr.t || cp handescr/descriptions.h handescr.t
279	ln handescr/Radical_Stroke.h keymaps0/ || cp handescr/Radical_Stroke.h keymaps0/
280
281# Radical/Stroke input method table:
282radical_stroke:	keymaps/Radical_Stroke.h
283
284keymaps/Radical_Stroke.h:	# Unihan.zip
285	cd handescr && $(MAKE) Radical_Stroke.h
286	ln handescr/Radical_Stroke.h keymaps/ || cp handescr/Radical_Stroke.h keymaps/
287
288# Radical/Stroke input method table:
289cangjie:	keymaps/Cangjie.h
290
291keymaps/Cangjie.h:	# Unihan.zip etc/charmaps/hkscs/hkscs-2004-cj.txt
292	$(SH) ./mkkbmap cj +
293
294# Keyboard mapping table configuration:
295
296# source lines: Greek	GreekMonotonic	gr	(Y)
297# check input method tag ("gr", ...) for uniqueness
298getkeymapstags = sed -e '/^\#/ d' -e '/^--/ d' -e t -e 's/^[ 	"]*\([^	]*\)		*\([A-Za-z0-9_][^ 	]*\)		*\([^ 	][^ 	]\).*/\3/' -e t -e d keymaps.cfg
299checkkeymapstags:	keymaps.cfg
300	LC_ALL=C $(getkeymapstags) | sort | uniq -d | sed -e "s,^,," -e "s,$$,," | if grep .; then echo ERROR: duplicate tags in keymaps.cfg; false; else true; fi
301
302filterCJK=-e "/^-.*Japanese/,/^$$/ b cjk" -e "/^-.*Chinese/,/^$$/ b cjk" -e "/^-.*Korean/,/^$$/ b cjk" -e "b nocjk" -e ": cjk" -e "/^-/ s,.*,\#ifdef use_CJKkeymaps," -e "/^$$/ s,,\#endif," -e t -e ": nocjk"
303
304# from:		Greek	GreekMonotonic	gr	(Y)
305# generate:		{"Greek", select_keymap_entry, "gr", keymapon, "Y"},
306# from:		---- Group
307# generate:		{"Group", separator, ""},
308keymapsm.t:	keymaps.cfg # mkinclud.mak
309	$(MAKE) -f mkinclud.mak checkkeymapstags
310	LC_ALL=C sed -e '/^#/ d' -e 's/^--* *\(.*\) */	{"\1", separator, ""},/' -e t -e 's/^[ 	"]*\([^	]*\)		*\([A-Za-z0-9_][^ 	]*\)		*\([^ 	][^ 	]\)		*(*\([^)	 ]*\))*.*/	{"\1", select_keymap_entry, "\3", keymapon, "\4"},/' -e t -e 's/^[ 	"]*\([^	]*\)		*\([A-Za-z0-9_][^ 	]*\).*\([^ 	][^ 	]\).*/	{"\1", select_keymap_entry, "\3", keymapon},/' -e t -e d keymaps.cfg > keymapsm.t
311
312# from:		Greek	GreekMonotonic	gr	(Y)
313# generate:		{keymap_GreekMonotonic, "gr"},
314keymapsk.t:	keymaps.cfg # mkinclud.mak
315	LC_ALL=C sed $(filterCJK) -e '/^[-#]/ d' -e 's/^[ 	"]*\([^	]*\)		*\([A-Za-z0-9_][^ 	]*\)		*\([^ 	][^ 	]\).*/	{keymap_\2, "\3"},/' -e t -e d keymaps.cfg > keymapsk.t
316
317# from:		Greek	GreekMonotonic	gr	(Y)
318# generate:	#include "GreekMonotonic.h"
319keymapsi.h:	keymaps.cfg # mkinclud.mak
320	LC_ALL=C sed $(filterCJK) -e '/^[-#]/ d' -e 's/^[ 	"]*\([^	]*\)		*\([A-Za-z0-9_][^ 	]*\)		*\([^ 	][^ 	]\).*/#include "\2.h"/' -e t -e d keymaps.cfg > keymapsi.h
321
322# from:		Greek	GreekMonotonic	gr	(Y)
323# generate:	#include "GreekMonotonic.c"
324keymapsc.h:	keymaps.cfg # mkinclud.mak
325	LC_ALL=C sed $(filterCJK) -e '/^[-#]/ d' -e 's/^[ 	"]*\([^	]*\)		*\([A-Za-z0-9_][^ 	]*\)		*\([^ 	][^ 	]\).*/#include "\2.c"/' -e t -e d keymaps.cfg > keymapsc.h
326
327# from:		Greek	GreekMonotonic	gr	(Y)
328# generate:	extern keymaptableelem keymap_GreekMonotonic [];
329keymapsx.h:	keymaps.cfg # mkinclud.mak
330	LC_ALL=C sed $(filterCJK) -e '/^[-#]/ d' -e 's/^[ 	"]*\([^	]*\)		*\([A-Za-z0-9_][^ 	]*\)		*\([^ 	][^ 	]\).*/extern keymaptableelem keymap_\2 [];/' -e t -e d keymaps.cfg > keymapsx.h
331
332# Character mapping configuration:
333
334# check input method tag ("gr", ...) for uniqueness
335checkcharmapstags:	charmaps.cfg mkchrcfg
336	$(SH) ./mkchrcfg checktags
337
338charmaps.t:	charmaps.cfg mkchrcfg
339	$(MAKE) -f mkinclud.mak checkcharmapstags
340	$(SH) ./mkchrcfg charmaps.t
341
342charmaps.h:	charmaps.cfg mkchrcfg
343	$(SH) ./mkchrcfg charmaps.h
344
345charemen.t:	charmaps.cfg mkchrcfg
346	$(SH) ./mkchrcfg charemen.t
347
348charesub.t:	charmaps.cfg mkchrcfg
349	$(SH) ./mkchrcfg charesub.t
350
351# Mapping table locale (substring) -> charmap (encoding name)
352# from:
353#	ar_IN	UTF-8
354#	ar	ISO-8859-6	MacArabic
355# generate:
356#		{"ar", "ISO-8859-6", "MacArabic"},
357#		{"ar_IN", "UTF-8"},
358locales.t:	locales.cfg # mkinclud.mak
359	sed -e '/^$$/ d' -e '/^#/ d' -e 's/\([^ 	][^ 	]*\)[ 	][ 	]*\([^ 	][^ 	]*\)[ 	]*\([^ 	]*\)/	{"\1", "\2", "\3"},/' -e 's/, ""//' locales.cfg | LC_ALL=C sort > locales.t
360
361# Find supplements for locales.cfg:
362localealiases:	/usr/share/locale/locale.alias locales.cfg
363	sed -e "/^#/ d" -e "/8859-1$$/ d" -e "s,\([^ 	]*\)[ 	][ 	]*\([^ 	]*\),\1	\2," -e "s,	[^.]*\.,	," -e "s,	euc,	EUC-," /usr/share/locale/locale.alias | fgrep -a -v -x -f locales.cfg
364
365# HTML character mnemonics:
366zeichen.htm:
367	$(WGET) http://de.selfhtml.org/html/referenz/zeichen.htm
368
369mnemos.com:	mkaccent accents.cfg # UnicodeData.txt
370	CC=$(CC) $(SH) ./mkaccent -
371
372mnemos.ara:	mkaccent accents.cfg # UnicodeData.txt
373	CC=$(CC) $(SH) ./mkaccent Arabic
374
375mnemos.cyr:	mkaccent accents.cfg # UnicodeData.txt
376	CC=$(CC) $(SH) ./mkaccent Cyrillic
377
378mnemos.grk:	mkaccent accents.cfg # UnicodeData.txt
379	CC=$(CC) $(SH) ./mkaccent Greek
380
381mnemos.heb:	mkaccent accents.cfg # UnicodeData.txt
382	CC=$(CC) $(SH) ./mkaccent Hebrew
383
384mnemos.lat:	mkaccent accents.cfg # UnicodeData.txt
385	CC=$(CC) $(SH) ./mkaccent Latin
386
387mnemos.www:	mnemos.tex mkmnhtml # zeichen.htm
388	CC=$(CC) $(SH) ./mkmnhtml zeichen.htm | fgrep -v -x -f mnemos.tex > mnemos.www
389	$(SH) ./mkmnemocheck
390
391mnemos.rof:
392	CC=$(CC) $(SH) ./mkmnemoroff > mnemos.rof
393
394
395#############################################################################
396# generate tables for character encodings and keyboard mappings
397
398# rules for non-GNU make:
399
400# generate makefile to deal with variable list of targets,
401# invoke it to generate and compile character mapping tables:
402mkcharmaps:
403	echo SH=$(SH) > charmaps/makefile
404	CC=$(CC) OPT="$(OPT)" $(SH) ./mkmakchr -O $(OBJDIR) >> charmaps/makefile
405	$(MAKE) -f charmaps/makefile OBJDIR=$(OBJDIR)
406
407# extract list of configured keyboard mappings from keymaps.cfg:
408getKEYMAPS=`$(SH) ./mkkmlist`
409
410# generate makefile to deal with variable list of dependencies,
411# invoke it to generate cumulative keymaps file:
412# (note, this does not work on Ultrix: test -d keymaps || mkdir keymaps)
413mkkeymaps:
414	if [ ! -d keymaps ]; then mkdir keymaps; fi
415	echo SH=$(SH) > keymaps/makefile
416	echo keymaps.t: keymaps.cfg $(getKEYMAPS) mkkmincl >> keymaps/makefile
417	echo "	CC=$(CC) $(SH) ./mkkmincl $(getKEYMAPS) > keymaps.t" >> keymaps/makefile
418	$(MAKE) -f keymaps/makefile
419
420
421# extract configured keyboard mappings from keymaps.cfg
422listkeymaps=LC_ALL=C sed -e '/^[-\#]/ d' -e 's,^[ 	"]*\([^	]*\)		*\([A-Za-z0-9_][^ 	]*\).*\([^ 	][^ 	]\).*,keymaps1/\2,' -e t -e d keymaps.cfg
423
424keymaps1/makefile:	keymaps.cfg
425	echo SH=$(SH) > keymaps1/makefile
426	echo keymapsc:	`$(listkeymaps) | sed -e "s,$$,.c,"` >> keymaps1/makefile
427	echo '' >> keymaps1/makefile
428	echo keymapso:	`$(listkeymaps) | sed -e "s,$$,.o,"` >> keymaps1/makefile
429	echo '' >> keymaps1/makefile
430	echo 'CC=$(CC)' >> keymaps1/makefile
431	echo '' >> keymaps1/makefile
432	echo 'keymaps1/%.o:	keymaps1/%.c' >> keymaps1/makefile
433	echo '	$$(CC) $(OPT) -c $$< -o keymaps1/$$*.o' >> keymaps1/makefile
434	echo '' >> keymaps1/makefile
435	echo 'keymaps1/%.c:	keymaps0/%.h mkkmincl' >> keymaps1/makefile
436	echo '	CC=$$(CC) $(SH) ./mkkmincl $$< > keymaps1/$$*.c' >> keymaps1/makefile
437
438# rules for GNU make:
439
440# KEYMAPS is extracted list of configured keyboard mappings from keymaps.cfg:
441# (note, this does not work on Ultrix: test -d keymaps || mkdir keymaps)
442keymaps.t:	$(KEYMAPS) keymaps.cfg mkkmincl # keymaps1/makefile
443	#$(MAKE) -f keymaps1/makefile keymapsc
444	if [ ! -d keymaps ]; then mkdir keymaps; fi
445	CC=$(CC) $(SH) ./mkkmincl $(KEYMAPS) > keymaps.t
446
447# define generic rule to generate and compile character mapping tables:
448#$(OBJDIR)/charmaps/%.o:	charmaps/%.map charcode.h mkchrtab
449#	CC=$(CC) OPT="$(OPT)" $(SH) ./mkchrtab -O $(OBJDIR) $<
450
451# rather do it in 2 steps to facilitate generation with non-Unix make
452# after manual copying cross-generated .c files:
453# generate character mapping tables:
454charmaps/%.c:	charmaps/%.map charcode.h mkchrtab
455	CC=$(CC) OPT="$(OPT)" $(SH) ./mkchrtab -S $<
456
457# compile character mapping tables:
458$(OBJDIR)/charmaps/%.o:	charmaps/%.c
459	$(CC) $(OPT) -I. -c $< -o $(OBJDIR)/charmaps/$*.o
460
461
462#############################################################################
463# Character input support tables:
464
465MNEMOS=mnemos.???
466#only understood by gmake:
467#MNEMOS=mnemos.??[!~]
468
469mnemos.t:	$(MNEMOS)
470#	cat $(MNEMOS) > mnemos.t
471	ls -1 $(MNEMOS) | sed -e 's,^,#include ",' -e 's,$$,",' > mnemos.t
472
473# Documentation page for mnemonics (listing mined additional mnemos)
474mnemodoc:	$(DOC)/mnemodoc.html
475$(DOC)/mnemodoc.html:	mnemos.sup $(DOC)/mined.html mkmnemodoc
476	CC=$(CC) $(SH) ./mkmnemodoc > $(DOC)/mnemodoc.html.new
477	/bin/mv $(DOC)/mnemodoc.html.new $(DOC)/mnemodoc.html
478	$(SH) ./mkmnemocheck
479
480
481#############################################################################
482# Smart quotes
483
484# Documentation page for quotes styles
485quotesdoc:	$(DOC)/quotesdoc.html
486$(DOC)/quotesdoc.html:	quotes.cfg mkquotesdoc
487	$(SH) ./mkquotesdoc quotes.cfg > $(DOC)/quotesdoc.html
488
489
490#############################################################################
491# Location of online help file:
492
493DHELP=-DRUNDIR=\"$(rundir)\" -DLRUNDIR=\"$(lrundir)\"
494
495# Version/About text:
496#VERSION=`sed -e 's,^[^0-9]*,,' -e 's,[^0-9][^0-9]*,.,g' -e q ../VERSION`
497#ABOUT=\"MinEd $(VERSION) - http://mined.sourceforge.net/\"
498
499
500#############################################################################
501# Source compilation:
502
503$(OBJDIR)/mined1.o:	version.h mined1.c textfile.h encoding.h locales.t quotes.t mined.h io.h termprop.h
504	$(CC) $(CFLAGS) $(PROTOFLAGS) $(DHELP) -c mined1.c -o $(OBJDIR)/mined1.o
505$(OBJDIR)/minedaux.o:	version.h minedaux.c mined.h io.h
506	$(CC) $(CFLAGS) $(PROTOFLAGS) $(DHELP) -c minedaux.c -o $(OBJDIR)/minedaux.o
507$(OBJDIR)/textfile.o:	textfile.c textfile.h mined.h charprop.h termprop.h
508	$(CC) $(CFLAGS) $(PROTOFLAGS) -c textfile.c -o $(OBJDIR)/textfile.o
509$(OBJDIR)/textbuf.o:	textbuf.c mined.h
510	$(CC) $(CFLAGS) $(PROTOFLAGS) -c textbuf.c -o $(OBJDIR)/textbuf.o
511$(OBJDIR)/justify.o:	justify.c mined.h
512	$(CC) $(CFLAGS) $(PROTOFLAGS) -c justify.c -o $(OBJDIR)/justify.o
513$(OBJDIR)/edit.o:	edit.c mined.h io.h charprop.h termprop.h
514	$(CC) $(CFLAGS) $(PROTOFLAGS) -c edit.c -o $(OBJDIR)/edit.o
515$(OBJDIR)/charprop.o:	charprop.c charprop.h casespec.t casetabl.t softdot.t combin.t wide.t charname.t charseqs.t scripts.t scriptdf.t # mined.h
516	$(CC) $(CFLAGS) $(PROTOFLAGS) -c charprop.c -o $(OBJDIR)/charprop.o
517$(OBJDIR)/pastebuf.o:	pastebuf.c mined.h charprop.h io.h
518	$(CC) $(CFLAGS) $(PROTOFLAGS) -c pastebuf.c -o $(OBJDIR)/pastebuf.o
519$(OBJDIR)/legacy.o:	legacy.c
520	$(CC) $(CFLAGS) -c legacy.c -o $(OBJDIR)/legacy.o
521$(OBJDIR)/search.o:	search.c mined.h io.h
522	$(CC) $(CFLAGS) $(PROTOFLAGS) -c search.c -o $(OBJDIR)/search.o
523$(OBJDIR)/mousemen.o:	mousemen.c mined.h io.h charcode.h keymapsm.t charemen.t charesub.t termprop.h
524	$(CC) $(CFLAGS) $(PROTOFLAGS) -c mousemen.c -o $(OBJDIR)/mousemen.o
525$(OBJDIR)/output.o:	output.c colours.t mined.h io.h termprop.h
526	$(CC) $(CFLAGS) $(PROTOFLAGS) -c output.c -o $(OBJDIR)/output.o
527$(OBJDIR)/prompt.o:	prompt.c mined.h io.h termprop.h
528	$(CC) $(CFLAGS) $(PROTOFLAGS) -c prompt.c -o $(OBJDIR)/prompt.o
529$(OBJDIR)/charcode.o:	charcode.c charcode.h charmaps.t charmaps.h typoprop.t termprop.h
530	$(CC) $(CFLAGS) $(PROTOFLAGS) -c charcode.c -o $(OBJDIR)/charcode.o
531$(OBJDIR)/handescr.o:	handescr.c handescr.t # mined.h for type only
532	$(CC) $(CFLAGS) $(PROTOFLAGS) -c handescr.c -o $(OBJDIR)/handescr.o
533$(OBJDIR)/compose.o:	compose.c mined.h mnemos.t io.h
534	$(CC) $(CFLAGS) $(PROTOFLAGS) -c compose.c -o $(OBJDIR)/compose.o
535$(OBJDIR)/keymaps.o:	keymaps.c keymapsk.t $(KEYMAPSDEP)
536	$(CC) $(CFLAGS) $(PROTOFLAGS) -Duse_concatenated_keymaps $(KEYMAPSFLAGS) -c keymaps.c -o $(OBJDIR)/keymaps.o
537#$(OBJDIR)/keymaps.o:	keymaps.c keymapsk.t keymaps1/makefile keymapsc.h
538#	$(MAKE) -f keymaps1/makefile keymapsc
539#	$(CC) $(CFLAGS) $(PROTOFLAGS) -Ikeymaps1 $(KEYMAPSFLAGS) -c keymaps.c -o $(OBJDIR)/keymaps.o
540$(OBJDIR)/keydefs.o:	keydefs.c mined.h io.h
541	$(CC) $(CFLAGS) $(PROTOFLAGS) -c keydefs.c -o $(OBJDIR)/keydefs.o
542$(OBJDIR)/dispatch.o:	dispatch.c mined.h charprop.h io.h
543	$(CC) $(CFLAGS) $(PROTOFLAGS) -c dispatch.c -o $(OBJDIR)/dispatch.o
544$(OBJDIR)/encoding.o:	encoding.c encoding.h
545	$(CC) $(CFLAGS) $(PROTOFLAGS) -c encoding.c -o $(OBJDIR)/encoding.o
546$(OBJDIR)/termprop.o:	termprop.c termprop.h
547	$(CC) $(CFLAGS) $(PROTOFLAGS) -c termprop.c -o $(OBJDIR)/termprop.o
548$(OBJDIR)/width.o:	width.c width.t termprop.h
549	$(CC) $(CFLAGS) $(PROTOFLAGS) -c width.c -o $(OBJDIR)/width.o
550$(OBJDIR)/keyboard.o:	keyboard.c mined.h termprop.h io.h
551	$(CC) $(CFLAGS) $(PROTOFLAGS) -c keyboard.c -o $(OBJDIR)/keyboard.o
552$(OBJDIR)/keycurs.o:	keyboard.c mined.h termprop.h
553	$(CC) $(CFLAGS) -DCURSES $(PROTOFLAGS) -c keyboard.c $(ICURSES) -o $(OBJDIR)/keycurs.o
554$(OBJDIR)/io.o:	io.c io.h mined.h $(MOUSELIB) dosvideo.t termprop.h
555	$(CC) $(CFLAGS) $(PROTOFLAGS) -c io.c -o $(OBJDIR)/io.o
556$(OBJDIR)/ioansi.o:	io.c io.h mined.h $(MOUSELIB) dosvideo.t termprop.h
557	$(CC) $(CFLAGS) $(PROTOFLAGS) -DANSI -c io.c -o $(OBJDIR)/ioansi.o
558$(OBJDIR)/iocurses.o:	io.c io.h mined.h termprop.h
559	$(CC) $(CFLAGS) -DCURSES -DSETLOCALE $(PROTOFLAGS) -c io.c $(ICURSES) -o $(OBJDIR)/iocurses.o
560
561#$(OBJDIR)/timestmp.o:
562#	$(CC) -c timestmp.c -o $(OBJDIR)/timestmp.o
563
564
565#############################################################################
566# Mined generation:
567
568green=echo -e '\033[30;42m' | sed -e 's,-e,,' >&2
569yellow=echo -e '\033[30;43m' | sed -e 's,-e,,' >&2
570
571##if $(SLIB) exists (e.g. -ltermcap):
572##LINKOBJ=$(SCREENOBJ)
573##LINKIO=$(SCREENOBJ) $(SLIB)
574##else:
575##LINKOBJ=$(SCREENOBJANSI)
576##LINKIO=$(SCREENOBJANSI)
577#LINKOBJ=`echo 'int main () {}' > .dumain.c; if $(CC) .dumain.c $(SLIB) -o /dev/null; then $(green); echo "Building with termcap API" >&2; echo $(SCREENOBJ); else $(yellow); echo "Building with ANSI terminal control" >&2; echo $(SCREENOBJANSI); fi`
578#LINKIO=`echo 'int main () {}' > .dumain.c; if $(CC) .dumain.c $(SLIB) -o /dev/null; then $(green); echo "Building with termcap API" >&2; echo $(SCREENOBJ) $(SLIB); else $(yellow); echo "Building with ANSI terminal control" >&2; echo $(SCREENOBJANSI); fi`
579
580$(OBJDIR)/charmaps:
581	mkdir -p $(OBJDIR)/charmaps
582
583$(OBJDIR)/charmaps.a:	$(CHARDEPS)
584	ar ruv $(OBJDIR)/charmaps.a $(CHAROBJS)
585
586#CHARDEPEND=$(CHARDEPS)
587#CHARLIB=$(CHAROBJS)
588CHARDEPEND=$(OBJDIR)/charmaps.a
589CHARLIB=$(OBJDIR)/charmaps.a
590
591#$(OBJDIR)/mined:	$(OBJDIR)/charmaps $(PROGOBJS) $(CHARDEPEND) $(LINKOBJ)
592#	$(CC) -c timestmp.c -o $(OBJDIR)/timestmp.o
593#	$(CC) $(ALLPROGOBJS) $(CHARLIB) $(LINKOPTS) ${LDFLAGS} $(LINKIO) $(EXTRALIBS) -o $(OBJDIR)/mined
594
595mined:	$(OBJDIR)/mined
596
597$(OBJDIR)/mined:	$(OBJDIR)/charmaps $(PROGOBJS) $(CHARDEPEND) $(SCREENOBJ)
598	$(CC) -c timestmp.c -o $(OBJDIR)/timestmp.o
599	$(CC) $(ALLPROGOBJS) $(CHARLIB) $(SCREENOBJ) $(LINKOPTS) ${LDFLAGS} $(SLIB) $(EXTRALIBS) -o $(OBJDIR)/mined
600
601mansi:	$(OBJDIR)/mansi
602
603$(OBJDIR)/mansi:	$(OBJDIR)/charmaps $(PROGOBJS) $(CHARDEPEND) $(SCREENOBJANSI)
604	$(CC) -c timestmp.c -o $(OBJDIR)/timestmp.o
605	$(CC) $(ALLPROGOBJS) $(CHARLIB) $(SCREENOBJANSI) $(LINKOPTS) ${LDFLAGS} $(EXTRALIBS) -o $(OBJDIR)/mansi
606
607minced:	$(OBJDIR)/minced
608
609$(OBJDIR)/minced:	$(OBJDIR)/charmaps $(PROGOBJS) $(CHARDEPEND) $(SCREENOBJCURS)
610	$(CC) -c timestmp.c -o $(OBJDIR)/timestmp.o
611	$(CC) $(ALLPROGOBJS) $(CHARLIB) $(SCREENOBJCURS) $(LINKOPTS) ${LDFLAGS} -lncursesw $(LDL) $(EXTRALIBS) -o $(OBJDIR)/minced
612	$(yellow); echo "Made a curses version, but it is deprecated" >&2
613	false
614
615
616#############################################################################
617# additional files, installation, cleanup
618
619# Online help:
620help:	../usrshare/help/mined.hlp
621
622../usrshare/help/mined.hlp:	help/* mkhelp
623	$(SH) ./mkhelp > ../usrshare/help/mined.hlp
624
625# Manual page:
626man:	../man/mined.1 ../man/uterm.1
627
628../man/%.1:	$(DOC)/%.html
629	cd `/bin/pwd`/../man && $(MAKE)
630
631
632# Install aliases; may be suppressed with make ...install makelinks=
633makelinks=$(MAKE) -f mkinclud.mak links EXE=$(EXE)
634
635links:	$(linkdir)/xmined $(linkdir)/minmacs$(EXE) $(linkdir)/mpico$(EXE) $(linkdir)/mstar$(EXE)
636
637$(linkdir)/xmined:
638	cd $(linkdir) && ln -s umined xmined || ln umined xmined
639
640$(linkdir)/%:
641	cd $(linkdir) && ln -s mined$(EXE) $* || ln mined$(EXE) $*
642
643
644# Install uterm and umined scripts;
645# may be suppressed with make ...install installscript=echo
646installscript=$(INSTALLBIN)
647#installscript=echo not installing
648
649# Install desktop context menu entry
650# may be suppressed with make ...install installdesktop=echo
651installdesktop=$(INSTALL)
652desktop=../usrshare/setup_install/mined.desktop
653icon=../usrshare/setup_install/mined.xpm
654rootmenudir=$(DESTDIR)$(root)/usr/share/applications
655rooticondir=$(DESTDIR)$(root)/usr/share/pixmaps
656localmenudir=$(DESTDIR)$(root)/usr/local/share/applications
657localicondir=$(DESTDIR)$(root)/usr/local/share/pixmaps
658usermenudir=${HOME}/.local/share/applications
659usericondir=${HOME}/.local/share/pixmaps
660rootmenu=mkdir $(rootmenudir) && $(installdesktop) $(desktop) $(rootmenudir)
661rooticon=mkdir $(rooticondir) && $(installdesktop) $(icon) $(rooticondir)
662# enforce local or user desktop integration with mkdir -p
663localmenu=mkdir -p $(localmenudir) && $(installdesktop) $(desktop) $(localmenudir)
664localicon=mkdir -p $(localicondir) && $(installdesktop) $(icon) $(localicondir)
665usermenu=mkdir -p $(usermenudir) && $(installdesktop) $(desktop) $(usermenudir)
666usericon=mkdir -p $(usericondir) && $(installdesktop) $(icon) $(usericondir)
667
668
669# Installation:
670# or installation to system-specific dir with make install root=...
671install:	mined help man
672	# ==== install binary and scripts
673	#don't strip -p $(OBJDIR)/mined$(EXE) || true
674	mkdir -p $(DESTDIR)$(bindir)
675	$(INSTALLBIN) $(OBJDIR)/mined$(EXE) $(DESTDIR)$(bindir)
676	$(installscript) ../usrshare/bin/uterm $(DESTDIR)$(bindir)
677	$(installscript) ../usrshare/bin/umined $(DESTDIR)$(bindir)
678	$(makelinks) linkdir=$(DESTDIR)$(bindir)
679	# ==== install runtime support library
680	mkdir -p $(DESTDIR)$(rundir)
681	/bin/cp -pr ../usrshare/* $(DESTDIR)$(rundir)
682	rm -fr $(DESTDIR)$(rundir)/doc_user/fonts
683	# ==== install manual page
684	mkdir -p $(DESTDIR)$(mandir)/man1
685	$(INSTALL) ../man/*.1 $(DESTDIR)$(mandir)/man1
686	# zip man if mans are zipped in actual mandir (not DESTDIR)
687	#if (ls $(mandir)/man1/*.gz && type gzip) > /dev/null 2>&1; then gzip -f $(DESTDIR)$(mandir)/man1/mined.1; fi
688	# ==== install desktop context menu item ("Open With")
689	( $(rootmenu) && $(rooticon) ) || ( $(usermenu) && $(usericon) ) || echo Could not install desktop menu entry
690	# ==== install system-specific stuff (e.g. wined, README.cygwin)
691	$(extrainstall)
692
693# Local installation:
694# or installation to system-specific local dir with make localinstall root=...
695localinstall:	mined help man
696	# ==== install binary and scripts
697	#don't strip -p $(OBJDIR)/mined$(EXE) || true
698	mkdir -p $(DESTDIR)$(lbindir)
699	$(INSTALLBIN) $(OBJDIR)/mined$(EXE) $(DESTDIR)$(lbindir)
700	$(installscript) ../usrshare/bin/uterm $(DESTDIR)$(lbindir)
701	$(installscript) ../usrshare/bin/umined $(DESTDIR)$(lbindir)
702	$(makelinks) linkdir=$(DESTDIR)$(lbindir)
703	# ==== install runtime support library
704	mkdir -p $(DESTDIR)$(lrundir)
705	/bin/cp -pr ../usrshare/* $(DESTDIR)$(lrundir)
706	rm -fr $(DESTDIR)$(lrundir)/doc_user/fonts
707	# ==== install manual page
708	mkdir -p $(DESTDIR)$(lmandir)/man1
709	$(BSD_INSTALL_MAN) ../man/*.1 $(DESTDIR)$(lmandir)/man1
710	# zip man if mans are zipped in actual mandir (not DESTDIR)
711	#if (ls $(lmandir)/man1/*.gz && type gzip) > /dev/null 2>&1; then gzip -f $(DESTDIR)$(lmandir)/man1/mined.1; fi
712	# ==== install desktop context menu item ("Open With")
713	( $(localmenu) && $(localicon) ) || ( $(usermenu) && $(usericon) ) || echo Could not install desktop menu entry
714	# ==== install system-specific stuff (e.g. wined, README.cygwin)
715	$(extrainstall)
716
717# /opt installation:
718# or installation to system-specific opt subdir with make optinstall root=...
719optinstall:	mined help man
720	# ==== install binary and scripts
721	#don't strip -p $(OBJDIR)/mined$(EXE) || true
722	mkdir -p $(DESTDIR)$(root)/opt/mined/bin
723	$(INSTALLBIN) $(OBJDIR)/mined$(EXE) $(DESTDIR)$(root)/opt/mined/bin
724	$(installscript) ../usrshare/bin/uterm $(DESTDIR)$(root)/opt/mined/bin
725	$(installscript) ../usrshare/bin/umined $(DESTDIR)$(root)/opt/mined/bin
726	$(makelinks) linkdir=$(DESTDIR)$(root)/opt/mined/bin
727	# ==== install runtime support library
728	mkdir -p $(DESTDIR)$(root)/opt/mined/share
729	/bin/cp -pr ../usrshare/* $(DESTDIR)$(root)/opt/mined/share
730	rm -fr $(DESTDIR)$(root)/opt/mined/share/doc_user/fonts
731	# ==== install manual page
732	mkdir -p $(DESTDIR)$(root)/opt/mined/man/man1
733	$(INSTALL) ../man/*.1 $(DESTDIR)$(root)/opt/mined/man/man1
734	# ==== install desktop context menu item ("Open With")
735	( $(rootmenu) && $(rooticon) ) || ( $(usermenu) && $(usericon) ) || echo Could not install desktop menu entry
736	# ==== install system-specific stuff (e.g. wined, README.cygwin)
737	$(extrainstall)
738
739
740# Cleanup after compilation:
741clear:
742	rm -f $(OBJDIR)/*.o $(OBJDIR)/charmaps/*.o colours.t keymaps?.t keymaps.t core
743	rm -f charmaps/makefile keymaps/makefile
744	rmdir keymaps || true
745
746debianclean:
747	rm -f mined semantic.cache ../debian/semantic.cache
748
749clean:	clear debianclean
750
751
752# Include file to configure binary target directory:
753m-objdir.inc:
754	echo OBJDIR=../bin/$(SYS).$(ARCH) > m-objdir.inc
755
756
757#############################################################################
758# pre-generation of tables
759
760generate:	# keymaps1/Radical_Stroke.h
761
762keymaps1/Radical_Stroke.h:	keymaps0/Radical_Stroke.h
763	CC=$(CC) $(SH) ./mkkmincl keymaps0/Radical_Stroke.h > keymaps1/Radical_Stroke.h
764
765#keymaps0/Radical_Stroke.h:	keymaps/Radical_Stroke.h
766#	cp keymaps/Radical_Stroke.h keymaps0/Radical_Stroke.h
767
768# Cross-generation of charmaps files for MSDOS/VMS compilation
769NONCJKCHARMAPS=$(shell echo charmaps/*.map | sed -e "s, charmaps/cjk-[^ ]*.map,,g" )
770#PCCHARTABS=$(shell echo $(NONCJKCHARMAPS) | sed -e "s,\.map,.c,g" )
771
772# DOSBox make complains about the following rule ("multiple target patterns")
773# so keep it away from makefile.dj
774#pc:	$(PCCHARTABS)
775
776#pc:
777#	CC=$(CC) $(SH) ./mkchrtab -S $(NONCJKCHARMAPS)
778
779allchartabs:	$(CHARTABS)
780
781
782#############################################################################
783# development targets
784
785# Tags file:
786tags:	*.c *.h
787	ctags -w *.c *.h
788	cat tags | grep -a -v 'v.......\.c' > tags1
789	/bin/mv tags1 tags
790
791# generated doc files (targets also included in main release target):
792doc:	mnemodoc quotesdoc
793
794# Source archives:
795zipvms:	mined-src.zip
796	zip -d mined-src handescr.t charname.t charseqs.t charmaps/cjk*
797
798zip:	mined-src.zip
799
800mined-src.zip:
801	zip mined-src *.h *.c *.t charmaps/*.map charmaps/*.c keymaps?/*.h mnemos.??[!~] makefile.* mki* vms-* -x *~
802
803update:
804	cd ../man && $(MAKE)
805	zip -y mined-src-update *.h *.c makefile.* mk* doc/changes.html doc/mined.html man/*.1 -x handescr.t
806
807# Check function valid_cjk:
808$(OBJDIR)/validcjk:	validcjk.c charcode.c $(OBJDIR)/termprop.o $(OBJDIR)/width.o $(OBJDIR)/charmaps/*.o
809	$(CC) $(CFLAGS) -o $(OBJDIR)/validcjk validcjk.c $(OBJDIR)/termprop.o $(OBJDIR)/width.o $(OBJDIR)/charmaps/*.o
810
811$(OBJDIR)/verichar:	verichar.c charprop.c $(OBJDIR)/charcode.o $(OBJDIR)/termprop.o $(OBJDIR)/width.o
812	$(CC) $(CFLAGS) -o $(OBJDIR)/verichar verichar.c $(OBJDIR)/charcode.o $(OBJDIR)/termprop.o $(OBJDIR)/width.o $(OBJDIR)/handescr.o $(OBJDIR)/charmaps/*.o
813
814# VMS build scripts:
815vms.com:
816	# vms-make.com
817	sed -e "1,/BEGIN sources/ p" -e d vms-make.com > vms-make.new
818	echo $(SCREENOBJ) $(ALLPROGOBJS) | tr ' ' '\012' | sed -e "s,.*/,," -e "s,\.o,," -e "s,^,$$ call make ," >> vms-make.new
819	sed -e "/END sources/,$$ p" -e d vms-make.com >> vms-make.new
820	cmp vms-make.com vms-make.new || mv -f vms-make.new vms-make.com
821	rm -f vms-make.new
822	# vms-complib.com
823	echo "$$ arch := 'f\$$getsyi(\"arch_name\")'" > vms-complib.new
824	echo "$$ compile := cc/decc/nolist/include_dir=[]" >> vms-complib.new
825	echo "$$" >> vms-complib.new
826	echo "$$ if arch .eqs. \"VAX\" then goto skipCJK" >> vms-complib.new
827	echo charmaps/cjk-*.map | tr ' ' '\012' | sed -e "s,.*/\(.*\)\.map,$$ compile /obj=[.charmaps] [.charmaps]\1," >> vms-complib.new
828	echo "$$" >> vms-complib.new
829	echo "$$ skipCJK:" >> vms-complib.new
830	echo $(NONCJKCHARMAPS) | tr ' ' '\012' | sed -e "s,.*/\(.*\)\.map,$$ compile /obj=[.charmaps] [.charmaps]\1," >> vms-complib.new
831	echo "$$" >> vms-complib.new
832	echo "$$ cre/dir [.'arch']" >> vms-complib.new
833	echo "$$ libr/create [.'arch']charmaps [.charmaps]*.obj" >> vms-complib.new
834	cmp vms-complib.com vms-complib.new || mv -f vms-complib.new vms-complib.com
835	rm -f vms-complib.new
836	# vms-link.opt
837	echo $(SCREENOBJ) $(ALLPROGOBJS) | tr ' ' '\012' | sed -e "s,.*/,," -e "s,\.o,," > vms-link.new
838	cmp vms-link.opt vms-link.new || mv -f vms-link.new vms-link.opt
839	rm -f vms-link.new
840
841# Check correctness, consistency, uniqueness...
842checkchar:	$(OBJDIR)/validcjk
843	$(OBJDIR)/validcjk
844	$(SH) ./mkmnemocheck
845	if grep -e 'WITH.*"' mnemos.??[!~]; then false; fi
846
847checksrc:
848	# source code checks:
849	if egrep -a -e "} *if" *.c; then false; fi
850	# check for remains of debug stuff:
851	if egrep -a -e "^(printf|#define debug)" *.[hc]; then false; fi
852	# check for debug statements at line beginning:
853	#if sed -e "/^{/,/^}/ b" -e d *.c | grep -a "^[0-9a-zA-Z].*;"; then false; fi
854	if sed -e "/^{/,/^}/ b" -e d *.c | grep -a "^[^ 	/].*;"; then false; fi
855	# check for remaining test entries:
856	if sed -e "/-- test/,$$ b" -e d keymaps.cfg | egrep -a '^[^#]'; then false; else true; fi
857
858checklint:
859	if splint *.c 2> /dev/null | grep -a Fall; then false; fi
860
861checkhelp:
862	if egrep -a -e "&" help/*; then false; fi
863
864checkall:	checksrc checklint checkchar checkhelp
865
866check:	checksrc
867
868# Check makefile function
869ldl:
870	echo $(ldl_libs)
871	echo $(LDL)
872
873arch:
874	echo `uname`.$(ARCH)
875
876y=echo -e '\033[30;43m'
877n=echo ""
878
879checkdirs:
880	$(y); echo install:; echo $(prefix); echo $(bindir); echo $(mandir); echo $(rundir); $(n)
881	$(y); echo localinstall:; echo $(lprefix); echo $(lbindir); echo $(lmandir); echo $(lrundir); $(n)
882
883checkmaps:
884	echo MAKEMAPS:	$(MAKEMAPS)
885	echo CHARMAPS:	$(CHARMAPS)
886	echo OBJDIR:	$(OBJDIR)
887	echo CHARDEPS:	$(CHARDEPS)
888	echo SCREENOBJ:	$(SCREENOBJ)
889	echo CHAROBJS:	$(CHAROBJS) $(SCREENOBJ)
890
891
892#############################################################################
893# end
894