#
# Makefile for yppasswd/yppasswdd
# 
# shadow support added by Charles Lopes.
VERSION	= 0.3

CFLAGS  = $(OPTFLAGS) $(DEFINES) -DVERSION=\"$(VERSION)\"
OPTFLAGS= -O2 -fomit-frame-pointer
CC	= gcc -Wall

# if you want to use old-style NIS instead of NYS, comment this out:
NYSLIB	= -lnsl
NYSDEF	= -DNYS

# for shadow password support, uncomment these lines
#SPWLIB	= -DSHADOWPWD
#SPWDEF	= -lshadow

# Combine defines and libs....
DEFINES = -D_GNU_SOURCE $(NYSDEF) $(SPWDEF)
LIBS	= $(NYSLIB) $(SPWLIB)

CLNTOBJ = yppasswd.o  yppasswd_xdr.o
SRVROBJ = yppasswdd.o yppasswd_xdr.o update.o
OBJ	= $(SRVROBJ) $(CLNTOBJ)
PROGS	= yppasswd yppasswdd

all: $(PROGS)

yppasswd: $(CLNTOBJ)
	$(CC) $(LDFLAGS) -o $@ $(CLNTOBJ) $(LIBS)

yppasswdd: $(SRVROBJ)
	$(CC) $(LDFLAGS) -o $@ $(SRVROBJ) $(LIBS)

$(OBJ):: yppasswd.h

clean::
	$(RM) core $(PROGS) $(OBJ)

install:: $(PROGS)
	@echo "Installing... "
	install -o bin -g bin -m 755 -s yppasswd /bin
	install -o bin -g bin -m 700 -s yppasswdd /usr/sbin/rpc.yppasswdd
	install -o bin -g bin -m 700 pwupdate /usr/sbin/yp.pwupdate

