                # Modula-2 library
LIB	= ../../reuse/src

                # options for modula compiler
MFLAGS	= -nobounds -norange -M. -M$(LIB)

                # option to name linked program
OUT	= ; mv a.out

MD	= m2c $(MFLAGS)		# command to compile definition module
MI	= m2c $(MFLAGS)		# command to compile implementation module
MP	= m2c $(MFLAGS)		# command to compile program module
ML	= m2c $(MFLAGS) -e	# command to link program

ED	= .def	# extension for definition module
EI	= .mod	# extension for implementation module
EP	= .mod	# extension for program module
ES	= .sym	# extension for symbol file (compiled definition)
EO	= .o	# extension for object file (compiled implementation)

SD	= .def	# compiler suffix for definition module
SI	= .mod	# compiler suffix for implementation module
SP	= .mod	# compiler suffix for program module

all	:

# HEAD

Errors$(ES)	: Errors$(ED)	; $(MD) Errors$(SD)

Errors$(EO)	: Errors$(EI)	; $(MI) Errors$(SI)
Errors$(EO)	: Errors$(ES)

all	: GetImports
GetImports$(EO)	: GetImports$(EP)	; $(MP) GetImports$(SP)
GetImports$(EO)	: Scanner$(ES)
GetImports$(EO)	: Parser$(ES)
GetImports$(EO)	: Errors$(ES)

Parser$(ES)	: Parser$(ED)	; $(MD) Parser$(SD)
Parser$(ES)	: Scanner$(ES)

Parser$(EO)	: Parser$(EI)	; $(MI) Parser$(SI)
Parser$(EO)	: Parser$(ES)
Parser$(EO)	: Errors$(ES)
Parser$(EO)	: Scanner$(ES)
Parser$(EO)	: Scanner$(ES)
Parser$(EO)	: Errors$(ES)

Scanner$(ES)	: Scanner$(ED)	; $(MD) Scanner$(SD)

Scanner$(EO)	: Scanner$(EI)	; $(MI) Scanner$(SI)
Scanner$(EO)	: Scanner$(ES)
Scanner$(EO)	: Errors$(ES)

GetImports	: GetImports$(EO) Errors$(EO) Parser$(EO) Scanner$(EO)	; $(ML) GetImports $(OUT) GetImports

# TAIL

# CLEAN	:	; rm -f core *.[dimor] ERRORS LISTING
CLEAN	:	; rm -f core *.sym *.o
