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

RM		= /bin/rm -f
AR		= /bin/ar ru
RANLIB		= /bin/ranlib
LORDER		= /usr/bin/lorder
TSORT		= /usr/bin/tsort

INC		= Include
BIN		= Bin

LIBNAME		= NNstrpr
LIBRARY		= ../$(BIN)/$(LIBNAME).a

INCLUDE		= -I../$(INC) -I../NNstrpr

CONFIG		=
DFLAGS		= $(DEBUG) $(CONFIG) -D$(LIBNAME)
LFLAGS		= $(INCLUDE) $(DFLAGS)

CFILES		= ../NNstrpr/Debug.c ../NNstrpr/Pinit.c \
		  ../NNstrpr/Pprintstats.c ../NNstrpr/Precv.c \
		  ../NNstrpr/Psend.c
HEADERS		= ../NNstrpr/Channel.h ../NNstrpr/Debug.h \
		  ../NNstrpr/Packet.h ../NNstrpr/Pconfig.h \
		  ../NNstrpr/Proto.h ../NNstrpr/Pstats.h
OBJECTS		= Debug.o Pinit.o Pprintstats.o Precv.o Psend.o

PRSPOOLER	= apr -i
PRSPOOL		= $(PRSPOOLER)$(LIBNAME)
PRFORMATTER	= pr -l66 -w132 -f -n3

GET		= sccs get

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

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

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

Debug.o:	../NNstrpr/Debug.h ../NNstrpr/Packet.h ../NNstrpr/Pconfig.h ../NNstrpr/Debug.c
		@-if [ ! -r Debug.c ]; then ln ../NNstrpr/Debug.c .; fi
		$(CC) $(CFLAGS) $(INCLUDE) $(DFLAGS) -c Debug.c
		@-if [ $(LIBNAME) != NNstrpr ]; then $(RM) Debug.c; fi
Pinit.o:	$(HEADERS) ../NNstrpr/Pinit.c
		@-if [ ! -r Pinit.c ]; then ln ../NNstrpr/Pinit.c .; fi
		$(CC) $(CFLAGS) $(INCLUDE) $(DFLAGS) -c Pinit.c
		@-if [ $(LIBNAME) != NNstrpr ]; then $(RM) Pinit.c; fi
Pprintstats.o:	../NNstrpr/Pstats.h ../NNstrpr/Pprintstats.c
		@-if [ ! -r Pprintstats.c ]; then ln ../NNstrpr/Pprintstats.c .; fi
		$(CC) $(CFLAGS) $(INCLUDE) $(DFLAGS) -c Pprintstats.c
		@-if [ $(LIBNAME) != NNstrpr ]; then $(RM) Pprintstats.c; fi
Precv.o:	$(HEADERS) ../NNstrpr/Precv.c
		@-if [ ! -r Precv.c ]; then ln ../NNstrpr/Precv.c .; fi
		$(CC) $(CFLAGS) $(INCLUDE) $(DFLAGS) -c Precv.c
		@-if [ $(LIBNAME) != NNstrpr ]; then $(RM) Precv.c; fi
Psend.o:	$(HEADERS) ../NNstrpr/Psend.c
		@-if [ ! -r Psend.c ]; then ln ../NNstrpr/Psend.c .; fi
		$(CC) $(CFLAGS) $(INCLUDE) $(DFLAGS) -c Psend.c
		@-if [ $(LIBNAME) != NNstrpr ]; then $(RM) Psend.c; fi

llib:		llib-$(LIBNAME).ln

llib-$(LIBNAME).ln:	../NNstrpr/llib-NNstrpr
		-/lib/cpp $(LFLAGS) -C $? \
		| /usr/lib/lint/lint1 -v >llib-$(LIBNAME).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 $(INCLUDE) $(DFLAGS) $(CFILES) >cyntax.out 2>&1

print:
		$(PRFORMATTER) Makefile ../NNstrpr/llib-NNstrpr $(HEADERS) $(CFILES) | $(PRSPOOL)

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

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

FRC:
