# Makefile for libs/sh7045
# Satofumi KAMIMURA
# $Id$

include ../rules.mk

# Compile options
ARCH = sh-coff
#ARCH = sh-elf
LD_LOAD_FOR_BUILD = ../sh45load.x
#LD_LOAD_FOR_BUILD = ../shelf45load.x

#LD_LOAD_FOR_BUILD = ../sh45load_elf.ld

LD_ROM_FOR_BUILD = ../sh45rom.x
LD_INTERNAL_FOR_BUILD = ../sh45rom.x
START_UP_FILES = ../crt0.S

CFLAGS_FOR_BUILD = -O2 -m2 -Wall -Werror ${INCLUDES}
INCLUDES = -I..
LDFLAGS_FOR_BUILD = -nostartfiles ${START_UP_FILES}
LDLIBS_FOR_BUILD =
#ARFLAGS_FOR_BUILD = rv

# Target
TARGET = \
	io_sample.mot \
	wdt_reset.mot \
	checkStaticVariable.mot \
	readable.mot \
	sci_gets.mot \
	putint.mot \
	hello_ram.mot \
	hello.mot \
	hello.dis \
	echoback.mot \
	echoback.rom \
	putstr.mot \
	putstr.rom \
	putstr.dis \
	timer1sec.mot \
	timer1sec.dis \

all : ${TARGET}

clean :
	${RM} *.o ${TARGET} allTest *.cof *.dis *.rom_dis

depend :
	makedepend -Y -- ${INCLUDES} -- ${wildcard *.h *.c *.cpp}

.PHONY : all clean depend
######################################################################
hello.cof : hello.S
	${CC_FOR_BUILD} ${CFLAGS} -nostartfiles -nostdlib -T../sh45internal.x $^ -o $@

hello_ram.cof : hello_ram.S
	${CC_FOR_BUILD} ${CFLAGS} -nostartfiles -nostdlib -T../sh45load.x $^ -o $@
#	${CC_FOR_BUILD} ${CFLAGS} -nostartfiles -nostdlib -T../sh45internal.x $^ -o $@

REQUIRE_LIBS = ../sh7045.a
${REQUIRE_LIBS} :
	cd ${@D}/ && ${MAKE} ${@F}

io_sample.cof wdt_reset.cof checkStaticVariable.cof readable.cof sci_gets.cof putint.cof putstr.cof echoback.cof timer1sec.cof : ${REQUIRE_LIBS}
checkStaticVariable.rom_dis : ${REQUIRE_LIBS}
checkStaticVariable.rom : ${REQUIRE_LIBS}
putstr.rom echoback.rom : ${REQUIRE_LIBS}

# DO NOT DELETE

checkStaticVariable.o: ../sci_put.h ../sci_ctrl.h ../imask_ctrl.h
echoback.o: ../sci_put.h ../sci_ctrl.h ../sci_get.h ../imask_ctrl.h
io_sample.o: ../sci_put.h ../sci_ctrl.h ../imask_ctrl.h
putint.o: ../imask_ctrl.h ../sci_put.h ../sci_ctrl.h
putstr.o: ../imask_ctrl.h ../sci_put.h ../sci_ctrl.h
readable.o: ../sci_get.h ../sci_ctrl.h ../sci_put.h ../timer_ctrl.h
readable.o: ../imask_ctrl.h
sci_gets.o: ../sci_put.h ../sci_ctrl.h ../sci_get.h ../imask_ctrl.h
timer1sec.o: ../sci_put.h ../sci_ctrl.h ../imask_ctrl.h ../timer_ctrl.h
wdt_reset.o: ../wdt_ctrl.h ../sci_put.h ../sci_ctrl.h ../timer_ctrl.h
wdt_reset.o: ../imask_ctrl.h
