# Makefile for H8/300 cross compilation of C and assembly programs.

# Path to C compiler (gcc), assembler (as) and linker (ld).
BINDIR = /users/kursus/dArk/solaris/h8300-hitachi-hms/bin/
CC = $(BINDIR)gcc
AS = $(BINDIR)as
LD = $(BINDIR)ld

# Options for C compiler and linker. 
CFLAGS =  -O2 -Wall
LFLAGS =  -Trcx.lds 

# Entries.
# $< and $@ expands to the actual file name that matches the 
# right hand side and the left hand side of : (colon).

%.o: %.c
	$(CC) $(CFLAGS)  -c $<

%.o: %.s
	$(AS) $< -o $@

%.s: %.c
	$(CC) -S $(CFLAGS) $<

%.srec: %.o
	$(LD) $(LFLAGS) -o $@ $<
