#
#    YPS-0.2, NIS-Server for Linux
#    Copyright (C) 1994  Tobias Reber
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
#	@(#)$Id: Makefile,v 2.0 1994/01/06 16:57:43 root Exp $
#	$Author: root $
#	$Log: Makefile,v $
# Revision 2.0  1994/01/06  16:57:43  root
# Version 2.0
#
# Revision 1.7  1994/01/02  20:06:39  root
# Added GPL notice
#
# Revision 1.6  1994/01/01  21:49:21  root
# Added target for libyp.a
#
# Revision 1.5  1993/12/31  18:09:11  root
# Use ypclnt from libc
#
# Revision 1.4  1993/12/30  23:20:54  dok235
# *** empty log message ***
#
# Revision 1.3  1993/06/12  10:37:23  root
# Align with include-4.4
#
# Revision 1.2  1993/06/11  21:30:24  root
# *** empty log message ***
#
#

SRCS=ypcat.c ypmatch.c ypwhich.c yp_xlate.h ypmaplist.c
YPCATOBJS=ypcat.o
YPMATCHOBJS=ypmatch.o
YPWHICHOBJS=ypwhich.o ypmaplist.o

YPDIR=/var/yp
YPETCDIR=/usr/local/etc/yp
SBINDIR=/usr/local/sbin
BINDIR=/usr/local/bin

LIBDIR=../lib
LIBS=-L$(LIBDIR) -lyp
DEPLIBS=$(LIBDIR)/libyp.a

DEFINES=# -DYP_LIBC
INCLUDES=# -I../include
CDEBUGFLAGS=-O -Wall -Wstrict-prototypes
CFLAGS=$(CDEBUGFLAGS) $(INCLUDES) $(DEFINES)

all: ypwhich ypcat ypmatch

ypcat: $(YPCATOBJS) $(DEPLIBS)
	$(CC) $(CFLAGS) -o $@ $(YPCATOBJS) $(LIBS)
ypmatch: $(YPMATCHOBJS) $(DEPLIBS)
	$(CC) $(CFLAGS) -o $@ $(YPMATCHOBJS) $(LIBS)
ypwhich: $(YPWHICHOBJS) $(DEPLIBS)
	$(CC) $(CFLAGS) -o $@ $(YPWHICHOBJS) $(LIBS)

$(LIBDIR)/libyp.a: FRC
	( cd $(LIBDIR); make libyp.a )

install: all
	-mkdir -p $(BINDIR)
	install -m 0755 -s ypwhich $(BINDIR)
	install -m 0755 -s ypcat $(BINDIR)
	install -m 0755 -s ypmatch $(BINDIR)
clean:
	@for i in *.[ch]; \
	do \
		ci "$$i" || ( co -l "$$i" && ci "$$i" ) \
	done
	-rm -f *.o core core.* ypwhich ypcat ypmatch

FRC::

 
ifeq (.depend,$(wildcard .depend))
include .depend
endif

depend: $(SRCS)
	$(CPP) $(CFLAGS) -M $(SRCS) > .depend
