#
# Makefile for the 8051 simulator (automatic sources generation)
#
# 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)

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

OBJS=	instTab.o sfrTab.o

tables: $(OBJS)

instTab.c: gen_instTab.awk 8051.instr
	-chmod u+w instTab.c
	awk -f gen_instTab.awk 8051.instr
	chmod -w instTab.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 instTab.c
