# Make file for telnetd directory
#
# Things you might want to change.  Pass them in on the command line:
# ROOT - should point to the root where the commands will be installed
#        (e.g. /deliver/INETSVCS/indnetwk)

ROOT=

PRODUCTS=/usr/lbin/telnetd 

# Defaults file containing the shell, compiler options, etc
BUILDRULES=/source/INETSVCS/$(LOGNAME)/config/defaults

include ${BUILDRULES}

INCLUDES= -I../include -I/usr/include
CCFLAGS=$(INCLUDES) -DAUDIT $(CFLAGS)

OBJS= telnetd.o search.o

SRCS= telnetd.c search.c

LDLIBRARIES=    ../util/libutil.a

#Install database name
INSTALLDB=/source/INETSVCS/$(LOGNAME)/config/installdb

#Script called to parse the install deliverable
INSTALLSCPT=/source/INETSVCS/$(LOGNAME)/config/install_script

default: all

all: clean build install

clean:
	$(RM) -f $(OBJS) authenc.o
	$(RM) -f telnetd ktelnetd
	
install:
	for file in $(PRODUCTS) ; do \
		$(INSTALLSCPT) $$file $(INSTALLDB) ;  \
	done

build:  telnetd

telnetd: $(SRCS)
	$(ECHO) "Building telnetd..."
	$(CC) -c $(CCFLAGS) $(SRCS)
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBRARIES)

ktelnetd: $(SRCS) authenc.c
	$(ECHO) "Building ktelnetd..."
	$(CC) -c $(CCFLAGS) -DAUTHENTICATION $(SRCS) authenc.c
	$(CC) $(LDFLAGS) -o $@ $(OBJS) authenc.o $(LDLIBRARIES) \
		../libtelnet/libtelnet.a -lcom_err -lcrypto \
		-lisode -lkrb5 -lndbm
