# Make file for bind/tools/nslookup 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/bin/nslookup

NSLOOKUPSRC     = commands.c debug.c getinfo.c hosttable.c \
                  list.c main.c send.c skip.c subr.c
NSLOOKUP        = commands.o debug.o getinfo.o hosttable.o \
                  list.o main.o send.o skip.o subr.o
HDRS            = bsd.h res.h

INCLUDES=-I. -I../../../include -I/usr/include

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

include ${BUILDRULES}

CCFLAGS = $(INCLUDES) -DBSD=43 $(CFLAGS)

#Commands used by this Makefile

LEX=/opt/langtools/bin/lex
MV=/usr/bin/mv

#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 *.o
	$(RM) -f *.b
	$(RM) -f a.out
	$(RM) -f core commands.c version.c nslookup

build: nslookup

.c.o:
	$(CC) $(CCFLAGS) -c $*.c

nslookup: $(NSLOOKUP) $(HDRS)
	$(ECHO) "Building nslookup..."
	$(SHELL) newvers.sh
	$(CC) -o $@ $(LDFLAGS) $(NSLOOKUP) version.c -ll

commands.c: commands.l
	$(LEX) commands.l
	$(MV) lex.yy.c commands.c
	
install:
	for file in $(PRODUCTS) ; do \
		$(INSTALLSCPT) $$file $(INSTALLDB) ;  \
	done
