diff --git a/.gitignore b/.gitignore index 59ef307..24f1410 100644 --- a/.gitignore +++ b/.gitignore @@ -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 /aclocal.m4 /autom4te.cache/ -/autoscan.log -/config.guess /config.h /config.h.in -/config.h.in~ /config.log /config.status -/config.sub /configure -/configure.scan -/contrib/Makefile -/contrib/Makefile.in -/depcomp -/gnulib/ +/dhcpd-pools /INSTALL -/install-sh /libtool -/ltmain.sh -/m4 -/Makefile -/Makefile.in -/man/Makefile -/man/Makefile.in -/missing +/m4/ +/man/dhcpd-pools.1 /stamp-h1 -/tags +/test-suite.log +/tests/outputs/ diff --git a/Makefile.am b/Makefile.am index 4e1eeae..b2beaca 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,10 +8,21 @@ EXTRA_DIST = \ build-aux/git-version-gen \ m4/gnulib-cache.m4 -SUBDIRS = doc lib src man tests contrib +SUBDIRS = lib BUILT_SOURCES = $(top_srcdir)/.version $(top_srcdir)/.version: echo $(VERSION) > $@-t && mv $@-t $@ dist-hook: 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) diff --git a/configure.ac b/configure.ac index b873bd1..9c9ddc6 100644 --- a/configure.ac +++ b/configure.ac @@ -9,8 +9,8 @@ AC_INIT([dhcpd-pools], PACKAGE_MAINTAINER="Sami Kerola" AC_SUBST([PACKAGE_MAINTAINER]) AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE([-Wall -Wextra-portability foreign 1.10 tar-pax no-dist-gzip dist-xz - parallel-tests]) +AM_INIT_AUTOMAKE([-Wall -Wextra-portability foreign 1.10 tar-pax + no-dist-gzip dist-xz parallel-tests subdir-objects]) AC_CONFIG_SRCDIR([src/dhcpd-pools.h]) AC_CONFIG_HEADERS([config.h]) @@ -143,12 +143,7 @@ AM_CONDITIONAL([HAVE_DOXYGEN_DOT], [test "x$DOXYGEN_DOT" != "x"]) AC_CONFIG_FILES([ Makefile lib/Makefile - src/Makefile - man/Makefile man/dhcpd-pools.1 - tests/Makefile - doc/Makefile - contrib/Makefile ]) AC_OUTPUT diff --git a/contrib/Makefile.am b/contrib/Makefile.am deleted file mode 100644 index a3396bf..0000000 --- a/contrib/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -contribdir = $(datadir)/dhcpd-pools/ -dist_contrib_SCRIPTS = dhcpd-pools.cgi snmptest.pl -EXTRA_DIST = nagios.conf munin_plugins diff --git a/contrib/Makemodule.am b/contrib/Makemodule.am new file mode 100644 index 0000000..f6aee1f --- /dev/null +++ b/contrib/Makemodule.am @@ -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 diff --git a/doc/.gitignore b/doc/.gitignore deleted file mode 100644 index 7167275..0000000 --- a/doc/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/Makefile -/Makefile.in -/doxy.conf -/doxyfile.stamp -/html diff --git a/doc/Makefile.am b/doc/Makefile.am deleted file mode 100644 index e990c92..0000000 --- a/doc/Makefile.am +++ /dev/null @@ -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 diff --git a/doc/Makemodule.am b/doc/Makemodule.am new file mode 100644 index 0000000..5a5686d --- /dev/null +++ b/doc/Makemodule.am @@ -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 diff --git a/man/.gitignore b/man/.gitignore deleted file mode 100644 index a6c61aa..0000000 --- a/man/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/dhcpd-pools.1 diff --git a/man/Makefile.am b/man/Makefile.am deleted file mode 100644 index 8c4d072..0000000 --- a/man/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -man_MANS = dhcpd-pools.1 -EXTRA_DIST = dhcpd-pools.1.in -CLEANFILES = dhcpd-pools.1 diff --git a/man/Makemodule.am b/man/Makemodule.am new file mode 100644 index 0000000..102705a --- /dev/null +++ b/man/Makemodule.am @@ -0,0 +1,3 @@ +man_MANS = man/dhcpd-pools.1 +EXTRA_DIST += man/dhcpd-pools.1.in +CLEANFILES += man/dhcpd-pools.1 diff --git a/src/.gitignore b/src/.gitignore deleted file mode 100644 index 759c2c3..0000000 --- a/src/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -gmon.out -gmon.sum -*.c.gcov -*.gcda -*.gcno -*~ -*.o -.deps/ -dhcpd-pools -Makefile -Makefile.in -tags diff --git a/src/Makefile.am b/src/Makemodule.am similarity index 65% rename from src/Makefile.am rename to src/Makemodule.am index ee0dd88..45e62b5 100644 --- a/src/Makefile.am +++ b/src/Makemodule.am @@ -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_SOURCES = \ - analyze.c \ - defaults.h \ - dhcpd-pools.c \ - dhcpd-pools.h \ - getdata.c \ - hash.c \ - other.c \ - output.c \ - sort.c + src/analyze.c \ + src/defaults.h \ + src/dhcpd-pools.c \ + src/dhcpd-pools.h \ + src/getdata.c \ + src/hash.c \ + src/other.c \ + src/output.c \ + src/sort.c diff --git a/tests/.gitignore b/tests/.gitignore deleted file mode 100644 index 0d52223..0000000 --- a/tests/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/Makefile -/Makefile.in -/outputs -/*.log -/*.trs diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index 30b3cef..0000000 --- a/tests/Makefile.am +++ /dev/null @@ -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 diff --git a/tests/Makemodule.am b/tests/Makemodule.am new file mode 100644 index 0000000..3213ad7 --- /dev/null +++ b/tests/Makemodule.am @@ -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 diff --git a/tests/full-json b/tests/full-json index b9ebb55..31b0c93 100755 --- a/tests/full-json +++ b/tests/full-json @@ -2,12 +2,12 @@ # # Minimal regression test suite. -if [ ! -d outputs ]; then - mkdir outputs +if [ ! -d tests/outputs ]; then + mkdir tests/outputs fi dhcpd-pools -f J -c $top_srcdir/tests/confs/same-twice \ -l $top_srcdir/tests/leases/same-twice \ - -o outputs/same-twice-json -diff -u $top_srcdir/tests/expected/same-twice-json outputs/same-twice-json + -o tests/outputs/same-twice-json +diff -u $top_srcdir/tests/expected/same-twice-json tests/outputs/same-twice-json exit $? diff --git a/tests/test.sh b/tests/test.sh index a8746c8..6694344 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -4,11 +4,11 @@ IAM=$(basename $0) -if [ ! -d outputs ]; then - mkdir outputs +if [ ! -d tests/outputs ]; then + mkdir tests/outputs fi dhcpd-pools -c $top_srcdir/tests/confs/$IAM \ - -l $top_srcdir/tests/leases/$IAM -o outputs/$IAM -diff -u $top_srcdir/tests/expected/$IAM outputs/$IAM + -l $top_srcdir/tests/leases/$IAM -o tests/outputs/$IAM +diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM exit $?