#include ../Makeconfig
#
#include ../Makerules

CC = gcc

ifndef USRSBINDIR
USRSBINDIR=${DEBDIR}/usr/sbin
endif

ifndef MANSECT
MANSECT=8
endif

ifndef MANDIR
MANDIR=${DEBDIR}/usr/man/man${MANSECT}
endif

ifndef WFLAGS
WFLAGS = -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wnested-externs
endif

ifndef XCFLAGS
XCFLAGS = -D_BSD_SOURCE
endif

ifndef OPTFLAGS
OPTFLAGS = -O2 -fno-strength-reduce # -fbounds-checking
endif

INC = -I.

CFLAGS = ${WFLAGS} ${OPTFLAGS} ${INC} ${XCFLAGS}

OBJS = daemon.o errorlog.o lockreg.o \
	locktest.o openmax.o readn.o \
	slave.o writen.o ypbind.o xdr_ypbind.o

PROG = ypbind

all: ${PROG}

ypbind: ${OBJS}
	${CC} ${LDFLAGS} -o $@ ${OBJS} ${LIBS}

install: ${PROG}
	install -c -o root -g root -m 0755 -s ${PROG} ${USRSBINDIR}
	install -c -o root -g root -m 0644 ${PROG}.man ${MANDIR}/${PROG}.8

clean:
	${RM} -f core *.o *.a *~ ${PROG}

depend: 
	${CC} -MM ${CFLAGS} *.c > .depend

#
# include a dependency file if one exists
#
ifeq (.depend,${wildcard .depend})
include .depend
endif
