#--------------------------------------------------------------------------
# Prolog VHDL-87 Parser written by Peter Reintjes
# Copyright 1990 by the Microelectronics Center of North Carolina
#
# Updated  to IEEE-1076-1993 Standard and ported to SWI-Prolog(Version 2.8.1)
# by Krishnaprasad Thirunarayan, Wright State University, Dayton, OH 45435.
#---------------------------------------------------------------------------

.SUFFIXES: .tex .pl .dvi .ps

.tex.dvi :
	tex $<

.dvi.ps :
	dvips $< -o

.tex.pl :
	./texcode <$< >$@

#PROLOG        =  prolog  -f none
PROLOG        =  pl -f none
VHDL_SOURCES  =  reserved.pl vhdl93_tokens.pl vhdl93.pl vhdl93_write.pl
DATA          =  data/tp_1.vhdl data/tp_2.vhdl data/tp_3.vhdl \
                 data/tp_4.vhdl data/tp_5.vhdl data/tp_6.vhdl data/tp_7.vhdl
DATA93        =  test_data/tkp_0.vhdl \
                 test_data/tkp_1.vhdl test_data/tkp_2.vhdl \
                 test_data/tkp_3.vhdl test_data/tkp_4.vhdl \
                 test_data/tlex.vhdl

install : test

test : vhdl93_parser $(DATA) $(DATA93)
	echo "timing, test93, halt." | vhdl93_parser

tutorial : tutorial.tex  texcode
	./texcode < tutorial.tex > queries.pl

vhdl93_parser : texcode $(VHDL_SOURCES)
	$(PROLOG) -o vhdl93_parser -c $(VHDL_SOURCES)

texcode	: texcode.l
	lex texcode.l
	gcc -o texcode lex.yy.c -ll -ldl
#	flex texcode.l
#	gcc -o texcode lex.yy.c -ll -ldl -lfl
#	cc -o texcode lex.yy.c -ll         # SPARC-2
#	cc -o texcode lex.yy.c -ll -ldl    # SPARC-20
	/bin/rm lex.yy.c

clean : 
	/bin/rm -rf  *.toc *.tot *.aux *.log *.dvi *.o \
    *.ps vhdl*.pl reserved.pl texcode pretty.vhdl

clean_all : 
	/bin/rm -rf  *.toc *.tot *.aux *.log *.dvi *.o \
    *.ps vhdl*.pl reserved.pl texcode  pretty.vhdl vhdl93_parser

print: psdep vhdl93.ps tutorial.ps 
	lpr vhdl93.ps tutorial.ps

psdep: vhdl93.dvi tutorial.dvi



