build-sys: use non-recursive build

For reasons see excellent paper 'Recursive Make Considered Harmful' by
Peter Miller.

References: http://miller.emu.id.au/pmiller/books/rmch/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2013-04-24 21:36:16 +01:00
parent 0495ea4edf
commit 30238e9d1c
18 changed files with 102 additions and 115 deletions

38
.gitignore vendored
View file

@ -1,30 +1,30 @@
/.tarball-version # Wildcard + in any subdir.
*.o
# Exact filename in any subdir.
.deps
.dirstamp
Makefile
Makefile.in
# Exact wildcard, e.g., not in subdirs.
/tests/*.log
/tests/*.trs
# Exact match, if a directory then everything in directory.
/.version /.version
/aclocal.m4 /aclocal.m4
/autom4te.cache/ /autom4te.cache/
/autoscan.log
/config.guess
/config.h /config.h
/config.h.in /config.h.in
/config.h.in~
/config.log /config.log
/config.status /config.status
/config.sub
/configure /configure
/configure.scan /dhcpd-pools
/contrib/Makefile
/contrib/Makefile.in
/depcomp
/gnulib/
/INSTALL /INSTALL
/install-sh
/libtool /libtool
/ltmain.sh /m4/
/m4 /man/dhcpd-pools.1
/Makefile
/Makefile.in
/man/Makefile
/man/Makefile.in
/missing
/stamp-h1 /stamp-h1
/tags /test-suite.log
/tests/outputs/

View file

@ -8,10 +8,21 @@ EXTRA_DIST = \
build-aux/git-version-gen \ build-aux/git-version-gen \
m4/gnulib-cache.m4 m4/gnulib-cache.m4
SUBDIRS = doc lib src man tests contrib SUBDIRS = lib
BUILT_SOURCES = $(top_srcdir)/.version BUILT_SOURCES = $(top_srcdir)/.version
$(top_srcdir)/.version: $(top_srcdir)/.version:
echo $(VERSION) > $@-t && mv $@-t $@ echo $(VERSION) > $@-t && mv $@-t $@
dist-hook: dist-hook:
echo $(VERSION) > $(distdir)/.tarball-version echo $(VERSION) > $(distdir)/.tarball-version
CLEANFILES =
CLEAN_LOCALS =
include contrib/Makemodule.am
include doc/Makemodule.am
include man/Makemodule.am
include src/Makemodule.am
include tests/Makemodule.am
clean-local: $(CLEAN_LOCALS)

View file

@ -9,8 +9,8 @@ AC_INIT([dhcpd-pools],
PACKAGE_MAINTAINER="Sami Kerola" PACKAGE_MAINTAINER="Sami Kerola"
AC_SUBST([PACKAGE_MAINTAINER]) AC_SUBST([PACKAGE_MAINTAINER])
AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([-Wall -Wextra-portability foreign 1.10 tar-pax no-dist-gzip dist-xz AM_INIT_AUTOMAKE([-Wall -Wextra-portability foreign 1.10 tar-pax
parallel-tests]) no-dist-gzip dist-xz parallel-tests subdir-objects])
AC_CONFIG_SRCDIR([src/dhcpd-pools.h]) AC_CONFIG_SRCDIR([src/dhcpd-pools.h])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
@ -143,12 +143,7 @@ AM_CONDITIONAL([HAVE_DOXYGEN_DOT], [test "x$DOXYGEN_DOT" != "x"])
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile
lib/Makefile lib/Makefile
src/Makefile
man/Makefile
man/dhcpd-pools.1 man/dhcpd-pools.1
tests/Makefile
doc/Makefile
contrib/Makefile
]) ])
AC_OUTPUT AC_OUTPUT

View file

@ -1,3 +0,0 @@
contribdir = $(datadir)/dhcpd-pools/
dist_contrib_SCRIPTS = dhcpd-pools.cgi snmptest.pl
EXTRA_DIST = nagios.conf munin_plugins

3
contrib/Makemodule.am Normal file
View file

@ -0,0 +1,3 @@
contribdir = $(datadir)/dhcpd-pools/
dist_contrib_SCRIPTS = contrib/dhcpd-pools.cgi contrib/snmptest.pl
EXTRA_DIST += contrib/nagios.conf contrib/munin_plugins

5
doc/.gitignore vendored
View file

@ -1,5 +0,0 @@
/Makefile
/Makefile.in
/doxy.conf
/doxyfile.stamp
/html

View file

@ -1,18 +0,0 @@
EXTRA_DIST = doxy.conf.in introduction.dox
if ENABLE_DOXYGEN
doxyfile.stamp:
$(DOXYGEN) doxy.conf
date > doxyfile.stamp
CLEANFILES = doxyfile.stamp
all-local: doxyfile.stamp
clean-local: clean-local-check
.PHONY: clean-local-check
clean-local-check:
-rm -rf html
endif

20
doc/Makemodule.am Normal file
View file

@ -0,0 +1,20 @@
EXTRA_DIST += \
doc/doxy.conf.in \
doc/introduction.dox
if ENABLE_DOXYGEN
doxyfile.stamp:
$(DOXYGEN) doc/doxy.conf
date > doc/doxyfile.stamp
CLEANFILES += doc/doxyfile.stamp
all-local: doc/doxyfile.stamp
clean-local-doc:
-rm -rf doc/*html
CLEAN_LOCALS += clean-local-doc
endif

1
man/.gitignore vendored
View file

@ -1 +0,0 @@
/dhcpd-pools.1

View file

@ -1,3 +0,0 @@
man_MANS = dhcpd-pools.1
EXTRA_DIST = dhcpd-pools.1.in
CLEANFILES = dhcpd-pools.1

3
man/Makemodule.am Normal file
View file

@ -0,0 +1,3 @@
man_MANS = man/dhcpd-pools.1
EXTRA_DIST += man/dhcpd-pools.1.in
CLEANFILES += man/dhcpd-pools.1

12
src/.gitignore vendored
View file

@ -1,12 +0,0 @@
gmon.out
gmon.sum
*.c.gcov
*.gcda
*.gcno
*~
*.o
.deps/
dhcpd-pools
Makefile
Makefile.in
tags

View file

@ -7,12 +7,12 @@ AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/lib -I$(top_builddir)/lib
dhcpd_pools_LDADD = $(top_builddir)/lib/libdhcpd_pools.la dhcpd_pools_LDADD = $(top_builddir)/lib/libdhcpd_pools.la
dhcpd_pools_SOURCES = \ dhcpd_pools_SOURCES = \
analyze.c \ src/analyze.c \
defaults.h \ src/defaults.h \
dhcpd-pools.c \ src/dhcpd-pools.c \
dhcpd-pools.h \ src/dhcpd-pools.h \
getdata.c \ src/getdata.c \
hash.c \ src/hash.c \
other.c \ src/other.c \
output.c \ src/output.c \
sort.c src/sort.c

5
tests/.gitignore vendored
View file

@ -1,5 +0,0 @@
/Makefile
/Makefile.in
/outputs
/*.log
/*.trs

View file

@ -1,24 +0,0 @@
TESTS = \
bootp \
complete \
empty \
full-json \
leading0 \
one-ip \
same-twice \
simple \
v6
EXTRA_DIST = \
confs \
expected \
leases \
test.sh \
$(TESTS)
TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) PATH=../src$(PATH_SEPARATOR)$$PATH
check-local: $(SHELL) $(top_srcdir)/tests/test.sh
clean-local:
rm -rf $(top_builddir)/tests/outputs

26
tests/Makemodule.am Normal file
View file

@ -0,0 +1,26 @@
TESTS = \
tests/bootp \
tests/complete \
tests/empty \
tests/full-json \
tests/leading0 \
tests/one-ip \
tests/same-twice \
tests/simple \
tests/v6
EXTRA_DIST += \
tests/confs \
tests/expected \
tests/leases \
tests/test.sh \
$(TESTS)
TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) PATH=$(top_builddir)$(PATH_SEPARATOR)$$PATH
check-local: $(SHELL) $(top_srcdir)/tests/test.sh
clean-local-tests:
rm -rf $(top_builddir)/tests/outputs
CLEAN_LOCALS += clean-local-tests

View file

@ -2,12 +2,12 @@
# #
# Minimal regression test suite. # Minimal regression test suite.
if [ ! -d outputs ]; then if [ ! -d tests/outputs ]; then
mkdir outputs mkdir tests/outputs
fi fi
dhcpd-pools -f J -c $top_srcdir/tests/confs/same-twice \ dhcpd-pools -f J -c $top_srcdir/tests/confs/same-twice \
-l $top_srcdir/tests/leases/same-twice \ -l $top_srcdir/tests/leases/same-twice \
-o outputs/same-twice-json -o tests/outputs/same-twice-json
diff -u $top_srcdir/tests/expected/same-twice-json outputs/same-twice-json diff -u $top_srcdir/tests/expected/same-twice-json tests/outputs/same-twice-json
exit $? exit $?

View file

@ -4,11 +4,11 @@
IAM=$(basename $0) IAM=$(basename $0)
if [ ! -d outputs ]; then if [ ! -d tests/outputs ]; then
mkdir outputs mkdir tests/outputs
fi fi
dhcpd-pools -c $top_srcdir/tests/confs/$IAM \ dhcpd-pools -c $top_srcdir/tests/confs/$IAM \
-l $top_srcdir/tests/leases/$IAM -o outputs/$IAM -l $top_srcdir/tests/leases/$IAM -o tests/outputs/$IAM
diff -u $top_srcdir/tests/expected/$IAM outputs/$IAM diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM
exit $? exit $?