# Makefile for native version of bcc string library.
# To force the 8086 version (don't - the Minix asm one is better), use
#	make CC='bcc -0'
# To force the 80386 version, use
#	make CC='bcc -3'
# For a portable version, use
#	make XCFLAGS=-DC_CODE

CFLAGS		=-O $(XCFLAGS)
OBJS		=memcmp.o memcpy.o memset.o \
		 strcmp.o strcpy.o strcspn.o strlen.o strncat.o strncmp.o \
		 strncpy.o strpbrk.o
TESTPROGS	=memcpytest memsettest strntest

default: $(OBJS)

clean:
	rm -f $(OBJS) $(TESTPROGS)

install: $(OBJS)
	@if test -z "$(LIBDIR)" ; \
	then \
		echo "LIBDIR not specified (use makelib)" ; \
		exit 1 ; \
	else \
		exit 0 ; \
	fi
	ar r $(LIBDIR)/libc.a $(OBJS)

test: $(TESTPROGS)
	@echo "Note that the tests use the current library"
	@-if ./memcpytest && ./memsettest && ./strntest ; \
	then \
		echo ok; \
	else \
		echo failed ; \
	fi
	@echo "You should also recompile and run Spencer's test (test/test15)"

$(OBJS): /usr/include/string.h
$(TESTPROGS): /usr/include/stdio.h /usr/include/string.h
