# $Header: Makefile,v 3.0 88/04/14 09:37:09 jos Exp $
#
#  This file is part of the Amsterdam SGML Parser.
#
#  Copyright: Faculteit Wiskunde en Informatica
#             Department of Mathematics and Computer Science
#             Vrije Universiteit Amsterdam
#             The Netherlands
#
#  Authors:   Sylvia van Egmond
#             Jos Warmer
#
#
#  Makefile for Amsterdam SGML Parser
# 
#
LLGEN   = $(ASPDIR)/LLgen/LLgen
#flags for C++ compiler
CCFLAGS= -Dcplus -Fc
#flags for C compiler
CFLAGS = -Dcc -g  -I. -I.. -temp=/usr/tmp
GCFLAGS = -Dcc -I. -I.. -temp=/usr/tmp
LLOPT  = -v
HDOC   = ../elem_stk.h entity.i map.ext map.i
HGEN   = ../node.h
HFILES = ../mode_stk.h ../types.h
ODOC   = att_par.o elem_stk.o doc_pars.o incl.o myerror.o out.o\
	 rep_pars.o replace.o startend.o taglist.o tags.o
CDOC   = att_par.c elem_stk.c doc_pars.c incl.c myerror.c out.c\
	 rep_pars.c replace.c startend.c taglist.c tags.c
OGEN   = ambigu.o att_gen.o capacity.o context.o element.o empty.o\
	 gen_code.o gen_incl.o gen_tagl.o gen_tags.o generate.o node.o\
	 notation.o omitstrt.o sgmlproc.o
CGEN   = ambigu.c att_gen.c capacity.c context.c element.c empty.c\
	 gen_code.c gen_incl.c gen_tagl.c gen_tags.c generate.c node.c\
	 notation.c omitstrt.c sgmlproc.c
OFILES = att_chk.o charclas.o conc_syn.o entity.o file_in.o\
	 group.o in.o keywords.o Lpars.o lexical.o modes.o mode_stk.o\
	 report.o set.o shortref.o str_in.o symtable.o token_in.o\
	 tools.o
CFILES = att_chk.c charclas.c conc_syn.c entity.c file_in.c\
	 group.c in.c keywords.c Lpars.c lexical.c modes.c mode_stk.c\
	 report.c set.c shortref.c str_in.c symtable.c token_in.c\
	 tools.c
GDOC   = ../document*.g ../first.g ../rules.g
GCDOC  = document*.c rules.c
GODOC  = document*.o rules.o
GGEN   = ../attrib.g ../dtd.g ../elem.g ../sgml.g
GCGEN  = attrib.c dtd.c elem.c sgml.c
GOGEN  = attrib.o dtd.o elem.o sgml.o
GFILES = ../tokens.g ../comment.g ../doc.g ../ent.g ../extern.g\
	 ../marked.g ../shortnot.g
GCFILES= comment.c doc.c ent.c extern.c marked.c shortnot.c
GOFILES= comment.o doc.o ent.o extern.o marked.o shortnot.o

cplusgen:
	  c++ -IGEN -I. -DGENERATOR $(CGEN) $(CFILES) $(GCGEN) $(GCFILES)
cplusdoc:
	  c++ -IDOC -I. -DDOC_PARSER $(CDOC) $(CFILES) $(GCDOC) $(GCFILES)

generator:
	cd `pwd`/GEN;\
	make -f ../Makefile "CDEPT=dummy_gen" "CFLAGS=$(CFLAGS) -DGENERATOR" \
	"GCFLAGS=$(GCFLAGS) -DGENERATOR" dummy1

dummy1		: $(HFILES) $(HGEN) $(OFILES) $(GOFILES) $(OGEN) $(GOGEN)
		cc -g -o generator $(OFILES) $(GOFILES) $(OGEN) $(GOGEN)

doc_parser:
	cd `pwd`/DOC;\
	make -f ../Makefile "CDEPT=dummy_doc" "CFLAGS=$(CFLAGS) -DDOC_PARSER" \
	"GCFLAGS=$(GCFLAGS) -DDOC_PARSER" dummy2

dummy2		: $(HFILES) $(HDOC) $(OFILES) $(GOFILES) $(ODOC) $(GODOC)
		  cc -g -o doc_parser $(OFILES) $(GOFILES) $(ODOC) $(GODOC)

Lpars.h Lpars.c $(GCFILES) : $(CDEPT)

$(GCGEN) : dummy_gen
dummy_gen	: $(GFILES) $(GGEN)
		  $(LLGEN) $(LLOPT) $(GFILES) $(GGEN)
		  touch dummy_gen

$(GCDOC) : dummy_doc
dummy_doc	: $(GFILES) $(GDOC)
		  $(LLGEN) $(LLOPT) $(GFILES) $(GDOC)
		  touch dummy_doc

# cplus           : $(CFILES) $(CDOC) $(CGEN) 
# CC $(CCFLAGS) $(CFILES) $(CDOC) $(CGEN) >/dev/null

../elem_stk.h:	../stack.gh
	if test -w ../elem_stk.h;\
	then\
	  touch ../elem_stk.h;\
	else\
	  chmod u+w ../elem_stk.h; touch ../elem_stk.h; chmod u-w ../elem_stk.h;\
	fi
entity.i: dummy_doc
	if test -w ../entity.c;\
	then\
	  touch ../entity.c;\
	else\
	  chmod u+w ../entity.c; touch ../entity.c; chmod u-w ../entity.c;\
	fi
map.ext: dummy_doc
	if test -w ../shortref.c;\
	then\
	  touch ../shortref.c;\
	else\
	  chmod u+w ../shortref.c; touch ../shortref.c; chmod u-w ../shortref.c;\
	fi
map.i: dummy_doc
	if test -w ../shortref.c;\
	then\
	  touch ../shortref.c;\
	else\
	  chmod u+w ../shortref.c; touch ../shortref.c; chmod u-w ../shortref.c;\
	fi
../mode_stk.h:	../stack.gh
	if test -w ../mode_stk.h;\
	then\
	  touch ../mode_stk.h;\
	else\
	  chmod u+w ../mode_stk.h; touch ../mode_stk.h; chmod u-w ../mode_stk.h;\
	fi
../node.h:	../group.h ../set.h
	if test -w ../node.h;\
	then\
	  touch ../node.h;\
	else\
	  chmod u+w ../node.h; touch ../node.h; chmod u-w ../node.h;\
	fi
../types.h:	../assert.h ../report.h ../tools.h
	if test -w ../types.h;\
	then\
	  touch ../types.h;\
	else\
	  chmod u+w ../types.h; touch ../types.h; chmod u-w ../types.h;\
	fi

Lpars.o:        Lpars.h
ambigu.o:	../ambigu.h ../element.h ../keywords.h ../node.h\
		../types.h\
		../ambigu.c
	cc -c $(CFLAGS) ../ambigu.c
att_chk.o:      ../att_chk.h ../charclas.h ../conc_syn.h ../entity.h\
		../types.h\
		../att_chk.c
	cc -c $(CFLAGS) ../att_chk.c
att_gen.o:      ../att_chk.h ../att_gen.h ../element.h\
		../keywords.h ../node.h ../notation.h ../types.h\
		../att_gen.c
	cc -c $(CFLAGS) ../att_gen.c
att_par.o:      ../att_par.h att_par.i ../types.h\
		../att_par.c
	cc -c $(CFLAGS) ../att_par.c
attrib.o:       Lpars.h ../att_chk.c ../att_gen.h ../element.h\
		../group.h ../lexical.h ../modes.h ../types.h
	cc -c $(GCFLAGS) attrib.c
capacity.o:	../att_gen.h ../capacity.h ../element.h ../node.h\
		../types.h\
		../capacity.c
	cc -c $(CFLAGS) ../capacity.c
charclas.o:     ../charclas.h ../lexical.h ../types.h\
		../charclas.c
	cc -c $(CFLAGS) ../charclas.c
comment.o:      Lpars.h ../lexical.h ../modes.h ../types.h
	cc -c $(GCFLAGS) comment.c
conc_syn.o:     Lpars.h ../charclas.h ../conc_syn.h ../lexical.h\
		../modes.h ../set.h ../shortref.h ../tags.h ../types.h\
		../conc_syn.c
	cc -c $(CFLAGS) ../conc_syn.c
context.o:      ../context.h ../node.h ../types.h\
		../context.c
	cc -c $(CFLAGS) ../context.c
doc.o:          Lpars.h  ../entity.h ../group.h ../keywords.h\
		../lexical.h ../modes.h ../shortref.h ../types.h
	cc -c $(GCFLAGS) doc.c
doc_pars.o:     Lpars.h ../conc_syn.h ../elem_stk.h ../entity.h ../in.h\
		../lexical.h ../myerror.h ../shortref.h ../types.h\
		../doc_pars.c
	cc -c $(CFLAGS) ../doc_pars.c
document1.o:    Lpars.h ../modes.h  ../startend.h ../types.h
	cc -c $(GCFLAGS) document*.c
dtd.o:          Lpars.h ../element.h ../entity.h \
		../in.h ../lexical.h ../modes.h ../node.h ../notation.h\
		../types.h
	cc -c $(GCFLAGS) dtd.c
elem.o:         Lpars.h ../element.h ../lexical.h ../modes.h\
		../node.h ../types.h
	cc -c $(GCFLAGS) elem.c
elem_stk.o:	../elem_stk.h  ../stack.gen ../types.h\
		../elem_stk.c
	cc -c $(CFLAGS) ../elem_stk.c
element.o:      ../element.h ../hash.gen ../node.h ../types.h\
		../element.c
	cc -c $(CFLAGS) ../element.c
empty.o:        ../context.h ../element.h ../empty.h ../node.h\
		../types.h\
		../empty.c
	cc -c $(CFLAGS) ../empty.c
ent.o:          Lpars.h ../entity.h ../lexical.h ../modes.h ../types.h
	cc -c $(GCFLAGS) ent.c
entity.o:       Lpars.h ../conc_syn.h ../element.h ../entity.h\
		../hash_ent.i ../in.h ../notation.h ../types.h\
		../entity.c
	cc -c $(CFLAGS) ../entity.c
extern.o:	Lpars.h ../entity.h ../lexical.h ../modes.h ../types.h
	cc -c $(GCFLAGS) extern.c
file_in.o:      ../file_in.h ../types.h\
		../file_in.c
	cc -c $(CFLAGS) ../file_in.c
first.o:	Lpars.h
gen_code.o:     ../att_gen.h ../context.h ../element.h ../gen_code.h\
		../gen_incl.h ../node.h ../omitstrt.h ../types.h\
		../gen_code.c
	cc -c $(CFLAGS) ../gen_code.c
gen_incl.o:	../element.h ../gen_incl.h ../group.h  ../stack.gh\
		../stack.gen ../types.h\
		../gen_incl.c
	cc -c $(CFLAGS) ../gen_incl.c
gen_tagl.o:     ../element.h ../gen_tagl.h ../node.h ../types.h\
		../gen_tagl.c
	cc -c $(CFLAGS) ../gen_tagl.c
gen_tags.o:     ../att_gen.h ../element.h ../gen_tags.h ../group.h\
		../shortref.h ../types.h\
		../gen_tags.c
	cc -c $(CFLAGS) ../gen_tags.c
generate.o:     Lpars.h ../ambigu.h ../att_gen.h ../capacity.h\
		../conc_syn.h ../element.h ../empty.h\
		../entity.h ../gen_code.h ../gen_tagl.h ../gen_tags.h\
		../in.h ../lexical.h ../node.h ../notation.h\
		../shortref.h ../types.h\
		../generate.c
	cc -c $(CFLAGS) ../generate.c
group.o:        ../group.h  ../types.h\
		../group.c
	cc -c $(CFLAGS) ../group.c
in.o:           ../entity.h ../file_in.h ../group.h ../in.h\
		../str_in.h ../token_in.h ../types.h\
		../in.c
	cc -c $(CFLAGS) ../in.c
incl.o:		Lpars.h ../incl.h incl.i ../types.h\
		../incl.c
	cc -c $(CFLAGS) ../incl.c
keywords.o:     Lpars.h ../keywords.h ../symtable.h ../types.h\
		../keywords.c
	cc -c $(CFLAGS) ../keywords.c
lexical.o:      Lpars.h ../charclas.h ../conc_syn.h ../in.h\
		../keywords.h ../lexical.h ../mode_stk.h ../modes.h\
		../shortref.h ../symtable.h ../startend.h ../tags.h\
		../types.h\
		../lexical.c
	cc -c $(CFLAGS) ../lexical.c
marked.o:       Lpars.h ../keywords.h ../lexical.h ../modes.h ../types.h
	cc -c $(GCFLAGS) marked.c
mode_stk.o:     ../mode_stk.h ../stack.gen ../types.h\
		../mode_stk.c
	cc -c $(CFLAGS) ../mode_stk.c
modes.o:        Lpars.h ../modes.h ../types.h\
		../modes.c
	cc -c $(CFLAGS) ../modes.c
myerror.o:	Lpars.h ../elem_stk.h ../in.h ../incl.h ../lexical.h\
		../myerror.h ../taglist.h ../tags.h ../types.h\
		../myerror.c
	cc -c $(CFLAGS) ../myerror.c
node.o:         ../ambigu.h ../keywords.h ../node.h ../symtable.h\
		../types.h\
		../node.c
	cc -c $(CFLAGS) ../node.c
notation.o:     ../entity.h ../hash.gen ../notation.h ../types.h\
		../notation.c
	cc -c $(CFLAGS) ../notation.c
omitstrt.o:     ../ambigu.h ../att_gen.h ../context.h ../element.h\
		../node.h ../omitstrt.h ../types.h\
		../omitstrt.c
	cc -c $(CFLAGS) ../omitstrt.c
out.o:		../att_par.h ../group.h ../out.h ../rep_pars.h\
		../replace.h ../tags.h ../types.h\
		../out.c
	cc -c $(CFLAGS) ../out.c
rep_pars.o:	../att_par.h ../charclas.h ../group.h ../rep_pars.h\
		../replace.h ../tags.h\
		../rep_pars.c
	cc -c $(CFLAGS) ../rep_pars.c
replace.o:	../group.h ../replace.h ../types.h\
		../replace.c
	cc -c $(CFLAGS) ../replace.c
report.o:	../ambigu.h ../group.h ../in.h ../report.h ../set.h\
		../types.h\
		../report.c
	cc -c $(CFLAGS) ../report.c
rules.o:        Lpars.h ../att_chk.h ../att_par.h cappoint.i\
		../entity.h ../lexical.h ../modes.h ../shortref.h\
		../tags.h ../types.h
	cc -c $(GCFLAGS) rules.c
set.o:		../set.h ../types.h\
		../set.c
	cc -c $(CFLAGS) ../set.c
sgml.o:		Lpars.h ../keywords.h ../lexical.h ../modes.h\
		../sgmlproc.h ../types.h
	cc -c $(GCFLAGS) sgml.c
sgmlproc.o:	../sgmlproc.h ../types.h\
		../sgmlproc.c
	cc -c $(CFLAGS) ../sgmlproc.c
shortnot.o:     Lpars.h ../group.h ../lexical.h ../modes.h\
		../shortref.h ../types.h
	cc -c $(GCFLAGS) shortnot.c
shortref.o:     Lpars.h ../conc_syn.h ../group.h\
		../modes.h ../set.h ../shortref.h ../stack.gh\
		../stack.gen ../types.h\
		../shortref.c
	cc -c $(CFLAGS) ../shortref.c
startend.o:	Lpars.h ../att_par.h ../charclas.h ../elem_stk.h\
		../group.h ../in.h ../lexical.h ../shortref.h\
		../tags.h ../types.h\
		../startend.c
	cc -c $(CFLAGS) ../startend.c
str_in.o:       ../str_in.h ../types.h\
		../str_in.c
	cc -c $(CFLAGS) ../str_in.c
symtable.o:     ../symtable.h ../types.h\
		../symtable.c
	cc -c $(CFLAGS) ../symtable.c
taglist.o:	Lpars.h first.c  ../taglist.h taglist.i ../types.h\
		../taglist.c
	cc -c $(CFLAGS) ../taglist.c
tags.o:         Lpars.h  ../tags.h tags.i ../types.h\
		../tags.c
	cc -c $(CFLAGS) ../tags.c
token_in.o:     ../token_in.h ../types.h\
		../token_in.c
	cc -c $(CFLAGS) ../token_in.c
tokens.o:       Lpars.h
tools.o:        ../types.h\
		../tools.c
	cc -c $(CFLAGS) ../tools.c
