STCM1 = /u/ksos/ksos11/src/unix/stc/work/stc.m1

FILES = K32stuff.def UDMdefs.def bio.mod c32Arith.mod chario.mod conv.mod\
convio.mod extio.mod misc.mod stc.mod string.mod unixcalls.mod

BYHAND = bio.mod chario.mod conv.mod convio.mod extio.mod misc.mod stc.mod\
string.mod

all: $(FILES)

stc.mod: stc.head
misc.mod: misc.head
chario.mod: chario.head
string.mod: string.head
conv.mod: conv.head
convio.mod: convio.head
bio.mod: bio.head
extio.mod: extio.head
$(FILES): stc.m2 split-stc.el
	OLDVERSIONS $(BYHAND)
	emacs -batch stc.m2 -l split-stc -f split-stc -kill
	UPDATE $(BYHAND)
	CHANGES

stc.m2: stc.Out fix-stc.el
	-mv stc.Out~ stc.Out~~
	emacs -batch stc.Out -l fix-stc -f fix-stc -f basic-save-buffer -kill
	-mv $@ $@~
	mv stc.Out $@
	mv stc.Out~ stc.Out
	-mv stc.Out~~ stc.Out~

stc.Out: $(STCM1) stc_idents
	-mv $@ $@~
	m2m2 -i stc_idents $(STCM1) > $@

m2:
	NEWVERSIONS $(BYHAND)
	make -k -f m2Makefile symbols objects

m2makefile: $(FILES)
	mkdir .Tmp
	ls *.def *.mod | sed -e '/32/d' -e '/unix/d' -e '/UDM/d' -e '/conv\./d' -e 's=.*=mpp & > .Tmp/&=' | sh
	ls -f .Tmp | sed '/^\.*$$/d' > .TmpDir
	ls .Tmp | diff - .TmpDir
	cd .Tmp ; ln -s ../m2path ; m2make -E
	-mv $@ $@~
	mv .Tmp/makefile $@
	rm -r .Tmp .TmpDir

symbol-index:
	NEWVERSIONS $(BYHAND)
	new_symbol_index
	diff $@~ $@
