silent-c.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/bin/sh
  2. # Copyright (C) 2009-2017 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Check silent-rules mode for C, without libtool, both with and without
  17. # automatic dependency tracking.
  18. required=cc
  19. . test-init.sh
  20. mkdir sub
  21. cat >>configure.ac <<'EOF'
  22. AC_CONFIG_FILES([sub/Makefile])
  23. AC_PROG_CC
  24. AC_OUTPUT
  25. EOF
  26. cat > Makefile.am <<'EOF'
  27. # Need generic and non-generic rules.
  28. bin_PROGRAMS = foo bar
  29. bar_CFLAGS = $(AM_CFLAGS)
  30. SUBDIRS = sub
  31. EOF
  32. cat > sub/Makefile.am <<'EOF'
  33. AUTOMAKE_OPTIONS = subdir-objects
  34. # Need generic and non-generic rules.
  35. bin_PROGRAMS = baz bla
  36. bla_CFLAGS = $(AM_CFLAGS)
  37. EOF
  38. cat > foo.c <<'EOF'
  39. int main ()
  40. {
  41. return 0;
  42. }
  43. EOF
  44. cp foo.c bar.c
  45. cp foo.c sub/baz.c
  46. cp foo.c sub/bla.c
  47. $ACLOCAL
  48. $AUTOMAKE --add-missing
  49. $AUTOCONF
  50. for config_args in \
  51. '--enable-dependency-tracking' \
  52. '--disable-dependency-tracking' \
  53. ; do
  54. ./configure --enable-silent-rules $config_args
  55. run_make -O
  56. $EGREP ' (-c|-o)' stdout && exit 1
  57. grep 'mv ' stdout && exit 1
  58. grep 'CC .*foo\.' stdout
  59. grep 'CC .*bar\.' stdout
  60. grep 'CC .*baz\.' stdout
  61. grep 'CC .*bla\.' stdout
  62. grep 'CCLD .*foo' stdout
  63. grep 'CCLD .*bar' stdout
  64. grep 'CCLD .*baz' stdout
  65. grep 'CCLD .*bla' stdout
  66. $MAKE clean
  67. run_make -O V=1
  68. grep ' -c' stdout
  69. grep ' -o foo' stdout
  70. $EGREP '(CC|LD) ' stdout && exit 1
  71. $MAKE distclean
  72. done
  73. :