]> git.draconx.ca Git - dxcommon.git/blob - tests/snippets.at
Fix Autotest depfiles generation with non-GNU makes.
[dxcommon.git] / tests / snippets.at
1 dnl Copyright © 2021 Nick Bowler
2 dnl
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
6
7 AT_BANNER([Automake snippet tests])
8
9 m4_define([TEST_DEPFILES_INIT],
10 [TEST_CONFIGURE_AC(
11 [[AM_INIT_AUTOMAKE([foreign])
12
13 DX_PROG_AUTOTEST
14 AM_CONDITIONAL([HAVE_AUTOTEST], [test x"$dx_cv_autotest_works" = x"yes"])
15
16 AM_SET_DEPDIR
17 AM_OUTPUT_DEPENDENCY_COMMANDS
18 AM_MAKE_INCLUDE
19 AM_DEP_TRACK
20
21 AC_CONFIG_FILES([Makefile])
22 ]])
23
24 cp "$srcdir/snippet/autotest.mk" .
25 AT_DATA([Makefile.am],
26 [[EXTRA_DIST =
27 DISTCLEANFILES =
28 include $(top_srcdir)/autotest.mk
29 ]])
30
31 TEST_AUTORECONF])
32
33 AT_SETUP([autotest.mk depfiles (MAKE=gmake)])
34
35 TEST_DEPFILES_INIT
36
37 # gmake sanity check
38 AT_CHECK([{ echo 'rule:; @: $(info works)' |
39               gmake --no-print-directory -f - >out 2>/dev/null &&
40             read s <out && test x"$s" = x"works"; } || exit 77])
41
42 mkdir build
43 AT_CHECK([cd build && ../configure MAKE=gmake && test -f .deps/testsuite.P],
44   [0], [ignore])
45 AT_CHECK([gmake --no-print-directory -sC build distclean &&
46   find build -type f])
47
48 AT_CLEANUP
49
50 AT_SETUP([autotest.mk depfiles (MAKE=dmake)])
51
52 TEST_DEPFILES_INIT
53
54 # dmake sanity check
55 AT_CHECK([{ echo 'rule:; @echo works' | dmake -f - >out 2>/dev/null &&
56             read s <out && test x"$s" = x"works"; } || exit 77])
57
58 AT_CHECK([./configure MAKE=dmake && test -f .deps/testsuite.P], [0], [ignore])
59
60 AT_CLEANUP