all: # parser.c takeon.c update_astcode.c imp80.c check-missing.c regexp-lexer.c regexp-lexer.h
	grep ^//\\\\ imp80.c > parser-imp80.g
	ecce parser-imp80.g --command "(v.//\\\\ .s..m,m)0m-0(r0 (v-/ /e-)0 m)0 m-0 (rm,k)0 m-0 (r0v-/;/b,m)0 m-0 (v/B/\m,mr\j,m)0 m0 (m-v/B/\)0 mb;%c" > /dev/null 2>&1
	cc -g -o takeon takeon.c
	./takeon parser-imp80.g > parser-imp80.h
	cc -g -o update_astcode-imp80 -DINCLUDE="\"parser-imp80.h\"" -Wno-format-extra-args update_astcode.c
	./update_astcode-imp80 > imp80-new.c
	mv imp80-new.c imp80.c
	grep ^//\\\\ imp80.c > parser-imp80.g
	ecce parser-imp80.g --command "(v.//\\\\ .s..m,m)0m-0(r0 (v-/ /e-)0 m)0 m-0 (rm,k)0 m-0 (r0v-/;/b,m)0 m-0 (v/B/\m,mr\j,m)0 m0 (m-v/B/\)0 mb;%c" > /dev/null 2>&1
	cc -g -o takeon takeon.c
	./takeon parser-imp80.g > parser-imp80.h
	cc -g -o check-missing-imp80 -DTABLE="\"parser-imp80.h\"" check-missing.c
	cc -O -DLEX_H="\"line_reconstruction-imp80.h\"" -DLEX_C="\"line_reconstruction-imp80.c\"" -DTABLE="\"parser-imp80.h\"" -DINCLUDE="\"imp80.c\"" -DCOMPILE="\"compile-imp80.c\"" -Wno-div-by-zero -o parser-imp80-opt parser.c
	cc -g -o generate-compiler-imp80 -DTABLE="\"parser-imp80.h\"" generate-compiler.c
	./generate-compiler-imp80 > compile-imp80.c
	cc -g -DLEX_H="\"line_reconstruction-imp80.h\"" -DLEX_C="\"line_reconstruction-imp80.c\"" -DTABLE="\"parser-imp80.h\"" -DCHECK_INDEXES=1 -DINCLUDE="\"imp80.c\"" -DCOMPILE="\"compile-imp80.c\"" -Wno-div-by-zero -o parser-imp80 parser.c
	ctohtml compile-imp80.c > compile-imp80.c.html
	ctohtml imp80.c > imp80.c.html
	ctohtml compile-imp80.c > compile-imp80.c.html
	ctohtml line_reconstruction-imp80.c > line_reconstruction-imp80.c.html
	ctohtml parser.c > parser.c.html
	ctohtml regexp-lexer.c > regexp-lexer.c.html
        
clean:
	rm -f *~ parser-imp80 parser-imp80-opt takeon check-missing-imp80 update_astcode-imp80 generate-compiler-imp80 *.[ch].html

upload: all
	scp README.txt README-TO-DO.txt Makefile Makefile-imp80 parser-imp80.g parser-imp80.h parser.c \
	    line_reconstruction-imp80.h line_reconstruction-imp80.c takeon.c update_astcode.c \
	    imp80.c imp80.c.html parser.c.html line_reconstruction-imp80.c.html check-missing.c \
	    generate-compiler.c compile-imp80.c compile-imp80.c.html \
            regexp-lexer.c regexp-lexer.h regexp-lexer.c.html \
	    gtoal@gtoal.com:gtoal.com/SBTPROJECT/6809sbt/experimental/generic-parser/
	scp RCS/*,v gtoal@gtoal.com:gtoal.com/SBTPROJECT/6809sbt/experimental/generic-parser/RCS/backup/
