#
# Makefile for the 8051 simulator (generic sources)
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
CFLAGS= -I../include $(SIM8051FLAGS) -O3

.c.s:
	$(CC) $(CFLAGS) -S $<
.c.o:
	$(CC) $(CFLAGS) -c $<
.s.o:
	$(AS) -o $*.o $<

OBJS=	dis_io.o main.o load.o symbTab.o sim_io.o lex.yy.o

all:	$(OBJS)

lex.yy.c: commands.l
	-chmod u+w lex.yy.c
	flex -i commands.l
	chmod -w lex.yy.c

dep:
	$(CPP) $(CFLAGS) -M *.c > .depend

#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif

clean: 
	/bin/rm -f $(OBJS)
	/bin/rm -f lex.yy.c
