Improve “possibly undefined macro” diagnostic
[autoconf.git] / Makefile.am
blobdadd2caf3d9bf9baf753df9e3d237b309e16bf36
1 # Make Autoconf.
3 # Copyright (C) 1999-2004, 2006-2017, 2020-2024 Free Software
4 # Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
19 ACLOCAL_AMFLAGS = -I m4
21 ## All of these will be incrementally updated later, here or in included
22 ## makefile fragments.
23 ETAGS_ARGS =
24 MOSTLYCLEANFILES =
25 CLEANFILES =
26 DISTCLEANFILES =
27 MAINTAINERCLEANFILES =
28 SUFFIXES =
30 EXTRA_DIST = ChangeLog.0 ChangeLog.1 ChangeLog.2 ChangeLog.3 \
31              BUGS COPYINGv3 COPYING.EXCEPTION \
32              GNUmakefile maint.mk cfg.mk \
33              build-aux/gendocs.sh \
34              build-aux/git-version-gen \
35              build-aux/announce-gen build-aux/gnupload \
36              build-aux/gitlog-to-changelog \
37              build-aux/help-extract.pl \
38              .prev-version .version
40 edit = sed \
41         -e 's|@SHELL[@]|$(SHELL)|g' \
42         -e 's|@PERL[@]|$(PERL)|g' \
43         -e 's|@PERL_FLOCK[@]|$(PERL_FLOCK)|g' \
44         -e 's|@bindir[@]|$(bindir)|g' \
45         -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \
46         -e 's|@prefix[@]|$(prefix)|g' \
47         -e 's|@autoconf-name[@]|'`echo autoconf | sed '$(transform)'`'|g' \
48         -e 's|@autoheader-name[@]|'`echo autoheader | sed '$(transform)'`'|g' \
49         -e 's|@autom4te-name[@]|'`echo autom4te | sed '$(transform)'`'|g' \
50         -e 's|@M4[@]|$(M4)|g' \
51         -e 's|@M4_DEBUGFILE[@]|$(M4_DEBUGFILE)|g' \
52         -e 's|@M4_GNU[@]|$(M4_GNU)|g' \
53         -e 's|@AWK[@]|$(AWK)|g' \
54         -e 's|@RELEASE_YEAR[@]|$(RELEASE_YEAR)|g' \
55         -e 's|@VERSION[@]|$(VERSION)|g' \
56         -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
57         -e 's|@configure_input[@]|Generated from $@.in; do not edit by hand.|g'
59 include $(srcdir)/lib/freeze.mk
61 ## --------- ##
62 ## INSTALL.  ##
63 ## --------- ##
65 custom_MAKEINFOFLAGS = --no-headers --no-validate --no-split
67 if MAKE_CASE_SENSITIVE
68 pkgdata_DATA = $(srcdir)/INSTALL
69 MAINTAINERCLEANFILES += $(srcdir)/INSTALL
71 # Don't leave blank line at end of file.
72 OMIT_TRAILING_EMPTY_LINES = '/^$$/H; /^$$/d; x; s/\n//p; s/\n*//; x'
74 $(srcdir)/INSTALL: $(top_srcdir)/doc/install.texi
75         echo @firstparagraphindent insert                               \
76           | cat - $(top_srcdir)/doc/install.texi > tmp.texi
77         $(MAKEINFO) $(custom_MAKEINFOFLAGS) $(MAKEINFOFLAGS)            \
78              --plaintext tmp.texi                                       \
79           | sed -e $(OMIT_TRAILING_EMPTY_LINES)                         \
80              > $@-t && mv $@-t $@
81         rm -f tmp.texi
82 endif
84 # Generate the ChangeLog from git history.
85 gen_start_date = 2012-01-15 18:00:00 UTC
86 .PHONY: gen-ChangeLog
87 gen-ChangeLog:
88         if test -d $(top_srcdir)/.git; then \
89           (cd $(top_srcdir) && ./build-aux/gitlog-to-changelog \
90             --since='$(gen_start_date)') > $(distdir)/cl-t \
91             && rm -f $(distdir)/ChangeLog \
92             && mv $(distdir)/cl-t $(distdir)/ChangeLog; \
93         fi
95 # Dummy rule, to pacify automake "gnu" strictness and allow a clean
96 # bootstrap.  Creates a dummy ChangeLog (unless one is already present,
97 # as might be the case for users of vc-dwim) that will be overridden
98 # with a proper one at distribution time.
99 ChangeLog:
100         @echo dummy > $@
102 # Version string management.  There are two files to be aware of:
103 # .tarball-version - present only in a distribution tarball, and not in
104 #   a checked-out repository.  Created with contents that were learned at
105 #   the last time autoconf was run, and used by git-version-gen.  Must not
106 #   be present in either $(srcdir) or $(builddir) for git-version-gen to
107 #   give accurate answers during normal development with a checked out tree,
108 #   but must be present in a tarball when there is no version control system.
109 #   Therefore, it cannot be used in any dependencies.  GNUmakefile has
110 #   hooks to force a reconfigure at distribution time to get the value
111 #   correct, without penalizing normal development with extra reconfigures.
112 # .version - present in a checked-out repository and in a distribution
113 #   tarball.  At least as current as the most recent .tarball-version
114 #   creation.  Usable in dependencies, particularly for files that don't
115 #   want to depend on config.h but do want to track version changes.
116 BUILT_SOURCES = $(top_srcdir)/.version
117 $(top_srcdir)/.version:
118         echo $(VERSION) > $@-t && mv $@-t $@
120 # Arrange so that .tarball-version appears only in distribution tarballs,
121 # never in a checked-out repository.
122 dist-hook: gen-ChangeLog
123         echo $(VERSION) > $(distdir)/.tarball-version
125 # Arrange to remove the symlink to GNUmakefile in VPATH builds.
126 # TODO remove this once automake vs. AC_CONFIG_LINKS issue is fixed.
127 # Delete ChangeLog if it is the dummy created by the rule above.
128 # The sed construct below distinguishes between a file whose sole
129 # contents are "dummy", and a file whose first line is "dummy" but then
130 # has other stuff, without reading the whole thing.
131 distclean-local:
132         if test x"$(VPATH)" != x ; then rm -f GNUmakefile ; fi
133         if test "x`sed -ne 'l;2q' ChangeLog 2> /dev/null`" = 'xdummy$$'; \
134         then rm -f ChangeLog; fi
136 include $(srcdir)/bin/local.mk
137 include $(srcdir)/doc/local.mk
138 include $(srcdir)/lib/local.mk
139 include $(srcdir)/man/local.mk
140 include $(srcdir)/tests/local.mk
142 # Perl coverage statistics.
143 PERL_COVERAGE_DB = `pwd`/cover_db
144 PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
145 PERL_COVER = cover
147 check-coverage-run: all
148         $(MKDIR_P) $(PERL_COVERAGE_DB)
149         PERL5OPT="$(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
150         $(MAKE) $(AM_MAKEFLAGS) check
152 check-coverage-report:
153         @if test ! -d $(PERL_COVERAGE_DB); then \
154           echo "No coverage database found in '$(PERL_COVERAGE_DB)'." >&2; \
155           echo "Please run '$(MAKE) check-coverage' first" >&2; \
156           exit 1; \
157         fi
158         $(PERL_COVER) $(PERL_COVERAGE_DB) $(PERL_COVER_FLAGS)
160 # We don't use direct dependencies here because we'd like to be able
161 # to invoke the report even after interrupted check-coverage.
162 check-coverage: check-coverage-run
163         $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
165 clean-local: clean-coverage
166 clean-coverage:
167         rm -rf $(PERL_COVERAGE_DB)
169 .PHONY: check-coverage check-coverage-run check-coverage-report clean-coverage