## $Header: /usr/src/nidentd-2.0/RCS/Makefile,v 2.0 92/05/04 17:42:48 nigelm Exp $
##
## Makefile for nidentd - version $Revision: 2.0 $
##
## If you don't have a bsd type install program, then
## modify the install code to avoid the install program.
##
DESTDIR=/usr/etc
MANDIR=/usr/man
##
CC=cc
CFLAGS=-O
##
default:	all
##
###
### Uncomment the compiler flags for one type of architecture
### Architecture sections separated by lines of #s
############################################################
##
## Need this if SunOS 4 - NB not supported in current version
##
#LIBS=-lkvm
#DEFS=-DHAVE_KVM
############################################################
##
## Need this if MIPS UMIPS 4.51 System 5 Universe
##
#LIBS=-lmld -lbsd
#DEFS=-DSYS5_INCLUDES -DSYS5_KERNEL
############################################################
##
## Need this if MIPS UMIPS 4.51 BSD 4.3 Universe
##
#LIBS=-lmld
#DEFS=-DSYS5_KERNEL
############################################################
##
## NeXT Computer
## Well, actually no flags or libraries are needed!
#LIBS=
#DEFS=
############################################################

all:	identd tcpuid tcpuname libauth-4.0/authuser.o # test

identd.shar: inetd.c Makefile
	makekit -s100k -m

identd: identd.c
	$(CC) $(CFLAGS) $(DEFS) -o identd identd.c $(LIBS)
 
install: identd
	install -s -c -m755 identd $(DESTDIR)/identd
	rm -f $(DESTDIR)/tcpuid
	ln $(DESTDIR)/identd $(DESTDIR)/tcpuid
	rm -f $(DESTDIR)/tcpuname
	ln $(DESTDIR)/identd $(DESTDIR)/tcpuname
	install -c -m644  identd.8 $(MANDIR)/man8/identd.8
	ar rv /usr/lib/libauthuser.a libauth-4.0/authuser.o
	ranlib /usr/lib/libauthuser.a
	install -c -m644 libauth-4.0/authuser.h /usr/include
	install -c -m644 libauth-4.0/authuser.3 /usr/man/man3
	touch install
	chmod 444 install

setgid:	install
	(group=`ls -lg /dev/kmem | awk '{print $$4}'`; chgrp $$group $(DESTDIR)/tcpuid)
	
tcpuid: identd Makefile
	rm -f tcpuid
	ln identd tcpuid

tcpuname: identd Makefile
	rm -f tcpuname
	ln identd tcpuname

libauth-4.0/authuser.o: libauth-4.0/authuser.c libauth-4.0/authuser.h Makefile
	$(CC) $(CCOPTS) -o libauth-4.0/authuser.o -c libauth-4.0/authuser.c 

initialtest: netstatuser tcpuname
	./netstatuser

finaltest: test.c /usr/include/authuser.h Makefile
	$(CC) $(CFLAGS) -o test test.c -lauthuser
	./test

localtest: test.c libauth-4.0/authuser.o libauth-4.0/authuser.h Makefile
	$(CC) $(CFLAGS) -I./libauth-4.0 -o test test.c libauth-4.0/authuser.o 
	./test

clean:
	rm -f identd tcpuname tcpuid test *~ #* *.o core libauth-4.0/*.o
