# Standard C (ANSI) compatabilaty

SHELL = /bin/sh

# This is for the sun386i your mileage may vary :-)
#CC=gcc -ansi -Dsun386 -Dsun -Di386

CONFIG = -D_SYSV
#CONFIG = -D_BSD

LN = ln
#RANLIB = ranlib		# For BSD systems
RANLIB = echo Updated

LIB = libstdc.a
INCL = ../h

CFLAGS = $(CCOPTS) -I$(INCL) $(CONFIG)

MISC =	Makefile stdio.h_std
HDRS =	limits.h stddef.h stdlib.h string.h time.h stdarg.h 
SRCS =	strstr.c memmove.c stdio.c #clock.c
OBJS =	strstr.o memmove.o stdio.o #clock.o 

all:	$(LIB)

link:	$(HDRS) stdio.h 
	[ -d $(INCL) ] || mkdir $(INCL)
	[ -d $(INCL)/sys ] || mkdir $(INCL)/sys
	-$(LN) types.h $(INCL)/sys
	-$(LN) limits.h stddef.h stdlib.h stdio.h string.h time.h stdarg.h $(INCL)

$(LIB):	$(OBJS)
	ar r $@ $?
	$(RANLIB) $@

stdio.h: stdio.h_std stdio.sed /usr/include/stdio.h 
	sed -f stdio.sed </usr/include/stdio.h >stdio.hacked
	sed <stdio.h_std >stdio.h -e '/%%%/ r stdio.hacked'
	rm stdio.hacked

clean:
	-rm -f *.o *.out stdio.hacked

clobber: clean
	-rm -f $(LIB) stdio.h

string.h: stddef.h

stdlib.h: stddef.h

stdio.h: stddef.h 

time.h: stddef.h

stdio.o: stdio.h

setvbuf.o: stdlib.h stdio.h

fprintf.o: stdarg.h stdio.h

sprintf.o: stdarg.h stdio.h

vprintf.o: stdarg.h stdio.h

strstr.o: string.h 

