1# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
2#
3# SPDX-License-Identifier: MPL-2.0
4#
5# This Source Code Form is subject to the terms of the Mozilla Public
6# License, v. 2.0.  If a copy of the MPL was not distributed with this
7# file, you can obtain one at https://mozilla.org/MPL/2.0/.
8#
9# See the COPYRIGHT file distributed with this work for additional
10# information regarding copyright ownership.
11
12srcdir =	@srcdir@
13VPATH =		@srcdir@
14top_srcdir =	@top_srcdir@
15
16# Attempt to disable parallel processing.
17.NOTPARALLEL:
18.NO_PARALLEL:
19
20VERSION=@BIND9_VERSION@
21@BIND9_MAJOR@
22
23@LIBDNS_MAPAPI@
24
25@BIND9_MAKE_INCLUDES@
26
27CINCLUDES =	-I. -I${top_srcdir}/lib/dns -Iinclude ${DNS_INCLUDES} \
28		${ISC_INCLUDES} \
29		${FSTRM_CFLAGS} \
30		${OPENSSL_CFLAGS} @DST_GSSAPI_INC@ \
31		${PROTOBUF_C_CFLAGS} \
32		${JSON_C_CFLAGS} \
33		${LIBXML2_CFLAGS} \
34		${LMDB_CFLAGS} \
35		${MAXMINDDB_CFLAGS}
36
37CDEFINES =	@USE_GSSAPI@
38
39CWARNINGS =
40
41ISCLIBS =	../../lib/isc/libisc.@A@ @NO_LIBTOOL_ISCLIBS@
42
43ISCDEPLIBS =	../../lib/isc/libisc.@A@
44
45LIBS =		${FSTRM_LIBS} ${MAXMINDDB_LIBS} ${LMDB_LIBS} ${PROTOBUF_C_LIBS} @LIBS@
46
47# Alphabetically
48
49DSTOBJS =	@DST_EXTRA_OBJS@ \
50		dst_api.@O@ dst_parse.@O@ dst_result.@O@ \
51		gssapi_link.@O@ gssapictx.@O@ hmac_link.@O@ \
52		openssl_link.@O@ openssldh_link.@O@ \
53		opensslecdsa_link.@O@ openssleddsa_link.@O@ opensslrsa_link.@O@ \
54		pkcs11rsa_link.@O@ \
55		pkcs11ecdsa_link.@O@ pkcs11eddsa_link.@O@ pkcs11.@O@ \
56		key.@O@
57
58GEOIP2LINKOBJS = geoip2.@O@
59
60DNSTAPOBJS = dnstap.@O@ dnstap.pb-c.@O@
61
62# Alphabetically
63DNSOBJS =	acl.@O@ adb.@O@ badcache.@O@ byaddr.@O@ \
64		cache.@O@ callbacks.@O@ catz.@O@ clientinfo.@O@ compress.@O@ \
65		db.@O@ dbiterator.@O@ dbtable.@O@ diff.@O@ dispatch.@O@ \
66		dlz.@O@ dns64.@O@ dnsrps.@O@ dnssec.@O@ ds.@O@ dyndb.@O@ \
67		ecs.@O@ fixedname.@O@ forward.@O@ \
68		ipkeylist.@O@ iptable.@O@ journal.@O@ kasp.@O@ keydata.@O@ \
69		keymgr.@O@ keytable.@O@ lib.@O@ log.@O@ lookup.@O@ \
70		master.@O@ masterdump.@O@ message.@O@ \
71		name.@O@ ncache.@O@ nsec.@O@ nsec3.@O@ nta.@O@ \
72		order.@O@ peer.@O@ portlist.@O@ private.@O@ \
73		rbt.@O@ rbtdb.@O@ rcode.@O@ rdata.@O@ \
74		rdatalist.@O@ rdataset.@O@ rdatasetiter.@O@ rdataslab.@O@ \
75		request.@O@ resolver.@O@ result.@O@ rootns.@O@ \
76		rpz.@O@ rrl.@O@ rriterator.@O@ sdb.@O@ \
77		sdlz.@O@ soa.@O@ ssu.@O@ ssu_external.@O@ \
78		stats.@O@ tcpmsg.@O@ time.@O@ timer.@O@ tkey.@O@ \
79		tsec.@O@ tsig.@O@ ttl.@O@ update.@O@ validator.@O@ \
80		version.@O@ view.@O@ xfrin.@O@ zone.@O@ zonekey.@O@ \
81		zoneverify.@O@ zt.@O@
82PORTDNSOBJS =	client.@O@ ecdb.@O@
83
84OBJS=		@DNSTAPOBJS@ ${DNSOBJS} ${OTHEROBJS} ${DSTOBJS} \
85		${PORTDNSOBJS} @GEOIP2LINKOBJS@
86
87DSTSRCS =	@DST_EXTRA_SRCS@ \
88		dst_api.c dst_parse.c \
89		dst_result.c gssapi_link.c gssapictx.c hmac_link.c \
90		openssl_link.c openssldh_link.c \
91		opensslecdsa_link.c openssleddsa_link.c opensslrsa_link.c \
92		pkcs11rsa_link.c \
93		pkcs11ecdsa_link.c pkcs11eddsa_link.c pkcs11.c \
94		key.c
95
96GEOIPL2INKSRCS = geoip2.c
97
98DNSTAPSRCS = dnstap.c dnstap.pb-c.c
99
100DNSSRCS =	acl.c adb.c badcache.c byaddr.c \
101		cache.c callbacks.c clientinfo.c compress.c \
102		db.c dbiterator.c dbtable.c diff.c dispatch.c \
103		dlz.c dns64.c dnsrps.c dnssec.c ds.c dyndb.c \
104		ecs.c fixedname.c forward.c ipkeylist.c iptable.c \
105		journal.c kasp.c keydata.c keymgr.c keytable.c \
106		lib.c log.c lookup.c master.c masterdump.c message.c \
107		name.c ncache.c nsec.c nsec3.c nta.c \
108		order.c peer.c portlist.c \
109		rbt.c rbtdb.c rcode.c rdata.c rdatalist.c \
110		rdataset.c rdatasetiter.c rdataslab.c request.c \
111		resolver.c result.c rootns.c rpz.c rrl.c rriterator.c \
112		sdb.c sdlz.c soa.c ssu.c ssu_external.c \
113		stats.c tcpmsg.c time.c timer.c tkey.c \
114		tsec.c tsig.c ttl.c update.c validator.c \
115		version.c view.c xfrin.c zone.c zoneverify.c \
116		zonekey.c zt.c ${OTHERSRCS}
117PORTDNSSRCS =	client.c ecdb.c
118
119SRCS = ${DSTSRCS} ${DNSSRCS} \
120	${PORTDNSSRCS} @DNSTAPSRCS@ @GEOIP2LINKSRCS@
121
122SUBDIRS =	include
123TARGETS =	timestamp
124TESTDIRS =	@UNITTESTS@
125
126DEPENDEXTRA =	./gen -F include/dns/rdatastruct.h \
127		-s ${srcdir} -d >> Makefile ;
128
129@BIND9_MAKE_RULES@
130
131PROTOC_C = @PROTOC_C@
132
133version.@O@: version.c
134	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
135		-DVERSION=\"${VERSION}\" \
136		-DMAJOR=\"${MAJOR}\" \
137		-DMAPAPI=\"${MAPAPI}\" \
138		-c ${srcdir}/version.c
139
140libdns.@SA@: ${OBJS}
141	${AR} ${ARFLAGS} $@ ${OBJS}
142	${RANLIB} $@
143
144libdns.la: ${OBJS}
145	${LIBTOOL_MODE_LINK} \
146		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libdns.la -rpath ${libdir} \
147		-release "${VERSION}" \
148		${OBJS} ${ISCLIBS} @DNS_CRYPTO_LIBS@ ${LIBS}
149
150include: gen
151	${MAKE} include/dns/enumtype.h
152	${MAKE} include/dns/enumclass.h
153	${MAKE} include/dns/rdatastruct.h
154	${MAKE} code.h
155
156include/dns/enumtype.h: gen
157	./gen -s ${srcdir} -t > $@ || { rm -f $@ ; exit 1; }
158
159include/dns/enumclass.h: gen
160	./gen -s ${srcdir} -c > $@ || { rm -f $@ ; exit 1; }
161
162include/dns/rdatastruct.h: gen \
163		${srcdir}/rdata/rdatastructpre.h \
164		${srcdir}/rdata/rdatastructsuf.h
165	./gen -s ${srcdir} -i \
166		-P ${srcdir}/rdata/rdatastructpre.h \
167		-S ${srcdir}/rdata/rdatastructsuf.h > $@ || \
168	{ rm -f $@ ; exit 1; }
169
170code.h:	gen
171	./gen -s ${srcdir} > code.h || { rm -f $@ ; exit 1; }
172
173gen: gen.c
174	${BUILD_CC} ${BUILD_CFLAGS} -I${top_srcdir}/lib/isc/include \
175	${LFS_CFLAGS} ${LFS_LDFLAGS} \
176	${BUILD_CPPFLAGS} ${BUILD_LDFLAGS} -o $@ ${srcdir}/gen.c \
177	${BUILD_LIBS} ${LFS_LIBS}
178
179timestamp: include libdns.@A@
180	touch timestamp
181
182testdirs: libdns.@A@
183
184installdirs:
185	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
186
187install:: timestamp installdirs
188	${LIBTOOL_MODE_INSTALL} ${INSTALL_LIBRARY} libdns.@A@ ${DESTDIR}${libdir}
189
190uninstall::
191	${LIBTOOL_MODE_UNINSTALL} rm -f ${DESTDIR}${libdir}/libdns.@A@
192
193clean distclean::
194	rm -f libdns.@A@ timestamp
195	rm -f gen code.h include/dns/enumtype.h include/dns/enumclass.h
196	rm -f include/dns/rdatastruct.h
197	rm -f dnstap.pb-c.c dnstap.pb-c.h
198
199newrr::
200	rm -f code.h include/dns/enumtype.h include/dns/enumclass.h
201	rm -f include/dns/rdatastruct.h
202
203rdata.@O@: include
204
205depend: include @DNSTAPSRCS@
206subdirs: include
207${OBJS}: include
208
209# dnstap
210dnstap.@O@: dnstap.c dnstap.pb-c.c
211
212dnstap.pb-c.c dnstap.pb-c.h: dnstap.proto
213	$(PROTOC_C) --c_out=. --proto_path ${srcdir} dnstap.proto
214
215dnstap.pb-c.@O@: dnstap.pb-c.c
216