File: Makefile.in

package info (click to toggle)
unbound 1.4.6-1+squeeze3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 15,700 kB
  • ctags: 5,590
  • sloc: ansic: 56,606; sh: 10,753; yacc: 1,100; python: 1,086; makefile: 447; perl: 141
file content (452 lines) | stat: -rw-r--r-- 18,400 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# Copyright 2007 NLnet Labs
# See the file LICENSE for the license

debug_enabled=@debug_enabled@
ifeq "$(QUIET)" ""
ifeq ($(debug_enabled),yes)
  QUIET=yes
  LIBTOOLQUIET=yes
else
  QUIET=no
  LIBTOOLQUIET=yes
endif
endif

ifeq "$(QUIET)" "yes"
  Q=@
  INFO=@echo
else
  Q=
  INFO=@:
endif

SHELL=@SHELL@
VERSION=@PACKAGE_VERSION@
srcdir=@srcdir@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
sbindir=@sbindir@
mandir=@mandir@
libdir=@libdir@
# datarootdir is here to please some checkers, use datadir.
datarootdir=@datarootdir@
datadir=@datadir@
includedir=@includedir@
doxygen=@doxygen@
libtool=@libtool@
ldnsdir=@ldnsdir@
staticexe=@staticexe@
EXEEXT=@EXEEXT@
configfile=@ub_conf_file@
UNBOUND_RUN_DIR=@UNBOUND_RUN_DIR@
CHECKLOCK_SRC=@CHECKLOCK_SRC@
UB_ON_WINDOWS=@UB_ON_WINDOWS@
WITH_PYTHONMODULE=@WITH_PYTHONMODULE@
WITH_PYUNBOUND=@WITH_PYUNBOUND@
PYTHON_SITE_PKG=@PYTHON_SITE_PKG@

SWIG=@SWIG@
YACC=@YACC@
LEX=@LEX@
STRIP=@STRIP@
CC=@CC@
CPPFLAGS=-I. @CPPFLAGS@
ifneq "$(srcdir)" "."
  CPPFLAGS:=-I$(srcdir) $(CPPFLAGS)
endif
CPPFLAGS:=$(strip $(CPPFLAGS))
CFLAGS=@CFLAGS@
LDFLAGS=@LDFLAGS@
LIBS=$(strip @LIBS@)
LIBOBJS=@LIBOBJS@
RUNTIME_PATH=@RUNTIME_PATH@
DEPFLAG=@DEPFLAG@
DATE=$(shell date +%Y%m%d)
LIBTOOL=$(libtool)
ifeq "$(LIBTOOLQUIET)" "yes"
  LIBTOOL+=--quiet
endif
BUILD=build/

WINDRES=@WINDRES@
LINT=splint
LINTFLAGS=+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 -Dglob64=glob -Dglobfree64=globfree
# compat with openssl linux edition.
LINTFLAGS+="-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"
# compat with NetBSD
ifeq "$(shell uname)" "NetBSD"
LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_
endif
# compat with OpenBSD
LINTFLAGS+="-Dsigset_t=long"
# FreeBSD8
LINTFLAGS+="-D__uint16_t=uint16_t"

INSTALL=$(srcdir)/install-sh
ifeq "$(WITH_PYTHONMODULE)" "yes"
PYTHONMOD_SRC=$(srcdir)/pythonmod/*.c
endif

COMMON_SRC=$(patsubst $(srcdir)/%,%, $(wildcard $(srcdir)/services/*.c \
	$(srcdir)/services/cache/*.c $(srcdir)/util/*.c \
	$(srcdir)/util/data/*.c $(srcdir)/util/storage/*.c \
	$(srcdir)/iterator/*.c $(srcdir)/validator/*.c $(PYTHONMOD_SRC))) \
	util/configparser.c util/configlexer.c $(CHECKLOCK_SRC)
COMMON_OBJ=$(addprefix $(BUILD),$(COMMON_SRC:.c=.lo))
COMPAT_SRC=$(addprefix compat/,$(LIBOBJS:.o=.c))
COMPAT_OBJ=$(addprefix $(BUILD)compat/,$(LIBOBJS:.o=.lo))
UNITTEST_SRC=$(patsubst $(srcdir)/%,%, \
	$(wildcard $(srcdir)/testcode/unit*.c)) \
	testcode/readhex.c testcode/ldns-testpkts.c smallapp/worker_cb.c \
	$(COMMON_SRC)
UNITTEST_OBJ=$(addprefix $(BUILD),$(UNITTEST_SRC:.c=.lo)) $(COMPAT_OBJ)
DAEMON_SRC=$(patsubst $(srcdir)/%,%, $(wildcard $(srcdir)/daemon/*.c)) \
	$(COMMON_SRC)
DAEMON_OBJ=$(addprefix $(BUILD),$(DAEMON_SRC:.c=.lo)) $(COMPAT_OBJ)
CHECKCONF_SRC=smallapp/unbound-checkconf.c smallapp/worker_cb.c $(COMMON_SRC)
CHECKCONF_OBJ=$(addprefix $(BUILD),$(CHECKCONF_SRC:.c=.lo)) $(COMPAT_OBJ)
CONTROL_SRC=smallapp/unbound-control.c smallapp/worker_cb.c $(COMMON_SRC)
CONTROL_OBJ=$(addprefix $(BUILD),$(CONTROL_SRC:.c=.lo)) $(COMPAT_OBJ)
HOST_SRC=smallapp/unbound-host.c
HOST_OBJ=$(addprefix $(BUILD),$(HOST_SRC:.c=.lo)) $(filter-out $(BUILD)compat/ctime_r.lo, $(COMPAT_OBJ))
TESTBOUND_SRC=testcode/testbound.c testcode/ldns-testpkts.c \
	daemon/worker.c daemon/acl_list.c daemon/daemon.c daemon/stats.c \
	testcode/replay.c testcode/fake_event.c $(filter-out util/netevent.c \
	services/listen_dnsport.c services/outside_network.c, $(COMMON_SRC))
TESTBOUND_OBJ=$(addprefix $(BUILD),$(TESTBOUND_SRC:.c=.lo)) $(COMPAT_OBJ)
LOCKVERIFY_SRC=testcode/lock_verify.c smallapp/worker_cb.c $(COMMON_SRC)
LOCKVERIFY_OBJ=$(addprefix $(BUILD),$(LOCKVERIFY_SRC:.c=.lo)) $(COMPAT_OBJ)
PKTVIEW_SRC=testcode/pktview.c testcode/readhex.c smallapp/worker_cb.c \
	$(COMMON_SRC)
PKTVIEW_OBJ=$(addprefix $(BUILD),$(PKTVIEW_SRC:.c=.lo)) $(COMPAT_OBJ)
SIGNIT_SRC=testcode/signit.c smallapp/worker_cb.c $(COMMON_SRC)
SIGNIT_OBJ=$(addprefix $(BUILD),$(SIGNIT_SRC:.c=.lo)) $(COMPAT_OBJ)
MEMSTATS_SRC=testcode/memstats.c smallapp/worker_cb.c $(COMMON_SRC)
MEMSTATS_OBJ=$(addprefix $(BUILD),$(MEMSTATS_SRC:.c=.lo)) $(COMPAT_OBJ)
ASYNCLOOK_SRC=testcode/asynclook.c util/log.c util/locks.c
ASYNCLOOK_OBJ=$(addprefix $(BUILD),$(ASYNCLOOK_SRC:.c=.lo)) $(COMPAT_OBJ)
STREAMTCP_SRC=testcode/streamtcp.c smallapp/worker_cb.c $(COMMON_SRC)
STREAMTCP_OBJ=$(addprefix $(BUILD),$(STREAMTCP_SRC:.c=.lo)) $(COMPAT_OBJ)
PERF_SRC=testcode/perf.c smallapp/worker_cb.c $(COMMON_SRC)
PERF_OBJ=$(addprefix $(BUILD),$(PERF_SRC:.c=.lo)) $(COMPAT_OBJ)
DELAYER_SRC=testcode/delayer.c smallapp/worker_cb.c $(COMMON_SRC)
DELAYER_OBJ=$(addprefix $(BUILD),$(DELAYER_SRC:.c=.lo)) $(COMPAT_OBJ)
HARVEST_SRC=testcode/harvest.c
HARVEST_OBJ=$(addprefix $(BUILD),$(HARVEST_SRC:.c=.lo)) $(COMPAT_OBJ)
LIBUNBOUND_SRC=$(patsubst $(srcdir)/%,%, \
	$(wildcard $(srcdir)/libunbound/*.c) $(COMMON_SRC))
LIBUNBOUND_OBJ=$(addprefix $(BUILD),$(LIBUNBOUND_SRC:.c=.lo)) $(COMPAT_OBJ)
ALL_SRC=$(sort $(COMMON_SRC) $(UNITTEST_SRC) $(DAEMON_SRC) \
	$(TESTBOUND_SRC) $(LOCKVERIFY_SRC) $(PKTVIEW_SRC) $(SIGNIT_SRC) \
	$(MEMSTATS_SRC) $(CHECKCONF_SRC) $(LIBUNBOUND_SRC) $(HOST_SRC) \
	$(ASYNCLOOK_SRC) $(STREAMTCP_SRC) $(PERF_SRC) $(DELAYER_SRC) \
	$(HARVEST_SRC) $(CONTROL_SRC))
ALL_OBJ=$(addprefix $(BUILD),$(ALL_SRC:.c=.lo) \
	$(addprefix compat/,$(LIBOBJS:.o=.lo))) $(COMPAT_OBJ)

ifeq "$(UB_ON_WINDOWS)" "yes"
  DAEMON_SRC+=winrc/win_svc.c winrc/w_inst.c
  DAEMON_OBJ+=$(BUILD)winrc/rsrc_unbound.o $(BUILD)winrc/win_svc.lo
  HOST_OBJ+=$(BUILD)winrc/rsrc_unbound_host.o
  CONTROL_OBJ+=$(BUILD)winrc/rsrc_unbound_control.o
  CHECKCONF_OBJ+=$(BUILD)winrc/rsrc_unbound_checkconf.o

  WINAPPS=$(addsuffix $(EXEEXT), unbound-service-install \
  	unbound-service-remove anchor-update)
  COMPAT_WINAPP=$(filter-out $(BUILD)compat/ctime_r.lo, $(COMPAT_OBJ))
  SVCINST_SRC=winrc/unbound-service-install.c winrc/w_inst.c
  SVCINST_OBJ=$(addprefix $(BUILD),$(SVCINST_SRC:.c=.lo)) $(COMPAT_WINAPP) \
	$(BUILD)winrc/rsrc_svcinst.o
  SVCUNINST_SRC=winrc/unbound-service-remove.c winrc/w_inst.c
  SVCUNINST_OBJ=$(addprefix $(BUILD),$(SVCUNINST_SRC:.c=.lo)) $(COMPAT_WINAPP) \
	$(BUILD)winrc/rsrc_svcuninst.o
  ANCHORUPD_SRC=winrc/anchor-update.c
  ANCHORUPD_OBJ=$(addprefix $(BUILD),$(ANCHORUPD_SRC:.c=.lo)) $(COMPAT_WINAPP) \
        $(BUILD)winrc/rsrc_anchorupd.o
  ALL_SRC:=$(sort $(ALL_SRC) $(SVCINST_SRC) $(SVCUNINST_SRC) $(ANCHORUPD_SRC))
  ALL_OBJ:=$(sort $(ALL_OBJ) $(SVCINST_OBJ) $(SVCUNINST_OBJ) $(ANCHORUPD_OBJ))

$(BUILD)%.o:      $(srcdir)/%.rc $(srcdir)/config.h
	$(INFO) Resource $<
	@if test ! -z "$(ldnsdir)" -a ! -e $(ldnsdir)/include/ldns/ldns.h; \
		then (cd $(ldnsdir); $(MAKE) copy-headers); fi
	@-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
	$Q$(WINDRES) $(CPPFLAGS) $< $@
endif

COMPILE=$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS)
LINK=$(LIBTOOL) --tag=CC --mode=link $(strip $(CC) $(staticexe) $(RUNTIME_PATH) $(CFLAGS) $(LDFLAGS))
LINK_LIB=$(LIBTOOL) --tag=CC --mode=link $(strip $(CC) $(RUNTIME_PATH) $(CFLAGS) $(LDFLAGS) $(staticexe) -version-number @LIBUNBOUND_CURRENT@:@LIBUNBOUND_REVISION@:@LIBUNBOUND_AGE@ -no-undefined)

.PHONY:	clean realclean doc lint all install uninstall tests test download_ldns strip lib

$(BUILD)%.lo:    $(srcdir)/%.c 
	$(INFO) Build $<
	@if test ! -z "$(ldnsdir)" -a ! -e $(ldnsdir)/include/ldns/ldns.h; \
		then (cd $(ldnsdir); $(MAKE) copy-headers); fi
	@-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
	$Q$(COMPILE) -o $@ -c $<

all:	$(COMMON_OBJ) unbound$(EXEEXT) unbound-checkconf$(EXEEXT) lib unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-control-setup $(WINAPPS)

TEST_BIN=$(addsuffix $(EXEEXT),asynclook delayer harvest lock-verify \
	memstats perf pktview signit streamtcp testbound unittest)
tests:	all $(TEST_BIN)

test:	tests
	if test -x "`which bash`"; then bash testcode/do-tests.sh; else sh testcode/do-tests.sh; fi

lib:	libunbound.la

ifeq ($(patsubst ldns-src%,ldns-src,$(ldnsdir)),ldns-src)
ldnslib=$(ldnsdir)/lib/libldns.a
$(ldnslib):	$(ldnsdir)/lib
$(ldnsdir)/lib:
	@if test ! -z "$(ldnsdir)"; \
	then (cd $(ldnsdir) && $(MAKE)); fi
else
ldnslib=
endif

libunbound.la:	$(LIBUNBOUND_OBJ) $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK_LIB) -export-symbols $(srcdir)/libunbound/ubsyms.def -o $@ $(sort $(LIBUNBOUND_OBJ)) -rpath $(libdir) $(LIBS)

unbound$(EXEEXT):	$(DAEMON_OBJ) $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(DAEMON_OBJ)) -lssl $(LIBS)

unbound-checkconf$(EXEEXT):	$(CHECKCONF_OBJ) $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(CHECKCONF_OBJ)) $(LIBS)

unbound-control$(EXEEXT):	$(CONTROL_OBJ) $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(CONTROL_OBJ)) -lssl $(LIBS)

unbound-host$(EXEEXT):	$(HOST_OBJ) libunbound.la $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(HOST_OBJ)) -L. -L.libs -lunbound $(LIBS)

unbound-service-install$(EXEEXT):	$(SVCINST_OBJ)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(SVCINST_OBJ)) $(LIBS)

unbound-service-remove$(EXEEXT):	$(SVCUNINST_OBJ)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(SVCUNINST_OBJ)) $(LIBS)

anchor-update$(EXEEXT):  $(ANCHORUPD_OBJ) libunbound.la $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(ANCHORUPD_OBJ)) -L. -L.libs -lunbound $(LIBS)

unittest$(EXEEXT):	$(UNITTEST_OBJ) $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(UNITTEST_OBJ)) $(LIBS)

testbound$(EXEEXT):	$(TESTBOUND_OBJ) $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(TESTBOUND_OBJ)) -lssl $(LIBS)

lock-verify$(EXEEXT):	$(LOCKVERIFY_OBJ) $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(LOCKVERIFY_OBJ)) $(LIBS)

pktview$(EXEEXT):	$(PKTVIEW_OBJ) $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(PKTVIEW_OBJ)) $(LIBS)

signit$(EXEEXT):	$(SIGNIT_OBJ) $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(SIGNIT_OBJ)) $(LIBS)

memstats$(EXEEXT):	$(MEMSTATS_OBJ) $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(MEMSTATS_OBJ)) $(LIBS)

asynclook$(EXEEXT):	$(ASYNCLOOK_OBJ) $(ldnslib) libunbound.la
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(ASYNCLOOK_OBJ)) $(LIBS) -L. -L.libs -lunbound

streamtcp$(EXEEXT):	$(STREAMTCP_OBJ) $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(STREAMTCP_OBJ)) $(LIBS)

perf$(EXEEXT):	$(PERF_OBJ) $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(PERF_OBJ)) $(LIBS)

delayer$(EXEEXT):	$(DELAYER_OBJ) $(ldnslib)
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(DELAYER_OBJ)) $(LIBS)

harvest$(EXEEXT):	$(HARVEST_OBJ) $(ldnslib) libunbound.la
	$(INFO) Link $@
	$Q$(LINK) -o $@ $(sort $(HARVEST_OBJ)) $(LIBS) -L. -L.libs -lunbound

unbound-control-setup:	$(srcdir)/smallapp/unbound-control-setup.sh
	$(INFO) Sed $@
	$Qsed -e 's:^DESTDIR=.*$$:DESTDIR=$(UNBOUND_RUN_DIR):' < $< > $@
	$Q-chmod +x $@

#testcode/ldns-testpkts.c:	$(ldnsdir)/examples/ldns-testpkts.c \
#			$(ldnsdir)/examples/ldns-testpkts.h
#	cp $(ldnsdir)/examples/ldns-testpkts.c testcode/ldns-testpkts.c
#	cp $(ldnsdir)/examples/ldns-testpkts.h testcode/ldns-testpkts.h

ifeq "$(WITH_PYTHONMODULE)" "yes"
$(srcdir)/pythonmod/pythonmod.c:	pythonmod/interface.h
%.h:	$(srcdir)/%.i $(srcdir)/config.h
	@-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
	$(INFO) Swig $<
	$Q$(SWIG) $(CPPFLAGS) -o $@ -python $<
endif

ifeq "$(WITH_PYUNBOUND)" "yes"
libunbound/python/libunbound_wrap.c:	$(srcdir)/libunbound/python/libunbound.i $(srcdir)/libunbound/unbound.h
	@-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
	$(INFO) Swig $<
	$Q$(SWIG) -python -o $@ $(CPPFLAGS) $<

all:	_unbound.la
_unbound.la:	$(BUILD)libunbound/python/libunbound_wrap.lo libunbound.la
	$(INFO) Link $@
	$Q$(LIBTOOL) --tag=CC --mode=link $(strip $(CC) $(RUNTIME_PATH) $(CFLAGS) $(LDFLAGS) -module -version-number @LIBUNBOUND_CURRENT@:@LIBUNBOUND_REVISION@:@LIBUNBOUND_AGE@ -no-undefined) -o $@ $< -rpath $(PYTHON_SITE_PKG) L. -L.libs -lunbound $(LIBS)
endif

util/config_file.c:	util/configparser.h
util/configlexer.c:  $(srcdir)/util/configlexer.lex util/configparser.h
	$(INFO) Lex $<
ifeq "$(strip $(LEX))" ":"
	$Qecho "rebuild lexer, but no lex program, skipped"
else
	@-if test ! -d util; then $(INSTALL) -d util; fi
	$Qecho "#include \"config.h\"" > $@
	$Qecho "#include \"util/configyyrename.h\"" >> $@
	$Q$(LEX) -t $< >> $@
endif

util/configparser.c util/configparser.h:  $(srcdir)/util/configparser.y
	$(INFO) Yacc $<
	@-if test ! -d util; then $(INSTALL) -d util; fi
	$Q$(YACC) -d -o util/configparser.c $<

clean:
	rm -f *.o *.d *.lo *~ tags
	rm -f unbound$(EXEEXT) unbound-checkconf$(EXEEXT) unbound-host$(EXEEXT) unbound-control$(EXEEXT) unbound-control-setup libunbound.la
	rm -rf autom4te.cache .libs build doc/html doc/xml

realclean: clean
	rm -f config.status config.log config.h.in config.h
	rm -f configure config.sub config.guess ltmain.sh aclocal.m4 libtool
	rm -f util/configlexer.c util/configparser.c util/configparser.h
	rm -f $(TEST_BIN)
	if test -d ldns-src; then rm -rf ldns-src; fi
	rm -f Makefile 

$(BUILD)%.lint:    $(srcdir)/%.c 
	$(INFO) Lint $<
	@-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
	$Q$(LINT) $(LINTFLAGS) -I. -I$(srcdir) -I$(ldnsdir)/include $<
	$Qtouch $@

lint:	$(addprefix $(BUILD),$(filter-out util/configparser.lint,$(filter-out util/configlexer.lint,$(sort $(ALL_SRC:.c=.lint)))))

tags:	$(srcdir)/*.[ch] $(srcdir)/*/*.[ch]
	ctags  -f $(srcdir)/tags $(srcdir)/*.[ch] $(srcdir)/*/*.[ch]

doc:
	if test -n "$(doxygen)"; then \
		$(doxygen) $(srcdir)/doc/unbound.doxygen; fi
ifeq "$(findstring yes,$(WITH_PYUNBOUND)$(WITH_PYTHONMODULE))" "yes"
	if test -x "`which sphinx-build 2>&1`"; then \
		sphinx-build -b html pythonmod/doc doc/html/pythonmod; \
		sphinx-build -b html libunbound/python/doc doc/html/pyunbound;\
	fi
endif

strip:
	$(STRIP) unbound$(EXEEXT)
	$(STRIP) unbound-checkconf$(EXEEXT)
	$(STRIP) unbound-control$(EXEEXT)
	$(STRIP) unbound-host$(EXEEXT)

install:	all
	$(INSTALL) -m 755 -d $(DESTDIR)$(sbindir)
	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)
	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man8
	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man5
	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man3
	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
	$(INSTALL) -m 755 -d $(DESTDIR)$(libdir)
	$(INSTALL) -m 755 -d $(DESTDIR)$(includedir)
	$(LIBTOOL) --mode=install cp unbound$(EXEEXT) $(DESTDIR)$(sbindir)/unbound$(EXEEXT)
	$(LIBTOOL) --mode=install cp unbound-checkconf$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-checkconf$(EXEEXT)
	$(LIBTOOL) --mode=install cp unbound-control$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control$(EXEEXT)
	$(LIBTOOL) --mode=install cp unbound-host$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-host$(EXEEXT)
ifeq "$(WITH_PYTHONMODULE)" "yes"
	$(INSTALL) -m 755 -d $(DESTDIR)$(PYTHON_SITE_PKG)
	$(INSTALL) -c -m 644 pythonmod/unboundmodule.py $(DESTDIR)$(PYTHON_SITE_PKG)/unboundmodule.py
endif
ifeq "$(WITH_PYUNBOUND)" "yes"
	$(INSTALL) -m 755 -d $(DESTDIR)$(PYTHON_SITE_PKG)
	$(INSTALL) -c -m 644 libunbound/python/unbound.py $(DESTDIR)$(PYTHON_SITE_PKG)/unbound.py
	$(LIBTOOL) --mode=install cp _unbound.la $(DESTDIR)$(PYTHON_SITE_PKG)
	$(LIBTOOL) --mode=finish $(DESTDIR)$(PYTHON_SITE_PKG)
endif
	$(INSTALL) -c -m 644 doc/unbound.8 $(DESTDIR)$(mandir)/man8
	$(INSTALL) -c -m 644 doc/unbound-checkconf.8 $(DESTDIR)$(mandir)/man8
	$(INSTALL) -c -m 644 doc/unbound-control.8 $(DESTDIR)$(mandir)/man8
	$(INSTALL) -c -m 644 doc/unbound.conf.5 $(DESTDIR)$(mandir)/man5
	$(INSTALL) -c -m 644 $(srcdir)/doc/unbound-host.1 $(DESTDIR)$(mandir)/man1
	$(INSTALL) -c -m 644 doc/libunbound.3 $(DESTDIR)$(mandir)/man3
	$(INSTALL) -c -m 755 unbound-control-setup $(DESTDIR)$(sbindir)/unbound-control-setup
	if test ! -e $(DESTDIR)$(configfile); then $(INSTALL) -d `dirname $(DESTDIR)$(configfile)`; $(INSTALL) -c -m 644 doc/example.conf $(DESTDIR)$(configfile); fi
	$(LIBTOOL) --mode=install cp $(srcdir)/libunbound/unbound.h $(DESTDIR)$(includedir)/unbound.h
	$(LIBTOOL) --mode=install cp libunbound.la $(DESTDIR)$(libdir)
	$(LIBTOOL) --mode=finish $(DESTDIR)$(libdir)

uninstall:
	rm -f -- $(DESTDIR)$(sbindir)/unbound$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-checkconf$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-host$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control$(EXEEXT) $(DESTDIR)$(sbindir)/unbound-control-setup
	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
	rm -f -- $(DESTDIR)$(mandir)/man1/unbound-host.1 $(DESTDIR)$(mandir)/man3/libunbound.3
	rm -f -- $(DESTDIR)$(includedir)/unbound.h
	$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/libunbound.la
ifeq "$(WITH_PYTHONMODULE)" "yes"
	rm -f -- $(DESTDIR)$(PYTHON_SITE_PKG)/unboundmodule.py
endif
ifeq "$(WITH_PYUNBOUND)" "yes"
	rm -f -- $(DESTDIR)$(PYTHON_SITE_PKG)/unbound.py
	$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(PYTHON_SITE_PKG)/_unbound.la
endif
	@echo
	@echo "You still need to remove "`dirname $(DESTDIR)$(configfile)`" , $(DESTDIR)$(configfile) by hand"

download_ldns:
	svn export https://www.nlnetlabs.nl/svn/ldns/trunk/makedist.sh ldns_makedist.sh
	./ldns_makedist.sh -s -d https://www.nlnetlabs.nl/svn/ldns/trunk
	mv ldns-[0-9]*.tar.gz ldns-src.tar.gz
	rm ldns-*.tar.gz.sha1 ldns_makedist.sh

iana_update:
	curl -o port-numbers.tmp http://www.iana.org/assignments/port-numbers
	awk '/Unassigned|Reserved/ {next;} { match($$0, "[0-9]+/udp"); if (RLENGTH > 0) print substr($$0, RSTART, RLENGTH - 4) ","}' port-numbers.tmp | sort -nu > portslist.tmp
	cat portslist.tmp > util/iana_ports.inc
	rm -f port-numbers.tmp portslist.tmp

# Automatic dependencies.
$(BUILD)%.d: $(srcdir)/%.c
	$(INFO) Depend $<
	@if test ! -z "$(ldnsdir)" -a ! -e $(ldnsdir)/include/ldns/ldns.h; \
		then (cd $(ldnsdir); $(MAKE) copy-headers); fi
	@-if test ! -d $(dir $@); then $(INSTALL) -d $(patsubst %/,%,$(dir $@)); fi
	$Q$(SHELL) -ec '$(CC) $(DEPFLAG) $(CPPFLAGS) $(CFLAGS) $< | sed '\''s!\(.*\)\.o[ :]*!$(dir $@)\1.lo $@ : !g'\'' > $@; [ -s $@ ] || rm -f $@'

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),realclean)
ifeq ($(debug_enabled),yes)
-include $(addprefix $(BUILD),$(ALL_SRC:.c=.d) $(COMPAT_SRC:.c=.d))
endif
endif
endif