From 1c957fdadf0ab368ab1266fbd6a9ea8fbe3b271d Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 29 Nov 1998 19:09:24 +0000 Subject: [PATCH] Regression tests run, first one written. --- Makefile | 34 +++++++++++++++++++++++++ Makefile.in | 34 +++++++++++++++++++++++++ client/.cvsignore | 1 + client/Makefile | 27 ++++++++++++++++++++ client/Makefile.in | 27 ++++++++++++++++++++ dynamic/.cvsignore | 1 + dynamic/Makefile | 37 +++++++++++++++++++++++++++ dynamic/Makefile.in | 37 +++++++++++++++++++++++++++ regress/.cvsignore | 2 +- regress/Makefile | 52 ++++++++++++++++++++++++++++++++++++++ regress/Makefile.in | 52 ++++++++++++++++++++++++++++++++++++++ regress/case-norm.stderr | 0 regress/case-norm.stdout | 4 +++ regress/case-norm.sys | 31 +++++++++++++++++++++++ regress/checkall | 29 +++++++++++++++++++++ regress/init-default.text | 2 ++ regress/m1test | 23 +++++++++++------ regress/r1test | 37 +++++++++++++++++++++++---- settings.make | 46 +++++++++++++++++++++++++++++++++ settings.make.in | 46 +++++++++++++++++++++++++++++++++ src/Makefile | 53 ++++++++------------------------------- src/Makefile.in | 53 ++++++++------------------------------- src/adns.make | 19 ++++++++++++++ 23 files changed, 549 insertions(+), 98 deletions(-) create mode 100644 Makefile create mode 100644 Makefile.in create mode 100644 client/.cvsignore create mode 100644 client/Makefile create mode 100644 client/Makefile.in create mode 100644 dynamic/.cvsignore create mode 100644 dynamic/Makefile create mode 100644 dynamic/Makefile.in create mode 100644 regress/Makefile create mode 100644 regress/Makefile.in create mode 100644 regress/case-norm.stderr create mode 100644 regress/case-norm.stdout create mode 100644 regress/case-norm.sys create mode 100755 regress/checkall create mode 100644 regress/init-default.text create mode 100644 settings.make create mode 100644 settings.make.in create mode 100644 src/adns.make diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..13f7381 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +# adnsMakefile - top-level Makefile +# +# This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +SUBDIRS= src dynamic client regress + +all: + set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d all; done + +check: all + $(MAKE) -C regress check + +install: + set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d install; done + +clean: + set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done + +distclean: + set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d distclean; done diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..13f7381 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,34 @@ +# adnsMakefile - top-level Makefile +# +# This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +SUBDIRS= src dynamic client regress + +all: + set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d all; done + +check: all + $(MAKE) -C regress check + +install: + set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d install; done + +clean: + set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done + +distclean: + set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d distclean; done diff --git a/client/.cvsignore b/client/.cvsignore new file mode 100644 index 0000000..d51e7a7 --- /dev/null +++ b/client/.cvsignore @@ -0,0 +1 @@ +adnstest diff --git a/client/Makefile b/client/Makefile new file mode 100644 index 0000000..1615340 --- /dev/null +++ b/client/Makefile @@ -0,0 +1,27 @@ +# client/Makefile - client program(s) Makefile +# +# This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +DIRCFLAGS= -I../src +TARGETS= adnstest + +include ../settings.make + +install: $(TARGETS) + $(INSTALL_BIN) $(TARGETS) $(bin_dir) + +adnstest: adnstest.o ../dynamic/$(LIBFILE) diff --git a/client/Makefile.in b/client/Makefile.in new file mode 100644 index 0000000..1615340 --- /dev/null +++ b/client/Makefile.in @@ -0,0 +1,27 @@ +# client/Makefile - client program(s) Makefile +# +# This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +DIRCFLAGS= -I../src +TARGETS= adnstest + +include ../settings.make + +install: $(TARGETS) + $(INSTALL_BIN) $(TARGETS) $(bin_dir) + +adnstest: adnstest.o ../dynamic/$(LIBFILE) diff --git a/dynamic/.cvsignore b/dynamic/.cvsignore new file mode 100644 index 0000000..31cab98 --- /dev/null +++ b/dynamic/.cvsignore @@ -0,0 +1 @@ +libadns.so.* diff --git a/dynamic/Makefile b/dynamic/Makefile new file mode 100644 index 0000000..e617bc4 --- /dev/null +++ b/dynamic/Makefile @@ -0,0 +1,37 @@ +# dynamic/Makefile - dynamic library Makefile +# +# This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +TARGETS= $(LIBFILE) + +include ../settings.make +include ../src/adns.make + +ALLOBJS= $(addsuffix _p.o, $(basename $(LIBOBJS))) + +install: + $(INSTALL_LIB) $(LIBFILE) $(lib_dir) + $(INSTALL_HDR) ../src/adns.h $(include_dir) + +$(LIBFILE): $(ALLOBJS) + rm -f $@ + $(CC) -shared -Wxl,soname=libadns.so.$(MAJOR) -o $@ $(ALLOBJS) -lc + +%_p.o: ../src/%.c ../src/adns.h ../src/internal.h + $(CC) -fpic -I../src -c -o $@ $< + +$(LIBOBJS): diff --git a/dynamic/Makefile.in b/dynamic/Makefile.in new file mode 100644 index 0000000..e617bc4 --- /dev/null +++ b/dynamic/Makefile.in @@ -0,0 +1,37 @@ +# dynamic/Makefile - dynamic library Makefile +# +# This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +TARGETS= $(LIBFILE) + +include ../settings.make +include ../src/adns.make + +ALLOBJS= $(addsuffix _p.o, $(basename $(LIBOBJS))) + +install: + $(INSTALL_LIB) $(LIBFILE) $(lib_dir) + $(INSTALL_HDR) ../src/adns.h $(include_dir) + +$(LIBFILE): $(ALLOBJS) + rm -f $@ + $(CC) -shared -Wxl,soname=libadns.so.$(MAJOR) -o $@ $(ALLOBJS) -lc + +%_p.o: ../src/%.c ../src/adns.h ../src/internal.h + $(CC) -fpic -I../src -c -o $@ $< + +$(LIBOBJS): diff --git a/regress/.cvsignore b/regress/.cvsignore index 2b26f2c..1b09e08 100644 --- a/regress/.cvsignore +++ b/regress/.cvsignore @@ -1,7 +1,7 @@ -dtest harness.h hcommon.c hrecord hrecord.c hplayback hplayback.c +case-*.*-o diff --git a/regress/Makefile b/regress/Makefile new file mode 100644 index 0000000..862144f --- /dev/null +++ b/regress/Makefile @@ -0,0 +1,52 @@ +# regress/Makefile - regression test Makefile +# +# This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +DIRCFLAGS= -I../src + +HCPPFLAGS:= $(foreach F, \ + gettimeofday select \ + socket fcntl connect close \ + sendto recvfrom read write writev \ +, -D$F=H$F) + +HARNLOBJS= $(addsuffix _d.o, $(basename $(LIBOBJS))) +ALLOBJS= $(HARNLOBJS) dtest.o hrecord.o hplayback.o hcommon.o +AUTOCSRCS= harness.h hrecord.c hplayback.c hcommon.c + +TARGETS= hplayback hrecord + +include ../settings.make +include ../src/adns.make + +.PRECIOUS: $(AUTOCSRCS) + +check: $(TARGETS) + ./checkall + +hrecord: ../client/adnstest.o hrecord.o hcommon.o $(HARNLOBJS) +hplayback: ../client/adnstest.o hplayback.o hcommon.o $(HARNLOBJS) + +%_d.o: ../src/%.c + $(CC) $(HCPPFLAGS) -c -g -o $@ $< + +$(ALLOBJS): ../src/adns.h ../src/internal.h harness.h + +%:: %.m4 hmacros.i4 hsyscalls.i4 + m4 -P $< >$@-a.new + sed -e 's/hm_comma/,/g; s/hm_squote/'\''/g; /^[ ]*$$/d' <$@-a.new >$@-b.new + @mv -f $@-b.new $@; rm -f $@-a.new diff --git a/regress/Makefile.in b/regress/Makefile.in new file mode 100644 index 0000000..862144f --- /dev/null +++ b/regress/Makefile.in @@ -0,0 +1,52 @@ +# regress/Makefile - regression test Makefile +# +# This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +DIRCFLAGS= -I../src + +HCPPFLAGS:= $(foreach F, \ + gettimeofday select \ + socket fcntl connect close \ + sendto recvfrom read write writev \ +, -D$F=H$F) + +HARNLOBJS= $(addsuffix _d.o, $(basename $(LIBOBJS))) +ALLOBJS= $(HARNLOBJS) dtest.o hrecord.o hplayback.o hcommon.o +AUTOCSRCS= harness.h hrecord.c hplayback.c hcommon.c + +TARGETS= hplayback hrecord + +include ../settings.make +include ../src/adns.make + +.PRECIOUS: $(AUTOCSRCS) + +check: $(TARGETS) + ./checkall + +hrecord: ../client/adnstest.o hrecord.o hcommon.o $(HARNLOBJS) +hplayback: ../client/adnstest.o hplayback.o hcommon.o $(HARNLOBJS) + +%_d.o: ../src/%.c + $(CC) $(HCPPFLAGS) -c -g -o $@ $< + +$(ALLOBJS): ../src/adns.h ../src/internal.h harness.h + +%:: %.m4 hmacros.i4 hsyscalls.i4 + m4 -P $< >$@-a.new + sed -e 's/hm_comma/,/g; s/hm_squote/'\''/g; /^[ ]*$$/d' <$@-a.new >$@-b.new + @mv -f $@-b.new $@; rm -f $@-a.new diff --git a/regress/case-norm.stderr b/regress/case-norm.stderr new file mode 100644 index 0000000..e69de29 diff --git a/regress/case-norm.stdout b/regress/case-norm.stdout new file mode 100644 index 0000000..70648e5 --- /dev/null +++ b/regress/case-norm.stdout @@ -0,0 +1,4 @@ +adns debug: using nameserver 172.18.45.6 +chiark.greenend.org.uk type 1 A(-) submitted +chiark.greenend.org.uk type A(-): OK; nrrs=1; cname=$ + 195.224.76.132 diff --git a/regress/case-norm.sys b/regress/case-norm.sys new file mode 100644 index 0000000..925352d --- /dev/null +++ b/regress/case-norm.sys @@ -0,0 +1,31 @@ +default +:1 chiark.greenend.org.uk + socket type=SOCK_DGRAM + socket=4 + fcntl fd=4 cmd=F_GETFL + fcntl=2 + fcntl fd=4 cmd=F_SETFL 2050 + fcntl=0 + gettimeofday + gettimeofday=OK tv=912366196.835269 + sendto fd=4 addr=172.18.45.6:53 + 311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267 + 02756b00 00010001. + sendto=40 + gettimeofday + gettimeofday=OK tv=+0.001166 + select max=5 rfds=[4] wfds=[] efds=[] to=1.998834 + select=1 rfds=[4] wfds=[] efds=[] + gettimeofday + gettimeofday=OK tv=+0.007822 + recvfrom fd=4 buflen=512 *addrlen=16 + recvfrom=OK addr=172.18.45.6:53 + 311f8580 00010001 00020002 06636869 61726b08 67726565 6e656e64 036f7267 + 02756b00 00010001 c00c0001 00010001 51800004 c3e04c84 08677265 656e656e + 64036f72 6702756b 00000200 01000151 80001103 6e73300a 72656c61 74697669 + 7479c038 c0380002 00010001 51800006 036e7331 c057c053 00010001 00015180 + 0004ac12 2d06c070 00010001 00015180 0004ac12 2d41. + recvfrom fd=4 buflen=512 *addrlen=16 + recvfrom=EAGAIN + close fd=4 + close=OK diff --git a/regress/checkall b/regress/checkall new file mode 100755 index 0000000..2191ae2 --- /dev/null +++ b/regress/checkall @@ -0,0 +1,29 @@ +#!/bin/sh + +allok=true + +for f in case-*.sys +do + case="`echo \"$f\" | sed -e 's/^case-//; s/\.sys$//'`" + if ./r1test $case + then + : + else + echo + allok=false + echo + fi +done + +if $allok +then + echo " +all tests passed." + exit 0 +fi + +echo >&2 ' +AT LEAST ONE TEST FAILED +' + +exit 1 diff --git a/regress/init-default.text b/regress/init-default.text new file mode 100644 index 0000000..05fd9c5 --- /dev/null +++ b/regress/init-default.text @@ -0,0 +1,2 @@ +nameserver 172.18.45.6 +sortlist 127.0.0.1/32 172.18.45.0/28 172.18.45.0/24 diff --git a/regress/m1test b/regress/m1test index 361e5b1..e88933e 100755 --- a/regress/m1test +++ b/regress/m1test @@ -2,15 +2,22 @@ # usage: m1test set -e -tcn="$1" -initfile="$2" +case="case-$1"; shift +initfile="$1"; shift queryargs="$*" -test -d ../testcases || cd testcases -initstring="`cat $initfile.init`" +initstring="`cat init-$initfile.text`" -exec >$tcn.log -echo "$initfile" -echo "$queryargs" +echo "$initfile" >"$case.sys" +echo "$queryargs" >>"$case.sys" -H../hrecord "/$initstring" $queryargs +echo running "hrecord /... $queryargs" +set +e +ADNS_TEST_OUT_FD=3 3>>"$case.sys" >"$case.stdout" 2>"$case.stderr" set -e -tcn="$1" -test -d ../testcases || cd testcases +case="case-$1" -exec <$tcn.log +exec <"$case.sys" read initfile read queryargs -initstring="`cat $initfile.init`" -../hplayback "/$initstring" $queryargs + +initstring="`cat init-$initfile.text`" + +set +e +ADNS_TEST_REPORT_FD=3 3>>"$case.report-o" >"$case.stdout-o" 2>"$case.stderr-o" \ + ./hplayback "/$initstring" $queryargs +rc=$? +set -e + +if test $rc != 0 +then + egrep . -- "$case.report-o" "$case.stdout-o" "$case.stderr-o" + echo >&2 "FAILED $case - EXIT STATUS $rc" + exit 2 +fi + +for part in stdout stderr +do + if diff -- "$case.$part" "$case.$part-o" + then + : + else + echo >&2 "FAILED $case - WRONG OUTPUT" + exit 2 + fi +done + +echo -n " $case " + +exit 0 diff --git a/settings.make b/settings.make new file mode 100644 index 0000000..8cfcaee --- /dev/null +++ b/settings.make @@ -0,0 +1,46 @@ +# settings.make - main configuration settings for Makefiles +# +# This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +MAJOR= 1 +MINOR= 0 +LIBFILE= libadns.so.$(MAJOR).$(MINOR) + +CC=gcc $(WARNS) $(WERROR) $(OPTIMISE) $(DEBUG) $(XCFLAGS) $(DIRCFLAGS) +DEBUG=-g +OPTIMISE=-O2 +WARNS= -Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes \ + -Wcast-qual -Wpointer-arith +WERROR=-Werror + +prefix= /usr/local +bin_dir= $(prefix)/bin +lib_dir= $(prefix)/lib +include_dir= $(prefix)/include + +INSTALL= install -o 0 -g 0 +INSTALL_LIB= $(INSTALL) -m 755 +INSTALL_BIN= $(INSTALL) -m 755 +INSTALL_HDR= $(INSTALL) -m 644 + +all: $(TARGETS) + +clean: + rm -f *.o + +distclean: clean + rm -f $(TARGETS) *~ ./#*# core *.orig *.rej diff --git a/settings.make.in b/settings.make.in new file mode 100644 index 0000000..8cfcaee --- /dev/null +++ b/settings.make.in @@ -0,0 +1,46 @@ +# settings.make - main configuration settings for Makefiles +# +# This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +MAJOR= 1 +MINOR= 0 +LIBFILE= libadns.so.$(MAJOR).$(MINOR) + +CC=gcc $(WARNS) $(WERROR) $(OPTIMISE) $(DEBUG) $(XCFLAGS) $(DIRCFLAGS) +DEBUG=-g +OPTIMISE=-O2 +WARNS= -Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes \ + -Wcast-qual -Wpointer-arith +WERROR=-Werror + +prefix= /usr/local +bin_dir= $(prefix)/bin +lib_dir= $(prefix)/lib +include_dir= $(prefix)/include + +INSTALL= install -o 0 -g 0 +INSTALL_LIB= $(INSTALL) -m 755 +INSTALL_BIN= $(INSTALL) -m 755 +INSTALL_HDR= $(INSTALL) -m 644 + +all: $(TARGETS) + +clean: + rm -f *.o + +distclean: clean + rm -f $(TARGETS) *~ ./#*# core *.orig *.rej diff --git a/src/Makefile b/src/Makefile index 57c208a..d85bfc2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,3 +1,5 @@ +# src/Makefile - library main Makefile +# # This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson # # This program is free software; you can redistribute it and/or modify @@ -14,50 +16,17 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -CC=gcc $(WARNS) $(WERROR) $(OPTIMISE) $(DEBUG) $(XCFLAGS) -DEBUG=-g -OPTIMISE=-O2 -WARNS= -Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes \ - -Wcast-qual -Wpointer-arith -WERROR=-Werror +TARGETS= libadns.a -HCPPFLAGS:= $(foreach F, \ - gettimeofday select \ - socket fcntl connect close \ - sendto recvfrom read write writev \ -, -D$F=H$F) +include ../settings.make +include adns.make -LIBOBJS= types.o event.o query.o reply.o general.o setup.o transmit.o parse.o -HARNLOBJS= $(addsuffix _d.o, $(basename $(LIBOBJS))) -ALLOBJS= $(LIBOBJS) $(HARNLOBJS) dtest.o hrecord.o hplayback.o hcommon.o -AUTOCSRCS= harness.h hrecord.c hcommon.c +install: -TARGETS= dtest hplayback hrecord +ALLOBJS= $(LIBOBJS) -all: $(TARGETS) +libadns.a: $(LIBOBJS) + rm -f $@ + $(AR) cqsv $@ $(LIBOBJS) -hrecord: dtest.o hrecord.o hcommon.o $(HARNLOBJS) -hplayback: dtest.o hplayback.o hcommon.o $(HARNLOBJS) - -dtest: dtest.o $(LIBOBJS) - -%_d.o: %.c - $(CC) $(HCPPFLAGS) -c -g -o $@ $< - -%:: %.m4 hmacros.i4 hsyscalls.i4 - m4 -P $< >$@-a.new - sed -e 's/hm_comma/,/g; s/hm_squote/'\''/g; /^[ ]*$$/d' <$@-a.new >$@-b.new - @mv -f $@-b.new $@; rm -f $@-a.new - -.PRECIOUS: $(AUTOCSRCS) - -clean: - rm -f *.o - -realclean: clean - rm -f $(TARGETS) *~ ./#*# core *.orig *.rej - -hrecord.o hcommon.o: adns.h internal.h harness.h -$(HARNLOBJS): adns.h internal.h -$(LIBOBJS): adns.h internal.h -dtest.o: adns.h +$(LIBOBJS): adns.h internal.h diff --git a/src/Makefile.in b/src/Makefile.in index 57c208a..d85bfc2 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,3 +1,5 @@ +# src/Makefile - library main Makefile +# # This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson # # This program is free software; you can redistribute it and/or modify @@ -14,50 +16,17 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -CC=gcc $(WARNS) $(WERROR) $(OPTIMISE) $(DEBUG) $(XCFLAGS) -DEBUG=-g -OPTIMISE=-O2 -WARNS= -Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes \ - -Wcast-qual -Wpointer-arith -WERROR=-Werror +TARGETS= libadns.a -HCPPFLAGS:= $(foreach F, \ - gettimeofday select \ - socket fcntl connect close \ - sendto recvfrom read write writev \ -, -D$F=H$F) +include ../settings.make +include adns.make -LIBOBJS= types.o event.o query.o reply.o general.o setup.o transmit.o parse.o -HARNLOBJS= $(addsuffix _d.o, $(basename $(LIBOBJS))) -ALLOBJS= $(LIBOBJS) $(HARNLOBJS) dtest.o hrecord.o hplayback.o hcommon.o -AUTOCSRCS= harness.h hrecord.c hcommon.c +install: -TARGETS= dtest hplayback hrecord +ALLOBJS= $(LIBOBJS) -all: $(TARGETS) +libadns.a: $(LIBOBJS) + rm -f $@ + $(AR) cqsv $@ $(LIBOBJS) -hrecord: dtest.o hrecord.o hcommon.o $(HARNLOBJS) -hplayback: dtest.o hplayback.o hcommon.o $(HARNLOBJS) - -dtest: dtest.o $(LIBOBJS) - -%_d.o: %.c - $(CC) $(HCPPFLAGS) -c -g -o $@ $< - -%:: %.m4 hmacros.i4 hsyscalls.i4 - m4 -P $< >$@-a.new - sed -e 's/hm_comma/,/g; s/hm_squote/'\''/g; /^[ ]*$$/d' <$@-a.new >$@-b.new - @mv -f $@-b.new $@; rm -f $@-a.new - -.PRECIOUS: $(AUTOCSRCS) - -clean: - rm -f *.o - -realclean: clean - rm -f $(TARGETS) *~ ./#*# core *.orig *.rej - -hrecord.o hcommon.o: adns.h internal.h harness.h -$(HARNLOBJS): adns.h internal.h -$(LIBOBJS): adns.h internal.h -dtest.o: adns.h +$(LIBOBJS): adns.h internal.h diff --git a/src/adns.make b/src/adns.make new file mode 100644 index 0000000..ccca7b4 --- /dev/null +++ b/src/adns.make @@ -0,0 +1,19 @@ +# src/adns.make - library definitions, including list of object files +# +# This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +LIBOBJS= types.o event.o query.o reply.o general.o setup.o transmit.o parse.o -- 2.30.2