build-sys: Build check programs only on make check

noinst_PROGRAMS are built with "make" even though we had the
test programs in there and only needed them for "make check".

In theory the check target should depend on check_PROGRAMS as
check-am target does and the document states it should, but for
reasons understood by the automake whisperers only, it doesn't
build them.

check only depends on BUILT_SOURCES for some reason.

check-am: all-am
        $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
        $(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: $(BUILT_SOURCES)
        $(MAKE) $(AM_MAKEFLAGS) check-recursive

References:
 https://www.gnu.org/software/automake/manual/html_node/Scripts_002dbased-Testsuites.html
This commit is contained in:
Craig Small 2020-10-19 20:05:41 +11:00
parent fb91001192
commit 6a2cc67bb6
1 changed files with 4 additions and 3 deletions

View File

@ -312,7 +312,7 @@ ps_pscommand_SOURCES = \
# Test programs required for dejagnu or standalone testing
noinst_PROGRAMS = \
check_PROGRAMS = \
lib/test_strutils \
lib/test_fileutils \
lib/test_process \
@ -327,7 +327,7 @@ lib_test_process_LDADD = $(CYGWINFLAGS)
lib_test_strtod_nol_SOURCES = lib/test_strtod_nol.c lib/strutils.c
lib_test_strtod_nol_LDADD = $(CYGWINFLAGS)
noinst_PROGRAMS += \
check_PROGRAMS += \
proc/test_Itemtables \
proc/test_pids \
proc/test_uptime \
@ -386,7 +386,8 @@ TESTS = \
lib/test_fileutils \
lib/test_strtod_nol
check_PROGRAMS = $(TESTS)
# Automake should do this, but it doesn't
check: $(check_PROGRAMS)
$(top_srcdir)/.version:
touch $(top_srcdir)/.version