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

VPATH = string stdio other

LCOPTS = -O2

TARGETS = libioslibc.a

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

STDIO_CFILES = \
    fclose.c \
    flen.c \
    fopen.c \
    fread.c \
    fseek.c \
    fwrite.c \
    getchar.c \
    gets.c \
    printf.c \
    putchar.c \
    puts.c \
    rename.c  \
    scanf.c \
    time.c \
    tmpnam.c \
    unlink.c

CFILES = \
    $(STDIO_CFILES) \
    $(STRING_CFILES) \
    get_cmdline.c \
    exit.c \
	usleep.c\
	iobuf.c \
	busdelay.c

ASFILES = \
    vio.s

default: $(TARGETS)

headers:
	$(INSTALL) -m 444 ioslibc.h $(ROOT)/usr/include/versa-ios

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

sdk-install: default
	$(INSTALL) -d $(SDK_ROOT)/usr/lib/versa-ios
	$(INSTALL) $(TARGETS) $(SDK_ROOT)/usr/lib/versa-ios

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

include $(COMMONRULES)
