# File        : Makefile
# Version     : 0.0
# Description : sample makefile for cc65 on Atari 2600 VCS
# Author      : Adam Wozniak <adam@cuddlepuddle.org>
# Date        : Tue Mar 26 18:04:32 PST 2002
# 
# This file is part of cc65-a2600lib.
# 
# cc65-a2600lib 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.
# 
# cc65-a2600lib 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 Foobar; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


# You'll most likely want to change this
LIB=/home/awozniak/cc65-2.7.1/libsrc

OBJS=main.o

CFLAGS=-O -Or -Oi --add-source

A26OBJS=a2600.o

rom.bin: $(OBJS) lib2600.lib
	cl65 --add-source --mapfile rom.map $(CFLAGS) -C a2600.cfg -t none $(OBJS) lib2600.lib
	dd if=vectors.bin of=rom.bin seek=4090 bs=1 count=6 

lib2600.lib: a2600.cfg $(A26OBJS)
	ar65 a lib2600.lib $(A26OBJS) $(LIB)/common/*.o $(LIB)/runtime/*.o

clean:
	rm -f *.o *.s *.bin *.dis *.lib *.map

.c.s:
	cc65 $(CFLAGS) $<

.s.o:
	ca65 $<

.S.o:
	ca65 $<

.c.o:
	cc65 $(CFLAGS) $*.c
	ca65 $*.s
