NOMAN=	# defined
FILES=	tusb3410fw
SRCS=	interrupts.c main.c requests.c
OBJS=	${SRCS:.c=.rel}

# The following program is part of pkgsrc/devel/sdcc
SDCC=		/usr/pkg/bin/sdcc

# Flags for the TUSB3410 8052 microprocessor
SDCCFLAGS=	--Werror -mmcs51 --model-small --opt-code-size
# CFLAGS for sdcc
SDCCCFLAGS=
# Flags for the TUSB3410 memory map
SDCCLDFLAGS=	--code-loc 0x0000 --code-size 0x4000 \
                --xram-loc 0xF800 --xram-size 0x0800

# The following program is part of pkgsrc wip/srecord
SRCAT=		/usr/pkg/bin/srec_cat

includes:

clean:
	rm -f rm *.asm *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym

cleandir:

.SUFFIXES: .c .rel

.c.rel:
	${SDCC} ${SDCCFLAGS} ${SDCCCFLAGS} -c $<

interrupts.c: interrupts.h requests.h tusb3410.h uticom.h

main.c: interrupts.h requests.h tusb3410.h uticom.h

requests.c: interrupts.h requests.h tusb3410.h uticom.h

tusb3410fw.ihx: ${OBJS}
	${SDCC} ${SDCCFLAGS} ${SDCCLDFLAGS} -o tusb3410fw.ihx ${OBJS}

tusb3410fw: tusb3410fw.ihx
	${SRCAT} $> -Intel -Output $@ -Binary

tusb3410fw.h: tusb3410fw.ihx
	${SRCAT} $> -Intel -Output $@ -C-Array ${@:.h=} -No-CONST

.include <bsd.files.mk>
