##########################################################
#
#  a56 - a DSP56001 assembler
#
#  Written by Quinn C. Jensen
#  July 1990
#  jensenq@npd.novell.com (or jensenq@qcj.icon.com)
#
#  29-Oct-92
#  Modified for the Atari ST by Ate Brink (ate@cs.ruu.nl)
#  Note: The original gram.c and lex.yy.c were used.
#        And I renamed lex.yy.c to lexyy.c to avoid
#        conflicts with GEMDOS. 
#
##########################################################

OBJS = main.o gram.o lex.o tok_tab.o subs.o getopt.o

# LIB = -ll
LIB = -lflexlib
CC = gcc

#NOTE: lex.c cannot be compiled with -g.  An assembler bug causes the text
#  symbols to be messed up (at least on the Icon system).
CFLAGS = -traditional -O -DYYDEBUG 

all:	a56 toomf

a56:	$(OBJS)
	$(CC) $(CFLAGS) -o a56.ttp $(OBJS) $(LIB)

lex.o:	lexyy.c lex.c gram.h
	$(CC) $(CFLAGS) -c lex.c

lex.yy.c:	a56.l
	lex -v a56.l

gram.c:	a56.y
	yacc a56.y
	mv y.tab.c gram.c

header:	; yacc -d a56.y
	mv y.tab.h gram.h

tok_tab.c:	gram.h
	awk -f tok.awk < gram.h > tok_tab.c

y.output:	a56.y
	yacc -v a56.y

toomf:	toomf.o
	$(CC) -o toomf.ttp $(CFLAGS) toomf.o

tape:	; tar cvbf 1 - Makefile main.c a56.y lex.c a56.l tok.awk \
		a56.h qcjlib.h *.a56 | compress > a56.tar.Z

main.o gram.o lex.o:	a56.h

clean:	; rm -f a56.ttp toomf.ttp y.output *.o *.out
