#
# $Id: makefile,v 1.3 2002/04/01 12:58:39 cjh Exp $
#
# Makefile for "hello" test program
#
# (c) Copyright 2000 Clifford Heath.
# Any use allowed provided copyright notices are retained.
#

AS	=	m6811-elf-as
LD	=	m6811-elf-ld

all:	hello.s19
clean:
	rm -f *.o *.s19 *.bin *.boo *.lst

#
# Make rules for assembling and linking boot blocks:
#

# This assembly rule produces a listing file:
ASFLAGS	=	--gstabs -al
%.o: %.s
	$(AS) $(ASFLAGS) -o $@ $< > $*.lst

# These linker rules use "memory.x", which assumes you're building a 256 byte
# boot block... Beware!
%.s19: %.o memory.x
	$(LD) -m m68hc11elfb --oformat srec --defsym _start=0 -o $@ $<

%.bin: %.o memory.x
	$(LD) -m m68hc11elfb --oformat binary --defsym _start=0 -o $@ $<

%.elf: %.o memory.x
	$(LD) -m m68hc11elfb --defsym _start=0 -o $@ $<

# There's probably a better way to get a \377 into a file, but this works:
%.boo: %.bin
	(echo|tr '\012' '\377' ; cat $<) > $@
