summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: 8ead9a1e2aa6929cc25761efddda4ad8a42e2d87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
## Process this file with automake to create Makefile.in. -*-Makefile-*-

## Makefile for Autoconf.
## Copyright 1999, 2000, 2001 Free Software Foundation, Inc.

## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.

AUTOMAKE_OPTIONS = check-news 1.4 readme-alpha

SUBDIRS = . config m4 man doc tests

SUFFIXES = .m4 .m4f
## There is currently no means with Automake not to run aclocal.
ACLOCAL_AMFLAGS = --version >/dev/null && touch aclocal.m4
WGET = wget

bin_SCRIPTS = autoconf autoheader autoreconf ifnames @PERLSCRIPTS@
EXTRA_SCRIPTS = autoscan autoupdate

# FIXME:
# s/distpackageDATA/dist_pkgdata_DATA/
# s/nodistpackageDATA/nodist_pkgdata_DATA/
# and adapt dependencies once we use a more recent Automake

m4sources =  m4sugar.m4 m4sh.m4  \
             $(srcdir)/acversion.m4 \
             autoconf.m4 \
             acgeneral.m4 acoldnames.m4 acspecific.m4 aclang.m4 \
             acfunctions.m4 acheaders.m4 actypes.m4

distpkgdataDATA = acfunctions acheaders acidentifiers acmakevars acprograms \
                  aclibraries $(m4sources)

nodistpkgdataDATA = autoconf.m4f

pkgdata_DATA = $(distpkgdataDATA) $(nodistpkgdataDATA)

EXTRA_DIST = ChangeLog.0 ChangeLog.1 ChangeLog.2 \
             BUGS INSTALL.txt \
             acversion.in \
             autoconf.in autoheader.in autoreconf.in autoupdate.in ifnames.in \
             autoscan.in \
             $(distpkgdataDATA) \
             GNUmakefile Makefile.maint

# Files that should be removed, but which Automake does not know:
# the frozen files and the scripts.
CLEANFILES = autoconf.m4f \
             $(bin_SCRIPTS)


## ------------------ ##
## Maintainer rules.  ##
## ------------------ ##

move_if_change = $(top_srcdir)/config/move-if-change

## acversion.m4.  ##

# - acversion.m4 needs to be updated only once, since it depends on
#   configure.ac, not on the results of a 'configure' run.
# - It is guaranteed (with GNU Make) that when the version in configure.ac
#   is changed, acversion.m4 is built only after the new version number is
#   propagated to the Makefile.  (Libtool uses the same guarantee.)

$(srcdir)/acversion.m4: $(srcdir)/acversion.in $(srcdir)/configure.ac
	sed 's,@VERSION\@,$(VERSION),g' $(srcdir)/acversion.in >acversion.tm4
	mv acversion.tm4 $(srcdir)/acversion.m4

## INSTALL.  ##

# INSTALL is a special case.  Automake seems to have a single name space
# for both targets and variables.  If we just use INSTALL, then the var
# $(INSTALL) is not defined, and the install target fails.
MAKEINFO = @MAKEINFO@ --no-headers --no-validate --no-split
INSTALL.txt: $(top_srcdir)/doc/install.texi
	$(MAKEINFO) $(top_srcdir)/doc/install.texi --output=$(srcdir)/INSTALL.txt
	cp $(srcdir)/INSTALL.txt $(srcdir)/INSTALL

MAINTAINERCLEANFILES = acversion.m4 INSTALL.txt


## maintainer-check ##
maintainer-check: maintainer-check-tests
maintainer-check-tests:
	cd tests && make maintainer-check

## ----------------------------------- ##
## Special installation instructions.  ##
## ----------------------------------- ##

install-data-hook: INSTALL.txt
	@$(NORMAL_INSTALL)
	@list='INSTALL'; for p in $$list; do \
	  if test -f "$$p.txt"; then d= ; else d="$(srcdir)/"; fi; \
	  f="`echo $$p | sed -e 's|^.*/||'`"; \
	  echo " $(INSTALL_DATA) $$d$$p.txt $(DESTDIR)$(pkgdatadir)/$$f"; \
	  $(INSTALL_DATA) $$d$$p.txt $(DESTDIR)$(pkgdatadir)/$$f; \
	done


## ------------- ##
## The scripts.  ##
## ------------- ##

edit = sed \
	-e 's,@SHELL\@,$(SHELL),g' \
	-e 's,@PERL\@,$(PERL),g' \
	-e 's,@datadir\@,$(pkgdatadir),g' \
	-e 's,@bindir\@,$(bindir),g' \
	-e 's,@autoconf-name\@,'`echo autoconf | sed '$(transform)'`',g' \
	-e 's,@autoheader-name\@,'`echo autoheader | sed '$(transform)'`',g' \
	-e 's,@M4\@,$(M4),g' \
	-e 's,@AWK\@,$(AWK),g' \
	-e 's,@VERSION\@,$(VERSION),g' \
	-e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g'

## All the scripts below depend on configure.ac so that they are rebuilt
## when the Autoconf version changes. Unfortunately, suffix rules cannot
## have additional dependencies, so we have to use explicit rules for
## every script.

autoconf: $(srcdir)/autoconf.in $(srcdir)/configure.ac
	rm -f autoconf autoconf.tmp
	$(edit) $(srcdir)/autoconf.in >autoconf.tmp
	chmod +x autoconf.tmp
	$(move_if_change) autoconf.tmp autoconf

autoheader: $(srcdir)/autoheader.in $(srcdir)/configure.ac
	rm -f autoheader autoheader.tmp
	$(edit) $(srcdir)/autoheader.in >autoheader.tmp
	chmod +x autoheader.tmp
	$(move_if_change) autoheader.tmp autoheader

autoreconf: $(srcdir)/autoreconf.in $(srcdir)/configure.ac
	rm -f autoreconf autoreconf.tmp
	$(edit) $(srcdir)/autoreconf.in >autoreconf.tmp
	chmod +x autoreconf.tmp
	$(move_if_change) autoreconf.tmp autoreconf

autoupdate: $(srcdir)/autoupdate.in $(srcdir)/configure.ac
	rm -f autoupdate autoupdate.tmp
	$(edit) $(srcdir)/autoupdate.in >autoupdate.tmp
	chmod +x autoupdate.tmp
	$(move_if_change) autoupdate.tmp autoupdate

ifnames: $(srcdir)/ifnames.in $(srcdir)/configure.ac
	rm -f ifnames ifnames.tmp
	$(edit) $(srcdir)/ifnames.in >ifnames.tmp
	chmod +x ifnames.tmp
	$(move_if_change) ifnames.tmp ifnames

autoscan: $(srcdir)/autoscan.in $(srcdir)/configure.ac
	rm -f autoscan autoscan.tmp
	$(edit) $(srcdir)/autoscan.in >autoscan.tmp
	chmod +x autoscan.tmp
	$(move_if_change) autoscan.tmp autoscan


## ------------------ ##
## The frozen files.  ##
## ------------------ ##


# When processing the file with diversion disabled, there must be no
# output but comments and empty lines.
# If freezing produces output, something went wrong: a bad `divert',
# or an improper paren etc.
# It may happen that the output does not end with a end of line, hence
# force an end of line when reporting errors.
.m4.m4f:
	$(M4) --include $(srcdir) --fatal-warning --define divert \
	      $(srcdir)/$*.m4 2>error.log | \
	  sed 's/#.*//;/^$$/d' >process.log
	if grep . error.log >/dev/null 2>&1; then \
	  echo "ERROR: Processing $(srcdir)/$*.m4 produced errors:" >&2; \
	  sed "s,^,$(srcdir)/$*.m4: ," <error.log >&2; \
	  echo >&2; \
	  exit 1; \
	else \
	  rm -f error.log; \
	fi
	if grep . process.log >/dev/null 2>&1; then \
	  echo "ERROR: Processing $(srcdir)/$*.m4 produced output:" >&2; \
	  sed "s,^,$(srcdir)/$*.m4: ," <process.log >&2; \
	  echo >&2; \
	  exit 1; \
	else \
	  rm -f process.log; \
	fi
	$(M4) --include $(srcdir) --fatal-warning --freeze-state=$*.m4f \
	      $(srcdir)/$*.m4 >freeze.log
	if grep . freeze.log >/dev/null 2>&1; then \
	  echo "ERROR: Freezing $(srcdir)/$*.m4 produced output:" >&2; \
	  sed "s,^,$(srcdir)/$*.m4: ," <freeze.log >&2; \
	  echo >&2; \
	  exit 1; \
	else \
	  rm -f freeze.log; \
	fi

autoconf.m4f: $(m4sources)


## ---------------------------- ##
## Customizing Makefile.maint.  ##
## ---------------------------- ##

prev_version_file = $(srcdir)/config/prev-version.txt
release_archive_dir = releases

# Uploading betas.
hosts = alpha
alpha_host = alpha.gnu.org
alpha_url_dir = gnu/autoconf

# Files to update automatically.
wget_files = $(srcdir)/config/config.guess $(srcdir)/config/config.sub \
	     $(srcdir)/config/texinfo.tex \
	     $(srcdir)/doc/standards.texi $(srcdir)/doc/make-stds.texi