silent-gen.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. # Silent rules: use of pre-defined variables $(AM_V_GEN) and $(AM_V_at).
  17. # Incidentally, also check that silent rules are disabled by default.
  18. . test-init.sh
  19. echo AC_OUTPUT >> configure.ac
  20. cat > Makefile.am <<'EOF'
  21. all-local: foo
  22. ## And here's how you should do it in your own code:
  23. foo: foo.in
  24. $(AM_V_GEN)cp $(srcdir)/foo.in $@
  25. $(AM_V_at)echo more >> $@
  26. EXTRA_DIST = foo.in
  27. CLEANFILES = foo
  28. EOF
  29. : >foo.in
  30. $ACLOCAL
  31. $AUTOMAKE --add-missing
  32. $AUTOCONF
  33. # Silent rules are disabled by default, since we haven't called
  34. # "AM_SILENT_RULES([yes])" explicitly.
  35. ./configure
  36. run_make -O
  37. grep 'GEN ' stdout && exit 1
  38. grep 'cp ' stdout
  39. grep 'echo ' stdout
  40. $MAKE clean
  41. run_make -O V=1
  42. grep 'GEN ' stdout && exit 1
  43. grep 'cp ' stdout
  44. grep 'echo ' stdout
  45. $MAKE clean
  46. run_make -O V=0
  47. grep 'GEN .*foo' stdout
  48. grep 'cp ' stdout && exit 1
  49. grep 'echo ' stdout && exit 1
  50. $MAKE distclean
  51. ./configure --enable-silent-rules
  52. run_make -O
  53. grep 'GEN .*foo' stdout
  54. grep 'cp ' stdout && exit 1
  55. grep 'echo ' stdout && exit 1
  56. $MAKE clean
  57. run_make -O V=0
  58. grep 'GEN .*foo' stdout
  59. grep 'cp ' stdout && exit 1
  60. grep 'echo ' stdout && exit 1
  61. $MAKE clean
  62. run_make -O V=1
  63. grep 'GEN ' stdout && exit 1
  64. grep 'cp ' stdout
  65. grep 'echo ' stdout
  66. :