# Makefile for BIND>=4.9 top level
# vixie@decwrl December, 1992 [original]
#
# $Id: Makefile,v 8.15 1995/07/07 07:33:30 vixie Exp $

## ++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.3-BETA24
SHELL = /bin/sh
MAKE = make
DESTDIR = ${DEBDIR}

LDFLAGS =
CDEBUG = -g
INCL = include
RES = res/libresolv.a
COMPLIB = compat/lib/lib44bsd.a

# The default build parameters are given for 4.4 BSD.  They should
# be overridden for other operating systems as indicated below.

#(BSD4.4, BSD/386, other net2-alikes)
#
# DO NOT COMMENT THESE OUT.  OVERRIDE THEM BELOW.
#
CC = cc $(CPPFLAGS)
CPPFLAGS=
INDOT =
XFER_INDOT =
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
DESTLIB = /usr/lib
DESTINC = /usr/include
COMPINCL = compat/include
LDS = 
CATEXT = 0
INSTALL_COMPAT = install
INSTALL = install
RANLIB = ranlib
AR = ar cru
MANROFF = ( tbl | nroff -man )
MANDIR = cat
PS = ps
IOT = IOT

#(Linux - see doc/info/Linux-and-more for REQUIRED patches)
CC = gcc $(CPPFLAGS)
CPPFLAGS = -DSYSV
LIBS = -lfl
DESTEXEC = /usr/sbin
DESTMAN = /usr/man
DESTHELP = /usr/lib
CATEXT = $$$$N
PS = ps -p
CDEBUG = -O2 -m486 -fomit-frame-pointer -pipe
LEX = flex -8 -I
DESTINC = /usr/include/bind-4.9.3
MANDIR = man

#(CRAY)
#LEX=lex

#(DEC AXP OSF/1 Version 2.1 and earlier)
#CC = cc $(CPPFLAGS) -Olimit 2000
#CPPFLAGS =
#LEX = lex
#LIBS = -ll -lutil
#DESTEXEC = /usr/sbin
#COMPINCL = compat/include
#INSTALL_COMPAT = install-compat
#INSTALL = installbsd
#MANDIR = man
#MANROFF = cat
#CATEXT = $$$$N
#PS = ps -p

#(DEC AXP OSF/1 Version 3.0 and after)
#CC = cc $(CPPFLAGS) -std -Olimit 2000
#CPPFLAGS =
#LEX = lex
#LIBS = -ll -lutil
#DESTEXEC = /usr/sbin
#COMPINCL = compat/include
#INSTALL_COMPAT = install-compat
#INSTALL = installbsd
#MANDIR = man
#MANROFF = cat
#CATEXT = $$$$N
#PS = ps -p

#(irix4)
#CC = cc $(CPPFLAGS) -xansi -signed
#CPPFLAGS = -D__STDC__ -D_BSD_SIGNALS -DSIG_FN=int
#LEX = lex
#LIBS = -ll 
#DESTSBIN = /usr/etc
#DESTEXEC = /usr/etc
#DESTMAN = /usr/catman/local
#DESTHELP = /usr/lib
#INSTALL = bsdinstall.sh
#RANLIB = :
#PS = ps -p
#(bsdinstall.sh is in conf/)

#(irix5)
#CC = cc $(CPPFLAGS) -xansi -signed
#CPPFLAGS = -D__STDC__ -D_BSD_SIGNALS -DSIG_FN=void -D__BIT_TYPES_DEFINED__
#LEX = lex
#LIBS = -ll 
#DESTSBIN = /usr/etc
#DESTEXEC = /usr/etc
#DESTMAN = /usr/share/catman/local
#DESTHELP = /usr/lib
#INSTALL = bsdinstall.sh
#RANLIB = :
#PS = ps -p
#(bsdinstall.sh is in conf/)

#(sunos4.x)
#CC = /usr/bin/cc $(CPPFLAGS)
#CPPFLAGS = -DSUNOS4
#INDOT = in.
#XFER_INDOT = in.
#LEX = lex
#LIBS = -ll
#(add "-ldl" to LIBS if your links fail with "dlopen" problems.  this indicates
# that your libc.so file is screwed up, but it's easier to fix this than that.)
#PIDDIR = /etc
#DESTSBIN = /usr/etc
#DESTEXEC = /usr/etc
#DESTHELP = /usr/lib
#COMPINCL = compat/include
#CATEXT = $$$$N
#INSTALL_COMPAT = install-compat
#INSTALL = install
# for details on shared library building, see shres/INSTALL
#uncomment next line to build a shared library version of libresolv
#SHRES = shres
# uncomment only one of the pairs of lines below
# -- if you use gcc (recommended) (if -fpic doesn't work, see shres/PROBLEMS)
#SHCC = gcc -DSUNOS4 -DSUNSECURITY
#PIC= -fpic -D_res=_res_shlib
# -- if you use Sun's cc
#SHCC = /usr/bin/cc -DSUNOS4 -DSUNSECURITY
#PIC = -pic -D_res=_res_shlib

#(ULTRIX/RISC - also see below)
#CC = cc $(CPPFLAGS) -Olimit 2000

#(ULTRIX, other 4.[23]bsd-alikes)
#CPPFLAGS =
#LEX = lex
#LIBS = -ll
#PIDDIR = /etc
#DESTSBIN = /usr/etc
#DESTEXEC = /usr/etc
#DESTHELP = /usr/lib
#COMPINCL = compat/include
#CATEXT = $$$$N
#INSTALL_COMPAT = install-compat
#INSTALL = install
#DESTMAN = /usr/man
#MANDIR = man
#MANROFF = cat

#(solaris2.c/sunos5.x)
#use same definitions as for sunos4.x except for the following
#be careful with installation - note in particular that the system ships
#with /usr/sbin/in.named (with in.) and /usr/sbin/named-xfer (without in.)
#to emulate this naming, INDOT should be set to 'in.' while XFER_INDOT 
#should be empty. also, under solaris2.x, use 'make install' at your own risk.
#don't include sys/stream.h via netinet/in.h by defining _SYS_STREAM_H.
#PIDDIR = /etc
#LEX = lex
#CC = cc $(CPPFLAGS)
#CPPFLAGS = -DSVR4 -D_SYS_STREAM_H
#INDOT = in.
#XFER_INDOT =
#LIBS = -ll -lnsl -lsocket
#DESTEXEC = /usr/sbin
#LDS = :
#RANLIB = :
#ARPREF = `lorder
#ARSUFF = | tsort`
#CATEXT = $$$$N
#PS = ps -p

#(hpux7.0,hpux8.0,hpux9.0,)
#CC = cc $(CPPFLAGS)
#CPPFLAGS =
#LEX = lex
#LIBS = -ll -lBSD
#PIDDIR = /etc
#DESTSBIN = /etc
#DESTEXEC = /etc
#DESTMAN = /usr/man
#DESTHELP = /usr/lib
#INSTALL = bsdinstall.sh
#RANLIB = :
#MANROFF = cat
#PS = ps -p
#IOT = ABRT
#(bsdinstall.sh is in conf/)

#(apollo domainos)
#CC = cc $(CPPFLAGS)
#CPPFLAGS = -U_APOLLO_SOURCE -D_BSD_SOURCE
#LIBS = -ll 
#DESTSBIN = /etc
#DESTEXEC = /etc
#DESTHELP = /usr/lib
#DESTMAN = /usr/man
#PIDDIR = /etc
#LEX = lex
#PS = /bsd4.3/bin/ps

#(AIX3)
#CC = bsdcc $(CPPFLAGS)
#CPPFLAGS = -DBSD=43
#LIBS = -ll
#DESTEXEC = /usr/sbin
#INSTALL = /usr/ucb/install
#CATEXT = $$$$N
#LEX = lex
#PS = ps -p

# (ConvexOS-10.x)
#CC = gcc $(CPPFLAGS) -g -O2 -fpcc-struct-return -fno-builtin -funsigned-char
#CPPFLAGS =
#INDOT =
#LEX = flex -8 -I
#LIBS = -lfl 
#PIDDIR = /usr/local/etc
#DESTBIN = /usr/local/bin
#DESTSBIN = /usr/local/bin
#DESTEXEC = /usr/local/etc
#DESTMAN = /usr/local/man
#DESTHELP = /usr/local/etc
#DESTLIB = /usr/local/lib
#DESTINC = /usr/local/include
#COMPINCL = compat/include
#LDS = 
#INSTALL_COMPAT = install
#INSTALL = install
#RANLIB = ranlib

#(NEC EWS4800 EWS-UX/V Rel4.0/Rel4.2,UX/4800)
#be careful with installation - note in particular that the system ships
#with /usr/sbin/in.named (with in.) and /usr/sbin/named-xfer (without in.)
#to emulate this naming, INDOT should be set to in. and XFER_INDOT should be
#set to empty. also, under EWS4800, use 'make install' at your own risk. 
#CC = /usr/necccs/bin/cc $(CPPFLAGS)
#CC = /usr/abiccs/bin/cc $(CPPFLAGS)
#CPPFLAGS = -DSVR4 -DUSE_POSIX
#INDOT = in.
#XFER_INDOT =
#LEX = lex
#LIBS = -ll -lnsl -lsocket
#DESTBIN = /usr/local/bin
#DESTSBIN = /etc
#DESTEXEC = /etc
#DESTHELP = /usr/local/lib
#DESTLIB = /usr/local/lib
#DESTINC = /usr/local/include
#DESTMAN = /usr/local/man
#PIDDIR = /etc
#LDS = :
#RANLIB = :
#COMPINCL = compat/include
#CATEXT = $$$$N
#INSTALL_COMPAT = install-compat
#INSTALL = /usr/ucb/install
#PS = ps -p

# SCO Unix 3.4.2 / ODT 3.0 using gcc (the only choice for now)
#CC = gcc $(CPPFLAGS)
#CPPFLAGS = -DSYSV -DSYSV3 
#CDEBUG=-O6
#LDFLAGS=-s
#INDOT=
#LEX=lex
#LIBS=-ll -lnsl_s -lsocket -lc_s
#DESTBIN=/usr/bin
#DESTSBIN = /etc
#DESTEXEC=/etc
#DESTHELP=/usr/lib
#DESTMAN=/usr/local/man
#PIDDIR = /etc
#LDS=:
#RANLIB=:
#COMPINCL=compat/include
#CATEXT = $$$$N
#INSTALL_COMPAT = install-compat
#INSTALL = scoinst
#MANROFF= (tbl | groff -man -Tascii)
#PS = ps -p

#(UNIXWARE 1.1.1)
#CC = cc $(CPPFLAGS)
#CPPFLAGS = -DSVR4 -DBSD_COMP -DUSE_POSIX -D_SYS_STREAM_H
#CDEBUG = -O
#LEX = lex
#INDOT = in.
#XFER_INDOT =
#INSTALL = /usr/ucb/install
#LIBS = -ll -lsocket -lnsl
#DESTSBIN = /usr/sbin
#DESTEXEC = /usr/sbin
#ARPREF = `lorder
#ARSUFF = | tsort`
#CATEXT = $$$$N
#PS = ps -p
#PIDDIR = /etc/inet
#INSTALL_COMPAT = install-compat
#RANLIB = :
#LDS = :
#DESTHELP=/usr/lib

#(NeXTstep 2.0ff, single architecture make)
#CC = cc $(CPPFLAGS) #you can use -O2 for 3.2ff
#CPPFLAGS = -Dpid_t=int
#LIBS = -ll
#LEX = lex
#DESTEXEC = /usr/etc
#DESTHELP = /usr/lib
#DESTMAN = /usr/man
#DESTSBIN = /usr/etc
#PIDDIR = /etc
#MANDIR = man
#CATEXT = $$$$N
#MANROFF = cat
#INSTALL_COMPAT = install-compat

#(NeXTstep 3.2 Multi Architecture Binaries)
#CC = cc $(CPPFLAGS) -O2 -arch i386 -arch m68k -arch hppa
#CPPFLAGS = -Dpid_t=int
#LDS = :
#AR = libtool -o
#RANLIB = :
#LIBS = -ll
#LEX = lex
#DESTEXEC = /usr/etc
#DESTHELP = /usr/lib
#DESTMAN = /usr/man
#DESTSBIN = /usr/etc
#PIDDIR = /etc
#MANDIR = man
#CATEXT = $$$$N
#MANROFF = cat
#INSTALL_COMPAT = install-compat

#(Pyramid dcosx)
#CC = cc $(CPPFLAGS)
#CPPFLAGS = -DSVR4 -DPOSIX_SIGNALS
#LEX = lex
#LIBS = -ll -lnsl -lsocket
#RANLIB = :
#PS = ps -p

#(Sequent Dynix/PTX)
#CC = cc $(CPPFLAGS) -Wc,-pw
#CPPFLAGS = -Du_int=\"unsigned int\" -DSYSV
#RANLIB = :
#LIBS = -ll -lsocket -linet -lnsl -lseq
#PIDDIR = /etc
#DESTSBIN = /usr/local/etc
#DESTEXEC = /usr/local/etc
#DESTHELP = /usr/local/lib
#LEX = lex
#PS = ps -p

#(dgux)
#LEX = lex
#RANLIB =
#CC = gcc $(CPPFLAGS)
#CPPFLAGS = -D__STDC__ -DDGUX
#LIBS = -ll
#DESTBIN = /usr/bin
#DESTSBIN = /usr/bin
#DESTEXEC = /usr/bin
#DESTMAN = /usr/local/man
#DESTHELP = /usr/lib
#DESTLIB = /usr/lib
#DESTINC = /usr/include
#PIDDIR = /etc
#PS = ps -p

#(epix) Has to be compiled and loaded with -systype bsd43
# Epix 2.x.x requires /bsd43/bin in front of the PATH variable
#CC = cc $(CPPFLAGS) -signed -systype bsd43
#CPPFLAGS = -DSTDIN_FILENO=0
#LEX = lex
#LIBS = -ll
#DESTSBIN = /etc/local
#DESTEXEC = /etc/local
#DESTMAN = /usr/local/man
#DESTHELP = /usr/lib
#INSTALL = install.sh
#RANLIB = :
#PS = ps -p

#Mips RISC/os 4.52
#CC = cc $(CPPFLAGS) -systype bsd43
#CPPFLAGS = -Dpid_t=int
#CDEBUG = -O -g3 -Olimit 1000
#LEX = lex
#LIBS = -ll
#PIDDIR = /etc
#DESTBIN = /usr/local/bin
#DESTSBIN = /usr/etc
#DESTEXEC = /usr/etc
#DESTMAN = /usr/local/man
#DESTHELP = /usr/local/lib
#DESTLIB = /usr/local/lib
#DESTINC = /usr/local/include
#PS = ps -p

#Esix SVR4.0.4 with gcc
# also works for Dell 2.2 and other i386 SVR4.0. Probably Unixware 1.1 as well.
#Be careful with installation - note in particular that the system ships
#with /usr/sbin/in.named (with in.) and /usr/sbin/named-xfer (without in.)
#to emulate this naming, INDOT should be set to in. and XFER_INDOT should be
#set to empty. also, use 'make install' at your own risk.
#don't include sys/stream.h via netinet/in.h by defining _SYS_STREAM_H.
#CC = gcc $(CPPFLAGS)
#CPPFLAGS = -DSVR4 -DBSD_COMP -DUSE_POSIX -D_SYS_STREAM_H
#CDEBUG = -O
#LEX = lex
#INDOT = in.
#XFER_INDOT =
#PIDDIR = /etc
#INSTALL = /usr/ucb/install
#LIBS = -ll -lsocket -lnsl
#DESTSBIN = /usr/sbin
#DESTEXEC = /usr/sbin
#LDS = @:
#RANLIB = @:
#ARPREF = `lorder
#ARSUFF = | tsort`
#CATEXT = $$$$N
#PS = ps -p

#(ISC4.0 using GCC)
#CC = gcc -DISC -posix
#CPPFLAGS =
#CDEBUG = -g
#LEX = flex -I
#LIBS = -lbsd
#PIDDIR = /etc
#DESTBIN = /usr/bin
#DESTSBIN = /etc
#DESTEXEC = /etc
#DESTHELP = /etc
#DESTMAN = /usr/catman/l_man
#CATEXT = $$$$N
#RANLIB = @:
#LDS = @:
#PS = ps -p
#ARPREF = `lorder
#ARSUFF = | tsort`

# AUX 3.x (I used 3.1.1)
#CC = gcc $(CPPFLAGS) -O2
#CPPFLAGS = -D_POSIX_SOURCE -DSYSV
#LEX = lex
#LIBS = -ll -lposix -lmalloc -s
#PIDDIR = /etc
#DESTBIN = /etc
#DESTSBIN = /etc
#DESTEXEC = /etc
#DESTMAN = /usr/local/man
#DESTHELP = /etc
#COMPINCL = compat/include
#CATEXT = $$$$N
#INSTALL_COMPAT = install-compat
#INSTALL = install
#RANLIB = @:
#PS = ps -p

#NCR System V/MLS  
#use same definitions as for sunos4.x except for the following
#be careful with installation - note in particular that the system ships
#with /usr/sbin/in.named (with in.) and /usr/sbin/named-xfer (without in.)
#to emulate this naming, INDOT should be set to 'in.' while XFER_INDOT 
#should be empty. also, under solaris2.x, use 'make install' at your own risk.
#don't include sys/stream.h via netinet/in.h by defining _SYS_STREAM_H.
#PIDDIR = /usr/local/lib
#LEX = lex
#CC = cc $(CPPFLAGS)
#CPPFLAGS = -DSVR4 -D_SYS_STREAM_H -Hnocopyr -DPOSIX_SIGNALS -DNCR -w
#INDOT = in.
#XFER_INDOT =
#LIBS = -ll -lnsl -lsocket
#DESTEXEC = /usr/local/bin
#LDS = :
#RANLIB = :
#ARPREF = `lorder
#ARSUFF = | tsort`
#CATEXT = $$$$N
#PS = ps -p

####################################################################
############ no user servicable parts beyond this point ############
####################################################################

MANARGS = \
	"SHELL=${SHELL}" "INDOT=${INDOT}" "XFER_INDOT=${XFER_INDOT}" \
	"DESTDIR=${DESTDIR}" "DESTMAN=${DESTMAN}" "INSTALL=${INSTALL}" \
	CATEXT='${CATEXT}' MANDIR='${MANDIR}' MANROFF='${MANROFF}'

MARGS =	"VER=${VER}" "CC=${CC}" "CDEBUG=${CDEBUG}" "LIBS=${LIBS}" \
	"INCL=../${INCL}" "RES=../${RES}" "LEX=${LEX}" "LDFLAGS=${LDFLAGS}" \
	"PIDDIR=${PIDDIR}" "DESTBIN=${DESTBIN}" "DESTSBIN=${DESTSBIN}" \
	"DESTEXEC=${DESTEXEC}" "COMPINCL=../${COMPINCL}" \
	"COMPLIB=../${COMPLIB}" "DESTLIB=${DESTLIB}" "DESTINC=${DESTINC}" \
	"DESTHELP=${DESTHELP}" "PIC=${PIC}" "SHCC=${SHCC}" "AR=${AR}" \
	"RANLIB=${RANLIB}" "LDS=${LDS}" 'ARPREF=${ARPREF}' \
	'ARSUFF=${ARSUFF}' $(MANARGS) PS="${PS}" "IOT=${IOT}" \
	"CPPFLAGS=${CPPFLAGS}"

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

SUBDIRS = res include compat named tools man $(SHRES)

all:: FRC

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

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

clean:: FRC
	-test -d doc/bog && (cd doc/bog; pwd; $(MAKE) $(MARGS) $@)
	(cd conf; rm -f *~ *.CKP *.BAK *.orig)
	rm -f *~ *.CKP *.BAK *.orig

depend:: FRC

mkdirs: FRC
	-set +e; for x in $(DESTBIN) $(DESTSBIN) $(DESTEXEC) \
		  $(DESTMAN) $(DESTHELP) $(DESTLIB) $(DESTINC); do \
		test -d $$x || mkdir -p $$x; \
	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) $(MARGS) $$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 file.lst )
	find * '(' -name RCS -o -name obj -o -name .depend ')' \
		-print >/tmp/bindXf
	gnutar -c -z -f ../bind-${VER}.tar.gz           -X /tmp/bindXf .
	rm -f /tmp/bindXf

links: $(DST)

$(DST): FRC
	@set -ex; mkdir $(DST); cd $(DST); \
	ln -s $(SRC) SRC; \
	cp SRC/Makefile .; chmod +w Makefile; \
	( mkdir include; cd include; ln -s ../SRC/include SRC; \
	  cp SRC/Makefile .; chmod +w Makefile; \
	  ln -s SRC/*.h SRC/arpa .; \
	); \
	( mkdir conf; cd conf; ln -s ../SRC/conf SRC; \
	  ln -s SRC/*.h .; \
	); \
	( 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 shres; cd shres; ln -s ../SRC/shres SRC; \
	  cp SRC/Makefile .; chmod +w Makefile; \
	  ln -s SRC/makeshlib SRC/*.patch* .; \
	); \
	( mkdir man; cd man; ln -s ../SRC/man SRC; \
	  cp SRC/Makefile .; chmod +w Makefile; \
	  ln -s SRC/*.[0-9] .; \
	)

gcc2-lint: FRC
	@-make CC="gcc2 -Wall -Wno-comment -Wno-parentheses -Dlint" all \
		2>&1 | grep '\.[ch]:[0-9]'

FRC:
	if [ -f compat/include/sys/cdefs.h ]; then \
	  mv compat/include/sys/cdefs.h compat/include/sys/cdefs.h.old; \
	fi
