#### Start of system configuration section. ####

srcdir =	@srcdir@

ifeq ($(srcdir),.)
srcdir = ../..
endif

VPATH :=	$(srcdir)

# Common prefix for machine-independent installed files.
prefix =	@prefix@

# Common prefix for machine-dependent installed files.
exec_prefix =	@exec_prefix@

bindir =	$(exec_prefix)/bin
libdir =	$(exec_prefix)/Sys/libs

INSTALL =	@INSTALL@
INSTALL_DATA =	@INSTALL_DATA@

CC =		@CC@

CFLAGS =	@CFLAGS@
LDFLAGS =	@LDFLAGS@

RANLIB =	@RANLIB@
AR =		ar

#### End system configuration section ####

ifdef CATENATE
DEBUG_FLAG =	-g
else
DEBUG_FLAG =	
endif

# I *love* GNU make!
define catenate
/bin/echo -n creating $@...
/bin/echo "$(^:%=#include \"%\"\n)" >$@
/bin/echo done
endef

FLAVOR_CFLAGS =	-m$(CPU) -m$(FPU)
ALL_CFLAGS =	$(CFLAGS) $(FLAVOR_CFLAGS) $(OTHER_CFLAGS) $(DEBUG_FLAG) $(INCS)

INCS =		-I$(srcdir) -I$(srcdir)/../library -I$(srcdir)/../include
LIB =		libstring.a

.c.o:
		$(CC) $(ALL_CFLAGS) -c $< -o $@

SRC =		bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c \
		memcmp.c memcpy.c memmove.c memset.c rindex.c strcasecmp.c \
		strcat.c strcmp.c strcoll.c strcpy.c strcspn.c strdup.c \
		strerror.c strftime.c strlen.c strmode.c strncat.c strncmp.c \
		strncpy.c strpbrk.c strsep.c strspn.c strstr.c strtod.c \
		strtok.c strxfrm.c swab.c

OBJ =		$(SRC:.c=.o)

ifdef CATENATE
ALL =		all.o
else
ALL =		$(OBJ)
endif

$(LIB) :	$(ALL)
		rm -f $@
		$(AR) rv $@ $(ALL)
		$(RANLIB) $@

all.c:		$(SRC)
		@$(catenate)

clean:
		rm -rf 680?0

clobber:	clean
		rm -f Makefile

bcmp.o :	$(srcdir)/../library/defs.h
bcopy.o :	$(srcdir)/../library/defs.h
bzero.o :	$(srcdir)/../library/defs.h
ffs.o :		$(srcdir)/../library/defs.h
index.o :	$(srcdir)/../library/defs.h
rindex.o :	$(srcdir)/../library/defs.h
strcmp.o :	$(srcdir)/../library/defs.h
strcpy.o :	$(srcdir)/../library/defs.h
strdup.o :	$(srcdir)/../library/ixemul.h 
strlen.o :	$(srcdir)/../library/defs.h
strncmp.o :	$(srcdir)/../library/defs.h
strncpy.o :	$(srcdir)/../library/defs.h
strftime.o :	$(srcdir)/../library/ixemul.h 
strtod.o :	$(srcdir)/../library/ixemul.h 
strtok.o :	$(srcdir)/../library/ixemul.h 
