# Makefile for bind-4.9 top level
# vixie@decwrl December, 1992 [original]
#
# $Id: Makefile,v 4.9.1.2 1993/05/17 09:59:01 vixie Exp vixie $

## ++Copyright++ 1989
## -
## Copyright (c) 1989
##    The Regents of the University of California.  All rights reserved.
## 
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions
## are met:
## 1. Redistributions of source code must retain the above copyright
##    notice, this list of conditions and the following disclaimer.
## 2. Redistributions in binary form must reproduce the above copyright
##    notice, this list of conditions and the following disclaimer in the
##    documentation and/or other materials provided with the distribution.
## 3. All advertising materials mentioning features or use of this software
##    must display the following acknowledgement:
## 	This product includes software developed by the University of
## 	California, Berkeley and its contributors.
## 4. Neither the name of the University nor the names of its contributors
##    may be used to endorse or promote products derived from this software
##    without specific prior written permission.
## 
## THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
## ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
## DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
## OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
## LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
## OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
## -
## Portions Copyright (c) 1993 by Digital Equipment Corporation.
## 
## Permission to use, copy, modify, and distribute this software for any
## purpose with or without fee is hereby granted, provided that the above
## copyright notice and this permission notice appear in all copies, and that
## the name of Digital Equipment Corporation not be used in advertising or
## publicity pertaining to distribution of the document or software without
## specific, written prior permission.
## 
## THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
## WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
## OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
## CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
## DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
## PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
## SOFTWARE.
## -
## --Copyright--

VER = 4.9.2
SHELL = /bin/sh
MAKE = make
DESTDIR =

CC = cc
INDOT =
#(sgi)
#CC = cc -xansi -signed -D__STDC__ -D_BSD_SIGNALS
#(sunos)
#CC = cc -DBSD
#INDOT = in.

#(ultrix, sunos, other 4.[23]bsd-alikes)
LEX = lex
LIBS = -ll
PIDDIR = /etc
DESTBIN = /usr/bin
DESTSBIN = /usr/etc
DESTEXEC = /usr/etc
DESTMAN = /usr/man
DESTHELP = /usr/lib
COMPINCL = compat/include
CATEXT = $$N
INSTALL_COMPAT = install-compat

#(BSD4.4, BSD/386, other net2-alikes)
#LEX = lex -I
#LIBS = -ll -lutil
#PIDDIR = /var/run
#DESTBIN = /usr/bin
#DESTSBIN = /usr/sbin
#DESTEXEC = /usr/libexec
#DESTMAN = /usr/share/man
#DESTHELP = /usr/share/misc
#COMPINCL = .
#CATEXT = 0
#INSTALL_COMPAT = install

LDFLAGS =
CDEBUG = -O
INCL = include
RES = res/libresolv.a
COMPLIB = compat/lib/lib44bsd.a
MFLAGS = "CC=${CC}" "CDEBUG=${CDEBUG}" "LIBS=${LIBS}" \
	"INCL=../${INCL}" "RES=../${RES}" "INDOT=${INDOT}" \
	"LEX=${LEX}" "SHELL=${SHELL}" "LDFLAGS=${LDFLAGS}" \
	"DESTDIR=${DESTDIR}" "PIDDIR=${PIDDIR}" "DESTMAN=${DESTMAN}" \
	"DESTBIN=${DESTBIN}" "DESTSBIN=${DESTSBIN}" "DESTEXEC=${DESTEXEC}" \
	"COMPINCL=../${COMPINCL}" "COMPLIB=../${COMPLIB}" \
	"DESTHELP=${DESTHELP}" 'CATEXT=${CATEXT}'

MACHINE = native
DST = $(MACHINE).b
SRC = ..

SUBDIRS = res include compat tools named man

all clean depend: FRC
	@for x in $(SUBDIRS); do \
		(cd $$x; pwd; $(MAKE) $(MFLAGS) $@); \
	done

install: FRC
	@for x in $(SUBDIRS); do \
		y=`if [ "X$$x" = "Xcompat" ]; \
			then echo ${INSTALL_COMPAT}; \
			else echo install; \
		   fi`; \
		(cd $$x; pwd; $(MAKE) $(MFLAGS) $$y); \
	done

D = OPTIONS master bin doc named CHANGES README compat include res \
	Makefile TODO conf man tools 

copyright: FRC
	bin/copyright <conf/copyright `find ${D} -type f ! -name '*,v' -print`

tar: FRC
	( cd doc/BOG; make file.psf )
	find * -name RCS -print >/tmp/bindtarXf
	gnutar -c -Z -f ../${VER}.`date +%y%m%d`.tar.Z -X /tmp/bindtarXf .
	rm -f /tmp/bindtarXf

patch: FRC
	rm -f patch
	@-set +e; set -x; for x in \
	    `find * -type f -name '*,v' -print \
	     | sed -e 's:RCS/::' -e 's:,v::'`; \
	    do \
		rcsdiff -c2 $(RCSDIFF_OPTS) $$x >>patch; \
	done

links: $(DST)

$(DST): FRC
	@set -ex; mkdir $(DST); cd $(DST); \
	ln -s $(SRC) SRC; \
 	cp SRC/Makefile .; chmod +w Makefile; \
	ln -s SRC/include SRC/conf .; \
	( mkdir tools; cd tools; ln -s ../SRC/tools SRC; \
	  ln -s SRC/*.[ch] .; \
	  cp SRC/Makefile .; chmod +w Makefile; \
	  ( mkdir nslookup; cd nslookup; ln -s ../SRC/nslookup SRC; \
	    cp SRC/Makefile .; chmod +w Makefile; \
	    ln -s SRC/[a-z]* .; \
	  ); \
	); \
	( mkdir res; cd res; ln -s ../SRC/res SRC; \
	  cp SRC/Makefile .; chmod +w Makefile; \
	  ln -s SRC/*.[ch] .; \
	); \
	( mkdir compat; cd compat; ln -s ../SRC/compat SRC; \
	  cp SRC/Makefile .; chmod +w Makefile; \
	  ln -s SRC/include .; \
	  ( mkdir lib; cd lib; ln -s ../SRC/lib SRC; \
	    cp SRC/Makefile .; chmod +w Makefile; \
	    ln -s SRC/*.c .; \
	  ); \
	); \
	( mkdir named; cd named; ln -s ../SRC/named SRC; \
	  cp SRC/Makefile .; chmod +w Makefile; \
	  ln -s SRC/*.[ch] SRC/*.sh .; \
	); \
	( mkdir man; cd man; ln -s ../SRC/man SRC; \
	  cp SRC/Makefile .; chmod +w Makefile; \
	  ln -s SRC/*.[13578] .; \
	)

FRC:
