#
#	SCCSID	@(#)Makefile	1.4 85/02/20
#
CFLAGS		= -O -K
DEBUG		= -DEBUG=2

BIN		= Bin
INC		= Include
LIBC		= Libc

LIBRARY		= ../$(BIN)/$(LIBC).a

INCLUDE		= -I../$(INC)

CONFIG		=
DFLAGS		= $(DEBUG) $(CONFIG)
LFLAGS		= $(INCLUDE) $(DFLAGS)

AR		= /bin/ar ru
GREP		= /bin/grep
LINT		= lint -p -u -x
RM		= /bin/rm -f
RANLIB		= /bin/ranlib
LORDER		= /usr/bin/lorder
TSORT		= /usr/bin/tsort

CFILES		= atoo.c bcopy.c bsearch.c sobuf.c \
		  regcmp.c regex.c \
		  strchr.c strpbrk.c strrpbrk.c strrchr.c \
		  strspn.c strtok.c uucplock.c
OBJECTS		= atoo.o bcopy.o bsearch.o sobuf.o \
		  regcmp.o regex.o \
		  strchr.o strpbrk.o strrpbrk.o strrchr.o \
		  strspn.o strtok.o uucplock.o
HEADERS		=

NAME		= CLibrary
PRSPOOLER	= sendfile -Aaprinter -e'-b' piers:basset -n
PRSPOOL		= $(PRSPOOLER)$(NAME)
PRFORMATTER	= pr -l66 -w132 -f -n3

GET		= sccs get

.DEFAULT:
		$(GET) SCCS/s.$<

.c.o:
		$(CC) $(CFLAGS) $(INCLUDE) $(DFLAGS) -c $<

.s.o:
		$(CC) -c $<

$(LIBRARY):	$(OBJECTS)
		@-{ \
		set -x ; \
		if [ ! -r $@ ] ; \
		then \
			$(AR) $@ `$(LORDER) *.o | $(TSORT)` ; \
		else \
			$(AR) $@ $? ; \
		fi; \
		}
		$(RANLIB) $@

$(OBJECTS):	../$(INC)/global.h $(FRC)

llib:		llib-$(LIBC).ln

llib-$(LIBC).ln:	llib-$(LIBC)
		-/lib/cpp $(LFLAGS) -C llib-$(LIBC) \
		| /usr/lib/lint/lint1 -v >llib-$(LIBC).ln

lint:		lint.out llib
		more lint.out

lint.out:	$(HEADERS) $(CFILES)
		$(LINT) $(LFLAGS) $(CFILES) >lint.out 2>&1

cyntax:		cyntax.out
		more cyntax.out

cyntax.out:	$(HEADERS) $(CFILES)
		-cyntax $(LFLAGS) $(CFILES) >cyntax.out 2>&1

print:		$(HEADERS) $(CFILES)
		$(PRFORMATTER) Makefile llib-$(LIBC) $(HEADERS) $(CFILES) | $(PRSPOOL)

clean:
		$(RM) $(OBJECTS) crcs.s lint.out cyntax.out

clobber:	clean
		$(RM) llib-$(LIBC).ln

FRC:
