1238106Sdes# Copyright 2007 NLnet Labs
2238106Sdes# See the file LICENSE for the license
3238106Sdes
4238106SdesSHELL=@SHELL@
5238106SdesVERSION=@PACKAGE_VERSION@
6238106Sdessrcdir=@srcdir@
7238106Sdesprefix=@prefix@
8238106Sdesexec_prefix=@exec_prefix@
9238106Sdesbindir=@bindir@
10238106Sdessbindir=@sbindir@
11238106Sdesmandir=@mandir@
12238106Sdeslibdir=@libdir@
13238106Sdes# datarootdir is here to please some checkers, use datadir.
14238106Sdesdatarootdir=@datarootdir@
15238106Sdesdatadir=@datadir@
16238106Sdesincludedir=@includedir@
17238106Sdesdoxygen=@doxygen@
18238106Sdeslibtool=@libtool@
19238106Sdesstaticexe=@staticexe@
20238106SdesEXEEXT=@EXEEXT@
21238106Sdesconfigfile=@ub_conf_file@
22238106SdesUNBOUND_RUN_DIR=@UNBOUND_RUN_DIR@
23238106SdesCHECKLOCK_SRC=testcode/checklocks.c
24238106SdesCHECKLOCK_OBJ=@CHECKLOCK_OBJ@
25238106SdesWITH_PYTHONMODULE=@WITH_PYTHONMODULE@
26238106SdesWITH_PYUNBOUND=@WITH_PYUNBOUND@
27238106SdesPYTHON_SITE_PKG=@PYTHON_SITE_PKG@
28238106SdesPYTHONMOD_INSTALL=@PYTHONMOD_INSTALL@
29238106SdesPYTHONMOD_UNINSTALL=@PYTHONMOD_UNINSTALL@
30238106SdesPYUNBOUND_INSTALL=@PYUNBOUND_INSTALL@
31238106SdesPYUNBOUND_UNINSTALL=@PYUNBOUND_UNINSTALL@
32269257SdesUNBOUND_EVENT_INSTALL=@UNBOUND_EVENT_INSTALL@
33269257SdesUNBOUND_EVENT_UNINSTALL=@UNBOUND_EVENT_UNINSTALL@
34269257SdesUNBOUND_VERSION_MAJOR=@UNBOUND_VERSION_MAJOR@
35269257SdesUNBOUND_VERSION_MINOR=@UNBOUND_VERSION_MINOR@
36269257SdesUNBOUND_VERSION_MICRO=@UNBOUND_VERSION_MICRO@
37249141SdesALLTARGET=@ALLTARGET@
38269257SdesINSTALLTARGET=@INSTALLTARGET@
39238106Sdes
40238106Sdes# _unbound.la if pyunbound enabled.
41238106SdesPYUNBOUND_TARGET=@PYUNBOUND_TARGET@
42238106Sdes
43238106Sdes# override $U variable which is used by autotools for deansification (for
44238106Sdes# K&R C compilers), but causes problems if $U is defined in the env).
45238106SdesU=
46238106Sdes
47238106SdesSWIG=@SWIG@
48238106SdesYACC=@YACC@
49238106SdesLEX=@LEX@
50238106SdesSTRIP=@STRIP@
51238106SdesCC=@CC@
52238106SdesCPPFLAGS=-I. @CPPFLAGS@
53238106SdesCFLAGS=@CFLAGS@
54238106SdesLDFLAGS=@LDFLAGS@
55238106SdesLIBS=@LIBS@
56238106SdesLIBOBJS=@LIBOBJS@
57238106Sdes# filter out ctime_r from compat obj.
58238106SdesLIBOBJ_WITHOUT_CTIME=@LIBOBJ_WITHOUT_CTIME@
59238106SdesRUNTIME_PATH=@RUNTIME_PATH@
60238106SdesDEPFLAG=@DEPFLAG@
61238106SdesDATE=@CONFIG_DATE@
62238106SdesLIBTOOL=$(libtool)
63238106SdesBUILD=build/
64238106SdesUBSYMS=@UBSYMS@
65238106SdesEXTRALINK=@EXTRALINK@
66238106Sdes
67238106SdesWINDRES=@WINDRES@
68238106SdesLINT=splint
69269257SdesLINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list -formatcode
70238106Sdes#-Dglob64=glob -Dglobfree64=globfree
71238106Sdes# compat with openssl linux edition.
72238106SdesLINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" -D"ECDSA_SIG=DSA_SIG"
73238106Sdes# compat with NetBSD
74238106SdesLINTFLAGS+=@NETBSD_LINTFLAGS@
75238106Sdes# compat with OpenBSD
76238106SdesLINTFLAGS+="-Dsigset_t=long"
77269257Sdes# FreeBSD
78269257SdesLINTFLAGS+="-D__uint16_t=uint16_t" "-DEVP_PKEY_ASN1_METHOD=int"
79238106Sdes
80238106SdesINSTALL=$(srcdir)/install-sh
81238106Sdes
82238106Sdes#pythonmod.c is not here, it is mentioned by itself in its own rules,
83238106Sdes#makedepend fails on missing interface.h otherwise.
84238106SdesPYTHONMOD_SRC=pythonmod/pythonmod_utils.c
85238106Sdes# pythonmod.lo pythonmod_utils.lo if python mod enabled.
86238106SdesPYTHONMOD_OBJ=@PYTHONMOD_OBJ@
87238106SdesPYTHONMOD_HEADER=@PYTHONMOD_HEADER@
88238106Sdes# libunbound/python/libunbound_wrap.c is dealt with by its own rules.
89238106SdesPYUNBOUND_SRC=
90238106Sdes# libunbound_wrap.lo if python libunbound wrapper enabled.
91238106SdesPYUNBOUND_OBJ=@PYUNBOUND_OBJ@
92238106SdesCOMMON_SRC=services/cache/dns.c services/cache/infra.c services/cache/rrset.c \
93238106Sdesutil/data/dname.c util/data/msgencode.c util/data/msgparse.c \
94238106Sdesutil/data/msgreply.c util/data/packed_rrset.c iterator/iterator.c \
95238106Sdesiterator/iter_delegpt.c iterator/iter_donotq.c iterator/iter_fwd.c \
96238106Sdesiterator/iter_hints.c iterator/iter_priv.c iterator/iter_resptype.c \
97238106Sdesiterator/iter_scrub.c iterator/iter_utils.c services/listen_dnsport.c \
98238106Sdesservices/localzone.c services/mesh.c services/modstack.c \
99238106Sdesservices/outbound_list.c services/outside_network.c util/alloc.c \
100238106Sdesutil/config_file.c util/configlexer.c util/configparser.c \
101238106Sdesutil/fptr_wlist.c util/locks.c util/log.c util/mini_event.c util/module.c \
102238106Sdesutil/netevent.c util/net_help.c util/random.c util/rbtree.c util/regional.c \
103238106Sdesutil/rtt.c util/storage/dnstree.c util/storage/lookup3.c \
104238106Sdesutil/storage/lruhash.c util/storage/slabhash.c util/timehist.c util/tube.c \
105238106Sdesutil/winsock_event.c validator/autotrust.c validator/val_anchor.c \
106238106Sdesvalidator/validator.c validator/val_kcache.c validator/val_kentry.c \
107238106Sdesvalidator/val_neg.c validator/val_nsec3.c validator/val_nsec.c \
108249141Sdesvalidator/val_secalgo.c validator/val_sigcrypt.c \
109249141Sdesvalidator/val_utils.c $(CHECKLOCK_SRC)
110238106SdesCOMMON_OBJ_WITHOUT_NETCALL=dns.lo infra.lo rrset.lo dname.lo msgencode.lo \
111238106Sdesmsgparse.lo msgreply.lo packed_rrset.lo iterator.lo iter_delegpt.lo \
112238106Sdesiter_donotq.lo iter_fwd.lo iter_hints.lo iter_priv.lo iter_resptype.lo \
113238106Sdesiter_scrub.lo iter_utils.lo localzone.lo mesh.lo modstack.lo \
114238106Sdesoutbound_list.lo alloc.lo config_file.lo configlexer.lo configparser.lo \
115238106Sdesfptr_wlist.lo locks.lo log.lo mini_event.lo module.lo net_help.lo \
116238106Sdesrandom.lo rbtree.lo regional.lo rtt.lo dnstree.lo lookup3.lo lruhash.lo \
117238106Sdesslabhash.lo timehist.lo tube.lo winsock_event.lo autotrust.lo val_anchor.lo \
118238106Sdesvalidator.lo val_kcache.lo val_kentry.lo val_neg.lo val_nsec3.lo val_nsec.lo \
119249141Sdesval_secalgo.lo val_sigcrypt.lo val_utils.lo $(PYTHONMOD_OBJ) $(CHECKLOCK_OBJ)
120238106SdesCOMMON_OBJ=$(COMMON_OBJ_WITHOUT_NETCALL) netevent.lo listen_dnsport.lo \
121238106Sdesoutside_network.lo
122238106Sdes# set to $COMMON_OBJ or to "" if --enableallsymbols
123238106SdesCOMMON_OBJ_ALL_SYMBOLS=@COMMON_OBJ_ALL_SYMBOLS@
124238106SdesCOMPAT_SRC=compat/ctime_r.c compat/fake-rfc2553.c compat/gmtime_r.c \
125238106Sdescompat/inet_aton.c compat/inet_ntop.c compat/inet_pton.c compat/malloc.c \
126269257Sdescompat/memcmp.c compat/memmove.c compat/snprintf.c compat/strlcat.c \
127269257Sdescompat/strlcpy.c compat/strptime.c
128238106SdesCOMPAT_OBJ=$(LIBOBJS:.o=.lo)
129238106SdesCOMPAT_OBJ_WITHOUT_CTIME=$(LIBOBJ_WITHOUT_CTIME:.o=.lo)
130269257SdesSLDNS_SRC=ldns/keyraw.c ldns/sbuffer.c ldns/wire2str.c ldns/parse.c \
131269257Sdesldns/parseutil.c ldns/rrdef.c ldns/str2wire.c
132269257SdesSLDNS_OBJ=keyraw.lo sbuffer.lo wire2str.lo parse.lo parseutil.lo rrdef.lo \
133269257Sdesstr2wire.lo
134238106SdesUNITTEST_SRC=testcode/unitanchor.c testcode/unitdname.c \
135238106Sdestestcode/unitlruhash.c testcode/unitmain.c testcode/unitmsgparse.c \
136238106Sdestestcode/unitneg.c testcode/unitregional.c testcode/unitslabhash.c \
137269257Sdestestcode/unitverify.c testcode/readhex.c testcode/testpkts.c testcode/unitldns.c
138238106SdesUNITTEST_OBJ=unitanchor.lo unitdname.lo unitlruhash.lo unitmain.lo \
139238106Sdesunitmsgparse.lo unitneg.lo unitregional.lo unitslabhash.lo unitverify.lo \
140269257Sdesreadhex.lo testpkts.lo unitldns.lo
141269257SdesUNITTEST_OBJ_LINK=$(UNITTEST_OBJ) worker_cb.lo $(COMMON_OBJ) $(SLDNS_OBJ) \
142269257Sdes$(COMPAT_OBJ)
143238106SdesDAEMON_SRC=daemon/acl_list.c daemon/cachedump.c daemon/daemon.c \
144238106Sdesdaemon/remote.c daemon/stats.c daemon/unbound.c daemon/worker.c @WIN_DAEMON_SRC@
145238106SdesDAEMON_OBJ=acl_list.lo cachedump.lo daemon.lo remote.lo stats.lo unbound.lo \
146238106Sdesworker.lo @WIN_DAEMON_OBJ@
147269257SdesDAEMON_OBJ_LINK=$(DAEMON_OBJ) $(COMMON_OBJ_ALL_SYMBOLS) $(SLDNS_OBJ) \
148238106Sdes$(COMPAT_OBJ) @WIN_DAEMON_OBJ_LINK@
149238106SdesCHECKCONF_SRC=smallapp/unbound-checkconf.c smallapp/worker_cb.c
150238106SdesCHECKCONF_OBJ=unbound-checkconf.lo worker_cb.lo
151269257SdesCHECKCONF_OBJ_LINK=$(CHECKCONF_OBJ) $(COMMON_OBJ_ALL_SYMBOLS) $(SLDNS_OBJ) \
152238106Sdes$(COMPAT_OBJ) @WIN_CHECKCONF_OBJ_LINK@
153238106SdesCONTROL_SRC=smallapp/unbound-control.c
154238106SdesCONTROL_OBJ=unbound-control.lo 
155238106SdesCONTROL_OBJ_LINK=$(CONTROL_OBJ) worker_cb.lo $(COMMON_OBJ_ALL_SYMBOLS) \
156269257Sdes$(SLDNS_OBJ) $(COMPAT_OBJ) @WIN_CONTROL_OBJ_LINK@
157238106SdesHOST_SRC=smallapp/unbound-host.c
158238106SdesHOST_OBJ=unbound-host.lo
159269257SdesHOST_OBJ_LINK=$(HOST_OBJ) $(SLDNS_OBJ) $(COMPAT_OBJ_WITHOUT_CTIME) @WIN_HOST_OBJ_LINK@
160238106SdesUBANCHOR_SRC=smallapp/unbound-anchor.c
161238106SdesUBANCHOR_OBJ=unbound-anchor.lo
162238106SdesUBANCHOR_OBJ_LINK=$(UBANCHOR_OBJ) \
163238106Sdes$(COMPAT_OBJ_WITHOUT_CTIME) @WIN_UBANCHOR_OBJ_LINK@
164269257SdesTESTBOUND_SRC=testcode/testbound.c testcode/testpkts.c \
165238106Sdesdaemon/worker.c daemon/acl_list.c daemon/daemon.c daemon/stats.c \
166238106Sdestestcode/replay.c testcode/fake_event.c
167238106SdesTESTBOUND_OBJ=testbound.lo replay.lo fake_event.lo
168269257SdesTESTBOUND_OBJ_LINK=$(TESTBOUND_OBJ) testpkts.lo worker.lo acl_list.lo \
169269257Sdesdaemon.lo stats.lo $(COMMON_OBJ_WITHOUT_NETCALL) $(SLDNS_OBJ) $(COMPAT_OBJ)
170238106SdesLOCKVERIFY_SRC=testcode/lock_verify.c
171238106SdesLOCKVERIFY_OBJ=lock_verify.lo
172269257SdesLOCKVERIFY_OBJ_LINK=$(LOCKVERIFY_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \
173269257Sdes$(SLDNS_OBJ)
174238106SdesPETAL_SRC=testcode/petal.c
175238106SdesPETAL_OBJ=petal.lo
176238106SdesPETAL_OBJ_LINK=$(PETAL_OBJ) $(COMPAT_OBJ_WITHOUT_CTIME)
177238106SdesPKTVIEW_SRC=testcode/pktview.c testcode/readhex.c
178238106SdesPKTVIEW_OBJ=pktview.lo
179238106SdesPKTVIEW_OBJ_LINK=$(PKTVIEW_OBJ) worker_cb.lo readhex.lo $(COMMON_OBJ) \
180269257Sdes$(COMPAT_OBJ) $(SLDNS_OBJ)
181238106SdesMEMSTATS_SRC=testcode/memstats.c
182238106SdesMEMSTATS_OBJ=memstats.lo
183269257SdesMEMSTATS_OBJ_LINK=$(MEMSTATS_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \
184269257Sdes$(SLDNS_OBJ)
185238106SdesASYNCLOOK_SRC=testcode/asynclook.c
186238106SdesASYNCLOOK_OBJ=asynclook.lo
187238106SdesASYNCLOOK_OBJ_LINK=$(ASYNCLOOK_OBJ) log.lo locks.lo $(COMPAT_OBJ)
188238106SdesSTREAMTCP_SRC=testcode/streamtcp.c
189238106SdesSTREAMTCP_OBJ=streamtcp.lo
190269257SdesSTREAMTCP_OBJ_LINK=$(STREAMTCP_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \
191269257Sdes$(SLDNS_OBJ)
192238106SdesPERF_SRC=testcode/perf.c
193238106SdesPERF_OBJ=perf.lo
194269257SdesPERF_OBJ_LINK=$(PERF_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) $(SLDNS_OBJ)
195238106SdesDELAYER_SRC=testcode/delayer.c
196238106SdesDELAYER_OBJ=delayer.lo
197269257SdesDELAYER_OBJ_LINK=$(DELAYER_OBJ) worker_cb.lo $(COMMON_OBJ) $(COMPAT_OBJ) \
198269257Sdes$(SLDNS_OBJ)
199238106SdesLIBUNBOUND_SRC=libunbound/context.c libunbound/libunbound.c \
200238106Sdeslibunbound/libworker.c
201238106SdesLIBUNBOUND_OBJ=context.lo libunbound.lo libworker.lo
202269257SdesLIBUNBOUND_OBJ_LINK=$(LIBUNBOUND_OBJ) $(COMMON_OBJ) $(SLDNS_OBJ) $(COMPAT_OBJ)
203238106Sdes
204238106Sdes# win apps or "" if not on windows
205238106SdesWINAPPS=@WINAPPS@
206238106SdesWIN_DAEMON_THE_SRC=winrc/win_svc.c winrc/w_inst.c
207238106SdesSVCINST_SRC=winrc/unbound-service-install.c
208238106SdesSVCINST_OBJ=unbound-service-install.lo
209238106SdesSVCINST_OBJ_LINK=$(SVCINST_OBJ) w_inst.lo rsrc_svcinst.o $(COMPAT_OBJ_WITHOUT_CTIME)
210238106SdesSVCUNINST_SRC=winrc/unbound-service-remove.c
211238106SdesSVCUNINST_OBJ=unbound-service-remove.lo
212238106SdesSVCUNINST_OBJ_LINK=$(SVCUNINST_OBJ) w_inst.lo rsrc_svcuninst.o \
213238106Sdes$(COMPAT_OBJ_WITHOUT_CTIME)
214238106SdesANCHORUPD_SRC=winrc/anchor-update.c
215238106SdesANCHORUPD_OBJ=anchor-update.lo
216238106SdesANCHORUPD_OBJ_LINK=$(ANCHORUPD_OBJ) rsrc_anchorupd.o $(COMPAT_OBJ_WITHOUT_CTIME)
217238106SdesRSRC_OBJ=rsrc_svcinst.o rsrc_svcuninst.o rsrc_anchorupd.o rsrc_unbound.o \
218238106Sdes	rsrc_unbound_host.o rsrc_unbound_anchor.o rsrc_unbound_control.o \
219238106Sdes	rsrc_unbound_checkconf.o
220238106Sdes
221238106SdesALL_SRC=$(COMMON_SRC) $(UNITTEST_SRC) $(DAEMON_SRC) \
222269257Sdes	$(TESTBOUND_SRC) $(LOCKVERIFY_SRC) $(PKTVIEW_SRC) \
223238106Sdes	$(MEMSTATS_SRC) $(CHECKCONF_SRC) $(LIBUNBOUND_SRC) $(HOST_SRC) \
224238106Sdes	$(ASYNCLOOK_SRC) $(STREAMTCP_SRC) $(PERF_SRC) $(DELAYER_SRC) \
225269257Sdes	$(CONTROL_SRC) $(UBANCHOR_SRC) $(PETAL_SRC) \
226238106Sdes	$(PYTHONMOD_SRC) $(PYUNBOUND_SRC) $(WIN_DAEMON_THE_SRC)\
227269257Sdes	$(SVCINST_SRC) $(SVCUNINST_SRC) $(ANCHORUPD_SRC) $(SLDNS_SRC)
228238106SdesALL_OBJ=$(COMMON_OBJ) $(UNITTEST_OBJ) $(DAEMON_OBJ) \
229269257Sdes	$(TESTBOUND_OBJ) $(LOCKVERIFY_OBJ) $(PKTVIEW_OBJ) \
230238106Sdes	$(MEMSTATS_OBJ) $(CHECKCONF_OBJ) $(LIBUNBOUND_OBJ) $(HOST_OBJ) \
231238106Sdes	$(ASYNCLOOK_OBJ) $(STREAMTCP_OBJ) $(PERF_OBJ) $(DELAYER_OBJ) \
232269257Sdes	$(CONTROL_OBJ) $(UBANCHOR_OBJ) $(PETAL_OBJ) \
233238106Sdes	$(COMPAT_OBJ) $(PYUNBOUND_OBJ) \
234269257Sdes	$(SVCINST_OBJ) $(SVCUNINST_OBJ) $(ANCHORUPD_OBJ) $(SLDNS_OBJ)
235238106Sdes
236238106SdesCOMPILE=$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS)
237238106SdesLINK=$(LIBTOOL) --tag=CC --mode=link $(CC) $(staticexe) $(RUNTIME_PATH) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
238238106SdesLINK_LIB=$(LIBTOOL) --tag=CC --mode=link $(CC) $(RUNTIME_PATH) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(staticexe) -version-info @LIBUNBOUND_CURRENT@:@LIBUNBOUND_REVISION@:@LIBUNBOUND_AGE@ -no-undefined
239238106Sdes
240249141Sdes.PHONY:	clean realclean doc lint all install uninstall tests test strip lib longtest longcheck check alltargets
241238106Sdes
242249141Sdesall:	$(COMMON_OBJ) $(ALLTARGET)
243238106Sdes
244249141Sdesalltargets:	unbound$(EXEEXT) unbound-checkconf$(EXEEXT) lib unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-anchor$(EXEEXT) unbound-control-setup $(WINAPPS) $(PYUNBOUND_TARGET)
245249141Sdes
246238106Sdes# compat with BSD make, register suffix, and an implicit rule to actualise it.
247238106Sdes.SUFFIXES: .lo
248238106Sdes.c.lo:
249238106Sdes	$(COMPILE) -o $@ -c $<
250238106Sdes
251238106Sdes$(ALL_OBJ):
252238106Sdes	@@SOURCEDETERMINE@
253238106Sdes	$(COMPILE) -o $@ -c @SOURCEFILE@
254238106Sdes
255238106Sdes$(RSRC_OBJ):
256238106Sdes	@@SOURCEDETERMINE@
257238106Sdes	$(WINDRES) $(CPPFLAGS) @SOURCEFILE@ $@
258238106Sdes
259238106Sdesrsrc_svcinst.o:	$(srcdir)/winrc/rsrc_svcinst.rc config.h
260238106Sdesrsrc_svcuninst.o:	$(srcdir)/winrc/rsrc_svcuninst.rc config.h
261238106Sdesrsrc_anchorupd.o:	$(srcdir)/winrc/rsrc_anchorupd.rc config.h
262238106Sdesrsrc_unbound.o:	$(srcdir)/winrc/rsrc_unbound.rc config.h
263238106Sdesrsrc_unbound_host.o:	$(srcdir)/winrc/rsrc_unbound_host.rc config.h
264238106Sdesrsrc_unbound_anchor.o:	$(srcdir)/winrc/rsrc_unbound_anchor.rc config.h
265238106Sdesrsrc_unbound_control.o:	$(srcdir)/winrc/rsrc_unbound_control.rc config.h
266238106Sdesrsrc_unbound_checkconf.o:	$(srcdir)/winrc/rsrc_unbound_checkconf.rc config.h
267238106Sdes
268269257SdesTEST_BIN=asynclook$(EXEEXT) delayer$(EXEEXT) \
269238106Sdes	lock-verify$(EXEEXT) memstats$(EXEEXT) perf$(EXEEXT) \
270269257Sdes	petal$(EXEEXT) pktview$(EXEEXT) streamtcp$(EXEEXT) \
271238106Sdes	testbound$(EXEEXT) unittest$(EXEEXT)
272238106Sdestests:	all $(TEST_BIN)
273238106Sdes
274238106Sdescheck: test
275238106Sdeslongcheck: longtest
276238106Sdes
277238106Sdestest:	unittest$(EXEEXT) testbound$(EXEEXT)
278238106Sdes	./unittest$(EXEEXT)
279238106Sdes	./testbound$(EXEEXT) -s
280238106Sdes	for x in testdata/*.rpl; do echo -n "$$x "; if ./testbound$(EXEEXT) -p $$x >/dev/null 2>&1; then echo OK; else echo failed; exit 1; fi done
281238106Sdes	@echo test OK
282238106Sdes
283238106Sdeslongtest:	tests
284238106Sdes	if test -x "`which bash`"; then bash testcode/do-tests.sh; else sh testcode/do-tests.sh; fi
285238106Sdes
286269257Sdeslib:	libunbound.la unbound.h
287238106Sdes
288238106Sdeslibunbound.la:	$(LIBUNBOUND_OBJ_LINK)
289238106Sdes	$(LINK_LIB) $(UBSYMS) -o $@ $(LIBUNBOUND_OBJ_LINK) -rpath $(libdir) -lssl $(LIBS)
290238106Sdes
291238106Sdesunbound$(EXEEXT):	$(DAEMON_OBJ_LINK) libunbound.la
292238106Sdes	$(LINK) -o $@ $(DAEMON_OBJ_LINK) $(EXTRALINK) -lssl $(LIBS)
293238106Sdes
294238106Sdesunbound-checkconf$(EXEEXT):	$(CHECKCONF_OBJ_LINK) libunbound.la
295238106Sdes	$(LINK) -o $@ $(CHECKCONF_OBJ_LINK) $(EXTRALINK) -lssl $(LIBS)
296238106Sdes
297238106Sdesunbound-control$(EXEEXT):	$(CONTROL_OBJ_LINK) libunbound.la
298238106Sdes	$(LINK) -o $@ $(CONTROL_OBJ_LINK) $(EXTRALINK) -lssl $(LIBS)
299238106Sdes
300238106Sdesunbound-host$(EXEEXT):	$(HOST_OBJ_LINK) libunbound.la
301238106Sdes	$(LINK) -o $@ $(HOST_OBJ_LINK) -L. -L.libs -lunbound $(LIBS)
302238106Sdes
303238106Sdesunbound-anchor$(EXEEXT):	$(UBANCHOR_OBJ_LINK) libunbound.la
304238106Sdes	$(LINK) -o $@ $(UBANCHOR_OBJ_LINK) -L. -L.libs -lunbound -lexpat -lssl $(LIBS)
305238106Sdes
306238106Sdesunbound-service-install$(EXEEXT):	$(SVCINST_OBJ_LINK)
307238106Sdes	$(LINK) -o $@ $(SVCINST_OBJ_LINK) $(LIBS)
308238106Sdes
309238106Sdesunbound-service-remove$(EXEEXT):	$(SVCUNINST_OBJ_LINK)
310238106Sdes	$(LINK) -o $@ $(SVCUNINST_OBJ_LINK) $(LIBS)
311238106Sdes
312238106Sdesanchor-update$(EXEEXT):  $(ANCHORUPD_OBJ_LINK) libunbound.la
313238106Sdes	$(LINK) -o $@ $(ANCHORUPD_OBJ_LINK) -L. -L.libs -lunbound $(LIBS)
314238106Sdes
315238106Sdesunittest$(EXEEXT):	$(UNITTEST_OBJ_LINK)
316238106Sdes	$(LINK) -o $@ $(UNITTEST_OBJ_LINK) -lssl $(LIBS)
317238106Sdes
318238106Sdestestbound$(EXEEXT):	$(TESTBOUND_OBJ_LINK)
319238106Sdes	$(LINK) -o $@ $(TESTBOUND_OBJ_LINK) -lssl $(LIBS)
320238106Sdes
321238106Sdeslock-verify$(EXEEXT):	$(LOCKVERIFY_OBJ_LINK)
322238106Sdes	$(LINK) -o $@ $(LOCKVERIFY_OBJ_LINK) -lssl $(LIBS)
323238106Sdes
324238106Sdespetal$(EXEEXT):	$(PETAL_OBJ_LINK)
325238106Sdes	$(LINK) -o $@ $(PETAL_OBJ_LINK) -lssl $(LIBS)
326238106Sdes
327238106Sdespktview$(EXEEXT):	$(PKTVIEW_OBJ_LINK)
328238106Sdes	$(LINK) -o $@ $(PKTVIEW_OBJ_LINK) -lssl $(LIBS)
329238106Sdes
330238106Sdesmemstats$(EXEEXT):	$(MEMSTATS_OBJ_LINK)
331238106Sdes	$(LINK) -o $@ $(MEMSTATS_OBJ_LINK) -lssl $(LIBS)
332238106Sdes
333238106Sdesasynclook$(EXEEXT):	$(ASYNCLOOK_OBJ_LINK) libunbound.la
334238106Sdes	$(LINK) -o $@ $(ASYNCLOOK_OBJ_LINK) $(LIBS) -L. -L.libs -lunbound
335238106Sdes
336238106Sdesstreamtcp$(EXEEXT):	$(STREAMTCP_OBJ_LINK)
337238106Sdes	$(LINK) -o $@ $(STREAMTCP_OBJ_LINK) -lssl $(LIBS)
338238106Sdes
339238106Sdesperf$(EXEEXT):	$(PERF_OBJ_LINK)
340238106Sdes	$(LINK) -o $@ $(PERF_OBJ_LINK) -lssl $(LIBS)
341238106Sdes
342238106Sdesdelayer$(EXEEXT):	$(DELAYER_OBJ_LINK)
343238106Sdes	$(LINK) -o $@ $(DELAYER_OBJ_LINK) -lssl $(LIBS)
344238106Sdes
345269257Sdessignit$(EXEEXT):	testcode/signit.c
346269257Sdes	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ testcode/signit.c $(LDFLAGS) -lldns -lssl $(LIBS)
347238106Sdes
348269257Sdesunbound.h:	$(srcdir)/libunbound/unbound.h
349269257Sdes	sed -e 's/@''UNBOUND_VERSION_MAJOR@/$(UNBOUND_VERSION_MAJOR)/' -e 's/@''UNBOUND_VERSION_MINOR@/$(UNBOUND_VERSION_MINOR)/' -e 's/@''UNBOUND_VERSION_MICRO@/$(UNBOUND_VERSION_MICRO)/' < $(srcdir)/libunbound/unbound.h > $@
350269257Sdes
351238106Sdesunbound-control-setup:	$(srcdir)/smallapp/unbound-control-setup.sh
352238106Sdes	sed -e 's:^DESTDIR=.*$$:DESTDIR=$(UNBOUND_RUN_DIR):' < $(srcdir)/smallapp/unbound-control-setup.sh > $@
353238106Sdes	-chmod +x $@
354238106Sdes
355238106Sdes# Python Module
356238106Sdespythonmod.lo pythonmod.o: $(srcdir)/pythonmod/pythonmod.c config.h \
357238106Sdes	pythonmod/interface.h \
358238106Sdes	$(srcdir)/pythonmod/pythonmod.h $(srcdir)/util/module.h \
359238106Sdes	$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h \
360238106Sdes	$(srcdir)/util/log.h $(srcdir)/util/data/msgreply.h \
361238106Sdes	$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/data/msgparse.h \
362238106Sdes	$(srcdir)/services/outbound_list.h $(srcdir)/util/config_file.h \
363238106Sdes	$(srcdir)/pythonmod/pythonmod_utils.h $(srcdir)/util/netevent.h \
364238106Sdes	$(srcdir)/util/regional.h $(srcdir)/util/data/dname.h \
365238106Sdes	$(srcdir)/services/cache/dns.h $(srcdir)/services/mesh.h \
366238106Sdes	$(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h
367238106Sdes
368249141Sdespythonmod/interface.h:	$(srcdir)/pythonmod/interface.i config.h
369238106Sdes	@-if test ! -d pythonmod; then $(INSTALL) -d pythonmod; fi
370238106Sdes	$(SWIG) $(CPPFLAGS) -o $@ -python $(srcdir)/pythonmod/interface.i
371238106Sdes
372238106Sdeslibunbound_wrap.lo libunbound_wrap.o: libunbound/python/libunbound_wrap.c \
373269257Sdes	unbound.h
374269257Sdeslibunbound/python/libunbound_wrap.c:	$(srcdir)/libunbound/python/libunbound.i unbound.h
375238106Sdes	@-if test ! -d libunbound/python; then $(INSTALL) -d libunbound/python; fi
376238106Sdes	$(SWIG) -python -o $@ $(CPPFLAGS) $(srcdir)/libunbound/python/libunbound.i
377238106Sdes
378238106Sdes# Pyunbound python unbound wrapper
379238106Sdes_unbound.la:	libunbound_wrap.lo libunbound.la
380238106Sdes	$(LIBTOOL) --tag=CC --mode=link $(CC) $(RUNTIME_PATH) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -module -version-info @LIBUNBOUND_CURRENT@:@LIBUNBOUND_REVISION@:@LIBUNBOUND_AGE@ -no-undefined -o $@ libunbound_wrap.lo -rpath $(PYTHON_SITE_PKG) L. -L.libs -lunbound $(LIBS)
381238106Sdes
382238106Sdesutil/config_file.c:	util/configparser.h
383238106Sdesutil/configlexer.c:  $(srcdir)/util/configlexer.lex util/configparser.h
384238106Sdes	@-if test ! -d util; then $(INSTALL) -d util; fi
385238106Sdes	if test "$(LEX)" != ":"; then \
386238106Sdes		echo "#include \"config.h\"" > $@ ;\
387238106Sdes		echo "#include \"util/configyyrename.h\"" >> $@ ;\
388238106Sdes		$(LEX) -t $(srcdir)/util/configlexer.lex >> $@ ;\
389238106Sdes	fi
390238106Sdes
391238106Sdesutil/configparser.c util/configparser.h:  $(srcdir)/util/configparser.y
392238106Sdes	@-if test ! -d util; then $(INSTALL) -d util; fi
393238106Sdes	$(YACC) -d -o util/configparser.c $(srcdir)/util/configparser.y
394238106Sdes
395238106Sdesclean:
396238106Sdes	rm -f *.o *.d *.lo *~ tags
397269257Sdes	rm -f unbound$(EXEEXT) unbound-checkconf$(EXEEXT) unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-anchor$(EXEEXT) unbound-control-setup libunbound.la unbound.h
398238106Sdes	rm -f $(ALL_SRC:.c=.lint)
399249141Sdes	rm -f _unbound.la libunbound/python/libunbound_wrap.c libunbound/python/unbound.py pythonmod/interface.h pythonmod/unboundmodule.py
400238106Sdes	rm -rf autom4te.cache .libs build doc/html doc/xml
401238106Sdes
402238106Sdesrealclean: clean
403238106Sdes	rm -f config.status config.log config.h.in config.h
404238106Sdes	rm -f configure config.sub config.guess ltmain.sh aclocal.m4 libtool
405238106Sdes	rm -f util/configlexer.c util/configparser.c util/configparser.h
406249141Sdes	rm -f doc/example.conf doc/libunbound.3 doc/unbound-anchor.8 doc/unbound-checkconf.8 doc/unbound-control.8 doc/unbound.8 doc/unbound.conf.5
407238106Sdes	rm -f $(TEST_BIN)
408238106Sdes	rm -f Makefile 
409238106Sdes
410238106Sdes.SUFFIXES: .lint
411238106Sdes.c.lint:
412269257Sdes	$(LINT) $(LINTFLAGS) -I. -I$(srcdir) $<
413238106Sdes	touch $@
414238106Sdes
415238106Sdesutil/configparser.lint util/configlexer.lint pythonmod/pythonmod.lint libunbound/python/libunbound_wrap.lint:
416238106Sdes	# skip lint for generated code
417238106Sdes	touch $@
418238106Sdes
419238106Sdeswinrc/win_svc.lint winrc/w_inst.lint winrc/unbound-service-install.lint winrc/unbound-service-remove.lint:
420238106Sdes	# skip lint for windows types
421238106Sdes	touch $@
422238106Sdes
423238106Sdeslint:	$(ALL_SRC:.c=.lint)
424238106Sdes
425238106Sdestags:	$(srcdir)/*.[ch] $(srcdir)/*/*.[ch]
426238106Sdes	ctags  -f $(srcdir)/tags $(srcdir)/*.[ch] $(srcdir)/*/*.[ch]
427238106Sdes
428238106Sdesdoc:
429238106Sdes	if test -n "$(doxygen)"; then \
430238106Sdes		$(doxygen) $(srcdir)/doc/unbound.doxygen; fi
431238106Sdes	if test "$(WITH_PYUNBOUND)" = "yes" -o "$(WITH_PYTHONMODULE)" = "yes"; \
432238106Sdes	    then if test -x "`which sphinx-build 2>&1`"; then \
433238106Sdes		sphinx-build -b html pythonmod/doc doc/html/pythonmod; \
434238106Sdes		sphinx-build -b html libunbound/python/doc doc/html/pyunbound;\
435238106Sdes	    fi ;\
436238106Sdes	fi
437238106Sdes
438238106Sdesstrip:
439238106Sdes	$(STRIP) unbound$(EXEEXT)
440238106Sdes	$(STRIP) unbound-checkconf$(EXEEXT)
441238106Sdes	$(STRIP) unbound-control$(EXEEXT)
442238106Sdes	$(STRIP) unbound-host$(EXEEXT)
443238106Sdes	$(STRIP) unbound-anchor$(EXEEXT)
444238106Sdes
445238106Sdespythonmod-install:
446238106Sdes	$(INSTALL) -m 755 -d $(DESTDIR)$(PYTHON_SITE_PKG)
447238106Sdes	$(INSTALL) -c -m 644 pythonmod/unboundmodule.py $(DESTDIR)$(PYTHON_SITE_PKG)/unboundmodule.py
448238106Sdes
449238106Sdespyunbound-install:
450238106Sdes	$(INSTALL) -m 755 -d $(DESTDIR)$(PYTHON_SITE_PKG)
451249141Sdes	$(INSTALL) -c -m 644 $(srcdir)/libunbound/python/unbound.py $(DESTDIR)$(PYTHON_SITE_PKG)/unbound.py
452238106Sdes	$(LIBTOOL) --mode=install cp _unbound.la $(DESTDIR)$(PYTHON_SITE_PKG)
453238106Sdes	$(LIBTOOL) --mode=finish $(DESTDIR)$(PYTHON_SITE_PKG)
454238106Sdes
455269257Sdesunbound-event-install:
456269257Sdes	$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)
457269257Sdes	$(LIBTOOL) --mode=install cp $(srcdir)/libunbound/unbound-event.h $(DESTDIR)$(includedir)/unbound-event.h
458269257Sdes
459269257Sdesinstall:	$(INSTALLTARGET)
460269257Sdes
461269257Sdesinstall-lib:	lib $(UNBOUND_EVENT_INSTALL)
462269257Sdes	$(INSTALL) -m 755 -d $(DESTDIR)$(libdir)
463269257Sdes	$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)
464269257Sdes	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)
465269257Sdes	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man3
466269257Sdes	$(INSTALL) -c -m 644 doc/libunbound.3 $(DESTDIR)$(mandir)/man3
467269257Sdes	for mpage in ub_ctx ub_result ub_ctx_create ub_ctx_delete \
468269257Sdes		ub_ctx_set_option ub_ctx_get_option ub_ctx_config ub_ctx_set_fwd \
469269257Sdes		ub_ctx_resolvconf ub_ctx_hosts ub_ctx_add_ta ub_ctx_add_ta_file \
470269257Sdes		ub_ctx_trustedkeys ub_ctx_debugout ub_ctx_debuglevel ub_ctx_async \
471269257Sdes		ub_poll ub_wait ub_fd ub_process ub_resolve ub_resolve_async ub_cancel \
472269257Sdes		ub_resolve_free ub_strerror ub_ctx_print_local_zones ub_ctx_zone_add \
473269257Sdes		ub_ctx_zone_remove ub_ctx_data_add ub_ctx_data_remove; \
474269257Sdes	do \
475269257Sdes		echo ".so man3/libunbound.3" > $(DESTDIR)$(mandir)/man3/$$mpage.3 ; \
476269257Sdes	done
477269257Sdes	$(LIBTOOL) --mode=install cp unbound.h $(DESTDIR)$(includedir)/unbound.h
478269257Sdes	$(LIBTOOL) --mode=install cp libunbound.la $(DESTDIR)$(libdir)
479269257Sdes	$(LIBTOOL) --mode=finish $(DESTDIR)$(libdir)
480269257Sdes
481269257Sdesinstall-all:	all $(PYTHONMOD_INSTALL) $(PYUNBOUND_INSTALL) $(UNBOUND_EVENT_INSTALL) install-lib
482238106Sdes	$(INSTALL) -m 755 -d $(DESTDIR)$(sbindir)
483238106Sdes	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)
484238106Sdes	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man8
485238106Sdes	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man5
486238106Sdes	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
487238106Sdes	$(LIBTOOL) --mode=install cp unbound$(EXEEXT) $(DESTDIR)$(sbindir)/unbound$(EXEEXT)
488238106Sdes	$(LIBTOOL) --mode=install cp unbound-checkconf$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-checkconf$(EXEEXT)
489238106Sdes	$(LIBTOOL) --mode=install cp unbound-control$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control$(EXEEXT)
490238106Sdes	$(LIBTOOL) --mode=install cp unbound-host$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-host$(EXEEXT)
491238106Sdes	$(LIBTOOL) --mode=install cp unbound-anchor$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-anchor$(EXEEXT)
492238106Sdes	$(INSTALL) -c -m 644 doc/unbound.8 $(DESTDIR)$(mandir)/man8
493238106Sdes	$(INSTALL) -c -m 644 doc/unbound-checkconf.8 $(DESTDIR)$(mandir)/man8
494238106Sdes	$(INSTALL) -c -m 644 doc/unbound-control.8 $(DESTDIR)$(mandir)/man8
495269257Sdes	$(INSTALL) -c -m 644 doc/unbound-control.8 $(DESTDIR)$(mandir)/man8/unbound-control-setup.8
496238106Sdes	$(INSTALL) -c -m 644 doc/unbound-anchor.8 $(DESTDIR)$(mandir)/man8
497238106Sdes	$(INSTALL) -c -m 644 doc/unbound.conf.5 $(DESTDIR)$(mandir)/man5
498238106Sdes	$(INSTALL) -c -m 644 $(srcdir)/doc/unbound-host.1 $(DESTDIR)$(mandir)/man1
499238106Sdes	$(INSTALL) -c -m 755 unbound-control-setup $(DESTDIR)$(sbindir)/unbound-control-setup
500238106Sdes	if test ! -e $(DESTDIR)$(configfile); then $(INSTALL) -d `dirname $(DESTDIR)$(configfile)`; $(INSTALL) -c -m 644 doc/example.conf $(DESTDIR)$(configfile); fi
501238106Sdes
502238106Sdespythonmod-uninstall:
503238106Sdes	rm -f -- $(DESTDIR)$(PYTHON_SITE_PKG)/unboundmodule.py
504238106Sdes
505238106Sdespyunbound-uninstall:
506238106Sdes	rm -f -- $(DESTDIR)$(PYTHON_SITE_PKG)/unbound.py
507238106Sdes	$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(PYTHON_SITE_PKG)/_unbound.la
508238106Sdes
509269257Sdesunbound-event-uninstall:
510269257Sdes	rm -f -- $(DESTDIR)$(includedir)/unbound-event.h
511269257Sdes
512269257Sdesuninstall:	$(PYTHONMOD_UNINSTALL) $(PYUNBOUND_UNINSTALL) $(UNBOUND_EVENT_UNINSTALL)
513238106Sdes	rm -f -- $(DESTDIR)$(sbindir)/unbound$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-checkconf$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-host$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-anchor$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control-setup
514269257Sdes	rm -f -- $(DESTDIR)$(mandir)/man8/unbound.8 $(DESTDIR)$(mandir)/man8/unbound-checkconf.8 $(DESTDIR)$(mandir)/man5/unbound.conf.5 $(DESTDIR)$(mandir)/man8/unbound-control.8 $(DESTDIR)$(mandir)/man8/unbound-anchor.8 $(DESTDIR)$(mandir)/man8/unbound-control-setup.8
515238106Sdes	rm -f -- $(DESTDIR)$(mandir)/man1/unbound-host.1 $(DESTDIR)$(mandir)/man3/libunbound.3
516249141Sdes	for mpage in ub_ctx ub_result ub_ctx_create ub_ctx_delete \
517249141Sdes		ub_ctx_set_option ub_ctx_get_option ub_ctx_config ub_ctx_set_fwd \
518249141Sdes		ub_ctx_resolvconf ub_ctx_hosts ub_ctx_add_ta ub_ctx_add_ta_file \
519249141Sdes		ub_ctx_trustedkeys ub_ctx_debugout ub_ctx_debuglevel ub_ctx_async \
520249141Sdes		ub_poll ub_wait ub_fd ub_process ub_resolve ub_resolve_async ub_cancel \
521249141Sdes		ub_resolve_free ub_strerror ub_ctx_print_local_zones ub_ctx_zone_add \
522249141Sdes		ub_ctx_zone_remove ub_ctx_data_add ub_ctx_data_remove; \
523249141Sdes	do \
524249141Sdes		rm -f -- $(DESTDIR)$(mandir)/man3/$$mpage.3 ; \
525249141Sdes	done
526238106Sdes	rm -f -- $(DESTDIR)$(includedir)/unbound.h
527238106Sdes	$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/libunbound.la
528238106Sdes	@echo
529238106Sdes	@echo "You still need to remove "`dirname $(DESTDIR)$(configfile)`" , $(DESTDIR)$(configfile) by hand"
530238106Sdes
531238106Sdesiana_update:
532238106Sdes	curl -o port-numbers.tmp http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml --compressed
533238106Sdes	if file port-numbers.tmp | grep 'gzip' >/dev/null; then zcat port-numbers.tmp; else cat port-numbers.tmp; fi | awk '/<record>/ {p=0;} /<protocol>udp/ {p=1;} /<protocol>[^u]/ {p=0;} /Decomissioned|Decommissioned|Removed|De-registered|unassigned|Unassigned|Reserved/ {u=1;} /<number>/ { if(u==1) {u=0;} else { if(p==1) { match($$0,/[0-9]+/); print substr($$0, RSTART, RLENGTH) ","}}}' | sort -nu > util/iana_ports.inc  
534238106Sdes	rm -f port-numbers.tmp
535238106Sdes
536238106Sdes# dependency generation
537238106SdesDEPEND_TMP=depend1073.tmp
538238106SdesDEPEND_TMP2=depend1074.tmp
539238106SdesDEPEND_TARGET=Makefile
540238106SdesDEPEND_TARGET2=Makefile.in
541238106Sdes# actions: generate deplines from gcc,
542238106Sdes# then, filter out home/xx, /usr/xx and /opt/xx lines (some cc already do this)
543238106Sdes# then, remove empty " \" lines
544238106Sdes# then, add srcdir before .c and .h in deps.
545238106Sdes# then, remove srcdir from the (generated) parser and lexer.
546238106Sdes# and mention the .lo
547238106Sdesdepend:
548238106Sdes	(cd $(srcdir) ; $(CC) $(DEPFLAG) $(CPPFLAGS) $(CFLAGS) $(ALL_SRC) $(COMPAT_SRC)) | \
549238106Sdes		sed -e 's!'$$HOME'[^ ]* !!g' -e 's!'$$HOME'[^ ]*$$!!g' \
550238106Sdes			-e 's!/usr[^ ]* !!g' -e 's!/usr[^ ]*$$!!g' \
551238106Sdes			-e 's!/opt[^ ]* !!g' -e 's!/opt[^ ]*$$!!g' | \
552238106Sdes		sed -e '/^ \\$$/d' | \
553238106Sdes		sed -e 's? *\([^ ]*\.[ch]\)? $$(srcdir)/\1?g' | \
554238106Sdes		sed -e 's? *\([^ ]*\.inc\)? $$(srcdir)/\1?g' | \
555238106Sdes		sed -e 's?$$(srcdir)/config.h?config.h?g' \
556238106Sdes			-e 's?$$(srcdir)/util/configlexer.c?util/configlexer.c?g' \
557238106Sdes			-e 's?$$(srcdir)/util/configparser.c?util/configparser.c?g' \
558238106Sdes			-e 's?$$(srcdir)/util/configparser.h?util/configparser.h?g' \
559238106Sdes			-e 's?$$(srcdir)/pythonmod/pythonmod.h?$$(PYTHONMOD_HEADER)?g' \
560238106Sdes			-e 's!\(.*\)\.o[ :]*!\1.lo \1.o: !g' \
561238106Sdes			> $(DEPEND_TMP)
562238106Sdes	cp $(DEPEND_TARGET) $(DEPEND_TMP2)
563238106Sdes	head -`egrep -n "# Dependencies" $(DEPEND_TARGET) | tail -1 | sed -e 's/:.*$$//'` $(DEPEND_TMP2) > $(DEPEND_TARGET)
564238106Sdes	cat $(DEPEND_TMP) >> $(DEPEND_TARGET)
565238106Sdes	@if diff $(DEPEND_TARGET) $(DEPEND_TMP2); then echo "	$(DEPEND_TARGET) unchanged"; else echo "	Updated $(DEPEND_TARGET))"; fi
566238106Sdes	@if test -f $(DEPEND_TARGET2); then \
567238106Sdes		cp $(DEPEND_TARGET2) $(DEPEND_TMP2); \
568238106Sdes		head -`egrep -n "# Dependencies" $(DEPEND_TARGET2) | tail -1 | sed -e 's/:.*$$//'` $(DEPEND_TMP2) > $(DEPEND_TARGET2); \
569238106Sdes		cat $(DEPEND_TMP) >> $(DEPEND_TARGET2); \
570238106Sdes		if diff $(DEPEND_TARGET2) $(DEPEND_TMP2); then echo "	$(DEPEND_TARGET2) unchanged"; else echo "	Updated $(DEPEND_TARGET2))"; fi; \
571238106Sdes	fi
572238106Sdes	rm -f $(DEPEND_TMP) $(DEPEND_TMP2)
573238106Sdes
574238106Sdes# Dependencies
575