# libc/z80 Makefile


srcdir = .

TOPDIR = ../../..

SCC = $(TOPDIR)/bin/sdcc -mgbz80
SAS = $(TOPDIR)/bin/as-gbz80

OBJ = div.o mul.o putchar.o printf.o shift.o stubs.o crt0_rle.o heap.o fstubs.o

LIB = gbz80.lib
CC = $(SCC)
AS = $(SAS)
CFLAGS = -I$(srcdir)/../../include -I. --std-c89

all: $(LIB) crt0.o

$(LIB): $(OBJ) Makefile _dummy
	rm -f $(LIB)
	for i in $(OBJ); do echo $$i >> $(LIB); done

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

_dummy:

clean:
	rm -f *.o *.sym *.lst *~ $(CLEANSPEC) *.dump* *.asm *.lib

distclean: clean
	rm -f Makefile
