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