#	Makefile -- for librle

#	last edit:	86/06/18	G S Moss

#	SCCS ID:	@(#)Makefile	1.10

PRODUCT = librle
INSHDR	= rle.h
HEADERS	=
CFILES	= librle.c
OBJS	= librle.o
S52_MANUAL=${PRODUCT}.3
BSD_MANUAL=${PRODUCT}.3b
MANUAL	= ${S52_MANUAL}
SOURCES	= Makefile make_bsd ${CFILES} ${HEADERS} ${INSHDR} ${S52_MANUAL}
DISTDIR	= /d/mike/cad/dist/${PRODUCT}
BINDIR	= /vld/bin
LIBDIR	= /vld/lib
S52_INCDIR=/vld/include
BSD_INCDIR=/m/cad/dist/h
INCDIR	= ${S52_INCDIR}
S52_MANDIR = /usr/5lib/man/local/man3
BSD_MANDIR = /usr/man/man3
MANDIR	= ${S52_MANDIR}
S52_CFLAGS = -I${INCDIR} -O
BSD_CFLAGS = -I${INCDIR} -O -DBSD
CFLAGS	= -I${INCDIR} -O
BINPERM	= 775
LIBPERM = 664
MANPERM	= 664
LDFLAGS = -n
INS	= cp
SHELL	= /usr/5bin/sh

.DEFAULT:
	$(GET) $(GFLAGS) -p s.$@ > $@
	touch $@

all:	inst_hdr ${PRODUCT}.a

${PRODUCT}.a:	${OBJS}
	ar r ${PRODUCT}.a `lorder ${OBJS} | tsort`

${BSD_MANUAL}:	${S52_MANUAL}
	ln $? $@

debug:		debug.o ${PRODUCT}.a
	-ranlib ${PRODUCT}.a
	$(CC) -o $@ $@.o ${PRODUCT}.a -lm

inst_hdr:	${INSHDR}
	@if cmp -s ${INCDIR}/$? $?; \
	 then	echo $? unchanged; \
	 else	${INS} $? ${INCDIR} && echo $? installed in ${INCDIR}; \
	 fi

print:		${MANUAL} Makefile ${INSHDR} ${CFILES}
	( nroff -T${LP} -man ${MANUAL} ; \
	  pr Makefile ${INSHDR} ${CFILES} \
				${MANUAL} ) | lpr

lint:		${INSHDR} ${CFILES}
	lint -I${INCDIR} ${CFILES} > ${PRODUCT}.lint

flow:		${INSHDR} ${CFILES}
	cflow ${CFILES} > ${PRODUCT}.flow

xref:		${INSHDR} ${CFILES}
	cxref -c -s -w132 ${CFILES} > ${PRODUCT}.xref

install:	all ${INSHDR} ${MANUAL}
	@if cmp -s ${LIBDIR}/${PRODUCT}.a ${PRODUCT}.a; \
	 then	echo ${PRODUCT}.a unchanged; \
	 else	${INS} ${PRODUCT}.a ${LIBDIR} \
		&& chmod ${LIBPERM} ${LIBDIR}/${PRODUCT}.a \
		&& ranlib ${LIBDIR}/${PRODUCT}.a \
		&& echo ${PRODUCT}.a installed in ${LIBDIR}; \
	 fi
	-@if cmp -s ${MANDIR}/${MANUAL} ${MANUAL}; \
	 then	echo ${MANUAL} unchanged; \
	 else	${INS} ${MANUAL} ${MANDIR} \
		&& chmod ${MANPERM} ${MANDIR}/${MANUAL} \
		&& echo ${MANUAL} installed in ${MANDIR}; \
	 fi
	-@if vax; \
	 then ${INS} ${SOURCES} ${DISTDIR} \
		&& echo sources installed in ${DISTDIR}; \
	 fi

clean:
	-rm -f ${OBJS} ${PRODUCT}.lint ${PRODUCT}.flow \
		${PRODUCT}.xref

clobber:	clean
	-rm -f ${PRODUCT}.a

librle.o: librle.c rle.h
