1 # regress/Makefile[.in] - regression test Makefile
3 # This file is part of adns, which is
4 # Copyright (C) 1997-2000,2003,2006,2014-2016,2020 Ian Jackson
5 # Copyright (C) 2014 Mark Wooding
6 # Copyright (C) 1999-2000,2003,2006 Tony Finch
7 # Copyright (C) 1991 Massachusetts Institute of Technology
8 # (See the file INSTALL for full details.)
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 3, or (at your option)
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software Foundation.
26 PROGS_SYSDEP= @PROGS_HAVE_TSEARCH@
28 CLIENTS= adnstest adnshost adnslogres $(PROGS_SYSDEP)
29 AUTOCHDRS= harness.h hsyscalls.h hredirect.h
30 AUTOCSRCS= hrecord.c hplayback.c hcommon.c
31 include ../settings.make
32 include $(srcdir)/../src/adns.make
34 DIRCFLAGS= -I../src -I$(srcdir) -I$(srcdir)/../src
36 HCPPFLAGS= -DADNS_REGRESS_TEST -I.
38 REDIRLIBOBJS= $(addsuffix _d.o, $(basename $(LIBOBJS)))
39 HARNLOBJS= hcommon.o $(REDIRLIBOBJS)
40 TARGETS= $(addsuffix _record, $(CLIENTS)) \
41 $(addsuffix _playback, $(CLIENTS)) \
42 $(addsuffix _fuzz, $(CLIENTS))
43 ADH_OBJS= adh-main_c.o adh-opts_c.o adh-query_c.o
44 ALL_OBJS= $(HARNLOBJS) dtest.o hrecord.o hplayback.o hnonfuzz.o hfuzz.o
46 .PRECIOUS: $(AUTOCSRCS) $(AUTOCHDRS)
48 all install uninstall: $(TARGETS)
50 ALL_TESTS:=$(patsubst $(srcdir)/case-%.sys,%,$(wildcard $(srcdir)/case-*.sys))
52 check: $(TARGETS) $(addprefix check-,$(ALL_TESTS))
54 @echo 'all tests passed or maybe skipped.'
56 checkfuzz: $(TARGETS) $(addprefix checkfuzz-,$(ALL_TESTS))
58 @echo 'all fuzzes passed or maybe skipped.'
59 # this target is mostly useful as prep work for running the fuzzer;
60 # it doesn't really test any of adns
63 $(srcdir)/categorizefuzz $(ALL_TESTS)
66 @srcdir=$(srcdir) $(srcdir)/r1test $* || test $$? = 5
68 fuzz-%: case-%.sys $(TARGETS) make1fuzz shlib
69 srcdir=$(srcdir) $(srcdir)/make1fuzz $*
73 checkfuzz-%: fuzz-% $(TARGETS)
74 @srcdir=$(srcdir) $(srcdir)/check1fuzz $< || test $$? = 5
76 LINK_CMD= $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
78 %_record: %_c.o hrecord.o hnonfuzz.o $(HARNLOBJS)
81 %_playback: %_c.o hplayback.o hnonfuzz.o $(HARNLOBJS)
84 %_fuzz: %_c.o hplayback.o hfuzz.o $(HARNLOBJS)
87 .SECONDARY: $(addsuffix _c.o, $(filter-out adnshost, $(CLIENTS)))
88 # Without this, make will remove <client>_c.o after building <client>.
89 # This wastes effort. (Debian bug #4073.)
91 # Also, it exposes us to a bug (in make 3.81, at least) which can
92 # cause make to run the rule for building <client> without building
93 # <client>_c.o! (Debian #756123.)
95 # See also Savannah #29620, http://savannah.gnu.org/bugs/index.php?29620
97 adnshost_%: $(ADH_OBJS) h%.o hnonfuzz.o $(HARNLOBJS)
100 adnshost_fuzz: $(ADH_OBJS) hplayback.o hfuzz.o $(HARNLOBJS)
103 %_d.o: $(srcdir)/../src/%.c hredirect.h
104 $(CC) $(CFLAGS) $(HCPPFLAGS) -c -g -o $@ $<
106 %_c.o: $(srcdir)/../client/%.c hredirect.h
107 $(CC) $(CFLAGS) $(HCPPFLAGS) -I $(srcdir)/../src -c -g -o $@ $<
109 $(ALL_OBJS): $(srcdir)/../src/adns.h $(srcdir)/../src/internal.h
110 $(ALL_OBJS): harness.h hsyscalls.h
111 $(ADH_OBJS): $(srcdir)/../client/adnshost.h
113 %:: %.m4 hmacros.i4 hsyscalls.i4
114 $(M4) -P -I$(srcdir) $< >$@-a.new
115 sed -e 's/hm_comma/,/g; s/hm_squote/'\''/g; /^[ ]*$$/d' <$@-a.new >$@-b.new
116 @mv -f $@-b.new $(srcdir)/$@; rm -f $@-a.new