# Copyright (C) 1998-2001  Internet Software Consortium.
#
# 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.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
# INTERNET SOFTWARE CONSORTIUM 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.

# $Id: Makefile.in,v 1.74 2001/06/01 00:45:00 bwelling Exp $

srcdir =	@srcdir@
VPATH =		@srcdir@
top_srcdir =	@top_srcdir@

@BIND9_VERSION@

@BIND9_INCLUDES@

#
# Add database drivers here.
#
DBDRIVER_OBJS =
DBDRIVER_SRCS =
DBDRIVER_INCLUDES =
DBDRIVER_LIBS =

CINCLUDES =	-I${srcdir}/include -I${srcdir}/unix/include \
		${LWRES_INCLUDES} ${DNS_INCLUDES} \
		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
		${DBDRIVER_INCLUDES}

CDEFINES =
CWARNINGS =

DNSLIBS =	../../lib/dns/libdns.@A@ @DNS_OPENSSL_LIBS@ @DNS_GSSAPI_LIBS@
ISCCFGLIBS =	../../lib/isccfg/libisccfg.@A@
ISCCCLIBS =	../../lib/isccc/libisccc.@A@
ISCLIBS =	../../lib/isc/libisc.@A@
LWRESLIBS =	../../lib/lwres/liblwres.@A@

DNSDEPLIBS =	../../lib/dns/libdns.@A@
ISCCFGDEPLIBS =	../../lib/isccfg/libisccfg.@A@
ISCCCDEPLIBS =	../../lib/isccc/libisccc.@A@
ISCDEPLIBS =	../../lib/isc/libisc.@A@
LWRESDEPLIBS =	../../lib/lwres/liblwres.@A@

DEPLIBS =	${LWRESDEPLIBS} ${DNSDEPLIBS} \
		${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${ISCDEPLIBS}

LIBS =		${LWRESLIBS} ${DNSLIBS} \
		${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} ${DBDRIVER_LIBS} @LIBS@

SUBDIRS =	unix

TARGETS =	named lwresd

OBJS =		aclconf.@O@ client.@O@ config.@O@ control.@O@ controlconf.@O@ interfacemgr.@O@ \
		listenlist.@O@ log.@O@ logconf.@O@ main.@O@ notify.@O@ \
		query.@O@ server.@O@ sortlist.@O@ \
		tkeyconf.@O@ tsigconf.@O@ update.@O@ xfrout.@O@ \
		zoneconf.@O@ \
		lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \
		lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
		$(DBDRIVER_OBJS)

UOBJS =		unix/os.@O@

SRCS =		aclconf.c client.c config.c control.c controlconf.c interfacemgr.c \
		listenlist.c log.c logconf.c main.c notify.c \
		query.c server.c sortlist.c \
		tkeyconf.c tsigconf.c update.c xfrout.c \
		zoneconf.c \
		lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \
		lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \
		$(DBDRIVER_SRCS)

MANPAGES =	named.8 lwresd.8

HTMLPAGES =	named.html lwresd.html

MANOBJS =	${MANPAGES} ${HTMLPAGES}

@BIND9_MAKE_RULES@

main.@O@: main.c
	${LIBTOOL} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
		-DNS_LOCALSTATEDIR=\"${localstatedir}\" \
		-DNS_SYSCONFDIR=\"${sysconfdir}\" -c ${srcdir}/main.c

config.@O@: config.c
	${LIBTOOL} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
		-DNS_LOCALSTATEDIR=\"${localstatedir}\" \
		-c ${srcdir}/config.c

named: ${OBJS} ${UOBJS} ${DEPLIBS}
	${LIBTOOL} ${PURIFY} ${CC} ${CFLAGS} -o $@ ${OBJS} ${UOBJS} ${LIBS}

lwresd: named
	rm -f lwresd
	@LN@ named lwresd

doc man:: ${MANOBJS}

docclean manclean maintainer-clean::
	rm -f ${MANOBJS}

clean distclean maintainer-clean::
	rm -f ${TARGETS}

installdirs:
	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8

install:: named lwresd installdirs
	${LIBTOOL} ${INSTALL_PROGRAM} named ${DESTDIR}${sbindir}
	(cd ${DESTDIR}${sbindir}; rm -f lwresd; @LN@ named lwresd)
	for m in ${MANPAGES}; do ${INSTALL_DATA} ${srcdir}/$$m ${DESTDIR}${mandir}/man8; done
