# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.

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

VERSION=@BIND9_VERSION@
@BIND9_MAJOR@

@LIBNS_API@

@BIND9_MAKE_INCLUDES@

USE_ISC_SPNEGO = @USE_ISC_SPNEGO@

CINCLUDES =	-I. -I${top_srcdir}/lib/ns -Iinclude \
		${NS_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES} \
		${OPENSSL_CFLAGS} @DST_GSSAPI_INC@

CDEFINES =	-DNAMED_PLUGINDIR=\"${plugindir}\"

CWARNINGS =

ISCLIBS =	../../lib/isc/libisc.@A@ ${OPENSSL_LIBS} ${JSON_C_LIBS} ${LIBXML2_LIBS} ${ZLIB_LIBS}

ISCDEPLIBS =	../../lib/isc/libisc.@A@

DNSLIBS =	../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@

DNSDEPLIBS =	../../lib/dns/libdns.@A@

LIBS =		@LIBS@

# Alphabetically
OBJS =		client.@O@ hooks.@O@ interfacemgr.@O@ lib.@O@ \
		listenlist.@O@ log.@O@ notify.@O@ query.@O@ \
		server.@O@ sortlist.@O@ stats.@O@ update.@O@ \
		version.@O@ xfrout.@O@

SRCS =		client.c hooks.c interfacemgr.c lib.c listenlist.c \
		log.c notify.c query.c server.c sortlist.c stats.c \
		update.c version.c xfrout.c

SUBDIRS =	include
TESTDIRS =	@UNITTESTS@
TARGETS =	timestamp

SO_CFLAGS =	@CFLAGS@ @SO_CFLAGS@
SO_LDFLAGS =	@LDFLAGS@ @SO_LDFLAGS@

@BIND9_MAKE_RULES@

version.@O@: version.c
	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
		-DVERSION=\"${VERSION}\" \
		-DMAJOR=\"${MAJOR}\" \
		-DLIBINTERFACE=${LIBINTERFACE} \
		-DLIBREVISION=${LIBREVISION} \
		-DLIBAGE=${LIBAGE} \
		-c ${srcdir}/version.c

libns.@SA@: ${OBJS}
	${AR} ${ARFLAGS} $@ ${OBJS}
	${RANLIB} $@

libns.la: ${OBJS}
	${LIBTOOL_MODE_LINK} \
		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libns.la -rpath ${libdir} \
		-version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
		${OBJS} ${ISCLIBS} @DNS_CRYPTO_LIBS@ ${LIBS}

timestamp: libns.@A@
	touch timestamp

installdirs:
	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}

install:: timestamp installdirs
	${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libns.@A@ \
		${DESTDIR}${libdir}

uninstall::
	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libns.@A@

clean distclean::
	rm -f libns.@A@ timestamp
