include $(ROOT)/usr/include/make/GBAdefs

VPATH = string ../../../common/lib/ioslibc/string \
        ../../../common/lib/ioslibc/stdio

LCOPTS = -O2

LCINCS = -I$(ROOT)/usr/include/sc -I$(ROOT)/usr/include

TARGETS = libc.a

STRING_CFILES = \
    memcmp.c \
    memmove.c \
    strchr.c \
    strstr.c \
    strncpy.c \
    strrchr.c \
    memcpy.c \
    memset.c \
    strncat.c \
    strncmp.c \
    strnlen.c

STDIO_CFILES = \
    printf.c \
    snprintf.c \
    putchar.c \
    puts.c

CFILES = \
    $(STRING_CFILES) \
    $(STDIO_CFILES)

default: $(TARGETS)

headers:
	$(INSTALL) -m 444 libc.h $(ROOT)/usr/include/gba

exports install: $(TARGETS) headers
	$(INSTALL) -m 444 $(TARGETS) $(ROOT)/usr/lib/gba 

$(TARGETS): %: %($(OBJECTS))
	ar cru $@ $?

include $(COMMONRULES)
