#   BitchZX - ZX IRC client
#   Copyright (c) 2010, 2011 ub880d
#
#   $Id: Makefile 68 2013-10-26 03:08:45Z ub880d $
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License along
#   with this program; if not, write to the Free Software Foundation, Inc.,
#   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#   Author contact information:
#
#   E-mail: ub880d@users.sf.net
#

PROJECT = BitchZX
SRCFILES = *.asm
SOURCE  = ${PROJECT}.asm
TARGET  = ${PROJECT}.tap
BINFILE = bzx.bin
PFILE   = bzx.p
LST     = bzx.lst
TXT     = bzxbasic_zmakebas.txt
BASIC   = bzxbasic.tap
CODE    = bzxcode.tap

all:	${TARGET}


${BASIC}:	${TXT}
		zmakebas -a1 -n ${PROJECT} -o ${BASIC} ${TXT}

#${BASIC}:	${TXT}
#		bas2tap -q -a1 -s${PROJECT} ${TXT} ${BASIC}

${PFILE}:	${SOURCE} $(SRCFILES)
		asl ${SOURCE} -q -o ${PFILE} -L -olist ${LST}

${BINFILE}:	${PFILE}
		p2bin ${PFILE} -r \$$-\$$ -l 0

${CODE}:	${BINFILE}
		bin2tap ${BINFILE} -o ${CODE} -a 32768

${TARGET}:	${BASIC} ${CODE}
		cat ${BASIC} ${CODE} > ${TARGET}
	
clean:
		rm -f ${PFILE} ${BINFILE} ${CODE} ${TARGET} ${BASIC} ${LST} *~

