freeze.mk 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # Freeze M4 files.
  2. # Copyright (C) 2002, 2004, 2006-2012 Free Software Foundation, Inc.
  3. # This program is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation, either version 3 of the License, or
  6. # (at your option) any later version.
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. # You should have received a copy of the GNU General Public License
  12. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ## ----------------- ##
  14. ## Freeze M4 files. ##
  15. ## ----------------- ##
  16. SUFFIXES = .m4 .m4f
  17. AUTOM4TE_CFG = $(top_builddir)/lib/autom4te.cfg
  18. $(AUTOM4TE_CFG): $(top_srcdir)/lib/autom4te.in
  19. cd $(top_builddir)/lib && $(MAKE) $(AM_MAKEFLAGS) autom4te.cfg
  20. # Do not use AUTOM4TE here, since maint.mk (my-distcheck)
  21. # checks if we are independent of Autoconf by defining AUTOM4TE (and
  22. # others) to `false'. Autoconf provides autom4te, so that doesn't
  23. # apply to us.
  24. MY_AUTOM4TE = \
  25. autom4te_perllibdir='$(top_srcdir)'/lib \
  26. AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \
  27. -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` '
  28. # When processing the file with diversion disabled, there must be no
  29. # output but comments and empty lines.
  30. # If freezing produces output, something went wrong: a bad `divert',
  31. # or an improper paren etc.
  32. # It may happen that the output does not end with an end of line, hence
  33. # force an end of line when reporting errors.
  34. .m4.m4f:
  35. $(MY_AUTOM4TE) \
  36. --language=$* \
  37. --freeze \
  38. --output=$@
  39. # Factor the dependencies between all the frozen files.
  40. # Some day we should explain to Automake how to use autom4te to compute
  41. # the dependencies...
  42. src_libdir = $(top_srcdir)/lib
  43. build_libdir = $(top_builddir)/lib
  44. m4f_dependencies = $(top_builddir)/bin/autom4te $(AUTOM4TE_CFG)
  45. # For parallel builds.
  46. $(build_libdir)/m4sugar/version.m4:
  47. cd $(build_libdir)/m4sugar && $(MAKE) $(AM_MAKEFLAGS) version.m4
  48. m4sugar_m4f_dependencies = \
  49. $(m4f_dependencies) \
  50. $(src_libdir)/m4sugar/m4sugar.m4 \
  51. $(build_libdir)/m4sugar/version.m4
  52. m4sh_m4f_dependencies = \
  53. $(m4sugar_m4f_dependencies) \
  54. $(src_libdir)/m4sugar/m4sh.m4
  55. autotest_m4f_dependencies = \
  56. $(m4sh_m4f_dependencies) \
  57. $(src_libdir)/autotest/autotest.m4 \
  58. $(src_libdir)/autotest/general.m4 \
  59. $(src_libdir)/autotest/specific.m4
  60. autoconf_m4f_dependencies = \
  61. $(m4sh_m4f_dependencies) \
  62. $(src_libdir)/autoconf/autoscan.m4 \
  63. $(src_libdir)/autoconf/general.m4 \
  64. $(src_libdir)/autoconf/autoheader.m4 \
  65. $(src_libdir)/autoconf/autoupdate.m4 \
  66. $(src_libdir)/autoconf/autotest.m4 \
  67. $(src_libdir)/autoconf/status.m4 \
  68. $(src_libdir)/autoconf/oldnames.m4 \
  69. $(src_libdir)/autoconf/specific.m4 \
  70. $(src_libdir)/autoconf/lang.m4 \
  71. $(src_libdir)/autoconf/c.m4 \
  72. $(src_libdir)/autoconf/fortran.m4 \
  73. $(src_libdir)/autoconf/erlang.m4 \
  74. $(src_libdir)/autoconf/go.m4 \
  75. $(src_libdir)/autoconf/functions.m4 \
  76. $(src_libdir)/autoconf/headers.m4 \
  77. $(src_libdir)/autoconf/types.m4 \
  78. $(src_libdir)/autoconf/libs.m4 \
  79. $(src_libdir)/autoconf/programs.m4 \
  80. $(src_libdir)/autoconf/autoconf.m4
  81. ## --------------------------- ##
  82. ## Run ETAGS on some M4 code. ##
  83. ## --------------------------- ##
  84. ETAGS_FOR_M4 = \
  85. --lang=none \
  86. --regex='/\(m4_define\|define\)(\[\([^]]*\)\]/\2/'
  87. ETAGS_FOR_M4SUGAR = \
  88. $(ETAGS_FOR_M4) \
  89. --regex='/m4_defun(\[\([^]]*\)\]/\1/'
  90. ETAGS_FOR_AUTOCONF = \
  91. $(ETAGS_FOR_M4SUGAR) \
  92. --regex='/\(A[CU]_DEFUN\|AU_ALIAS\)(\[\([^]]*\)\]/\2/' \
  93. --regex='/AN_\(FUNCTION\|HEADER\|IDENTIFIER\|LIBRARY\|MAKEVAR\|PROGRAM\)(\[\([^]]*\)\]/\2/'
  94. ## -------------------------------- ##
  95. ## Looking for forbidden patterns. ##
  96. ## -------------------------------- ##
  97. check-forbidden-patterns:
  98. @if (cd $(srcdir) && \
  99. $(GREP) $(forbidden_patterns) $(forbidden_patterns_files)) \
  100. >forbidden.log; then \
  101. echo "ERROR: forbidden patterns were found:" >&2; \
  102. sed "s|^|$*.m4: |" <forbidden.log >&2; \
  103. echo >&2; \
  104. exit 1; \
  105. else \
  106. rm -f forbidden.log; \
  107. fi