# Generated automatically from Makefile.in by configure.
# Makefile template for h8comm

prefix=/usr/local
exec_prefix=${prefix}
target_alias=h8300-hms

DEFS= -DHAVE_STRING_H=1 -DHAVE_FCNTL_H=1 -DHAVE_SYS_FILE_H=1 
INSTALL=/usr/bin/install -c
CC=gcc

LIB_INSTALL_DIR=${prefix}/lib/h8
BIN_INSTALL_DIR=${exec_prefix}
CROSS_PREFIX=${target_alias}
HOST_DEFS=-DLIB_INSTALL_DIR=\"$(LIB_INSTALL_DIR)\" $(DEFS)

PROGS = h8comm h8prog.bin romsmpl.bin
INSTALLFILES = h8prog.bin romsmpl.bin h8rom.x h8ram.x h8crt0.o
CROSS_CFLAGS= -O -mh -g -mrelax

CROSS_CC=$(CROSS_PREFIX)-gcc
CROSS_OBJCOPY=$(CROSS_PREFIX)-objcopy
CROSS_OBJDUMP=$(CROSS_PREFIX)-objdump
HOST_CFLAGS=$(HOST_DEFS)

all : $(PROGS)

install :
	$(INSTALL) -d $(BIN_INSTALL_DIR)
	$(INSTALL) -d $(LIB_INSTALL_DIR)
	$(INSTALL) -cs h8comm $(BIN_INSTALL_DIR)
	$(INSTALL) -c $(INSTALLFILES) $(LIB_INSTALL_DIR)

h8prog.bin : h8prog
	$(CROSS_OBJCOPY) -O binary -R .stack h8prog h8prog.bin
romsmpl.bin : romsmpl Makefile
	$(CROSS_OBJCOPY) -O binary -R .stack romsmpl romsmpl.bin
h8prog : h8prog.S h83048addr.h Makefile h8ram.x
	$(CROSS_CC) $(CROSS_CFLAGS) -nostdlib -T h8ram.x h8prog.S -o h8prog
romsmpl : romsmpl.o Makefile h8rom.x h8crt0.o
	$(CROSS_CC) $(CROSS_CFLAGS) -T h8rom.x -nostartfiles\
	 h8crt0.o romsmpl.o -o romsmpl

romsmpl.o : romsmpl.c h83048addr.h Makefile
	$(CROSS_CC) $(CROSS_CFLAGS) -c romsmpl.c
h8prog.o : h8prog.c h83048addr.h Makefile
	$(CROSS_CC) $(CROSS_CFLAGS) -c h8prog.c
writebyte.o : writebyte.S
	$(CROSS_CC) $(CROSS_CFLAGS) -c writebyte.S
h8crt0.o : h8crt0.S
	$(CROSS_CC) $(CROSS_CFLAGS) -c h8crt0.S

h8comm : h8comm.o config.h
	$(CC) $(HOST_CFLAGS) h8comm.o -o h8comm
h8comm.o : h8comm.c config.h
	$(CC) $(HOST_CFLAGS) -c h8comm.c

clean :
	rm -f *.o *.bin
	rm -f h8prog romsmpl
