1## Process this file with automake to create Makefile.in. -*-Makefile-*-
2
3## Makefile for Autoconf.
4
5## Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
6## Foundation, Inc.
7
8## This program is free software; you can redistribute it and/or modify
9## it under the terms of the GNU General Public License as published by
10## the Free Software Foundation; either version 2, or (at your option)
11## any later version.
12
13## This program is distributed in the hope that it will be useful,
14## but WITHOUT ANY WARRANTY; without even the implied warranty of
15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16## GNU General Public License for more details.
17
18## You should have received a copy of the GNU General Public License
19## along with this program; if not, write to the Free Software
20## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21## 02110-1301, USA.
22
23include ../lib/freeze.mk
24
25bin_SCRIPTS = autom4te \
26	      autoconf autoheader autoreconf ifnames autoscan autoupdate
27
28EXTRA_DIST = autoconf.as autoheader.in autoreconf.in autoupdate.in ifnames.in \
29	     autoscan.in autom4te.in
30
31# Files that should be removed, but which Automake does not know.
32MOSTLYCLEANFILES = $(bin_SCRIPTS) autoconf.in *.tmp
33
34
35## ------------- ##
36## The scripts.  ##
37## ------------- ##
38
39edit = sed \
40	-e 's|@SHELL[@]|$(SHELL)|g' \
41	-e 's|@PERL[@]|$(PERL)|g' \
42	-e 's|@bindir[@]|$(bindir)|g' \
43	-e 's|@datadir[@]|$(pkgdatadir)|g' \
44	-e 's|@prefix[@]|$(prefix)|g' \
45	-e 's|@autoconf-name[@]|'`echo autoconf | sed '$(transform)'`'|g' \
46	-e 's|@autoheader-name[@]|'`echo autoheader | sed '$(transform)'`'|g' \
47	-e 's|@autom4te-name[@]|'`echo autom4te | sed '$(transform)'`'|g' \
48	-e 's|@M4[@]|$(M4)|g' \
49	-e 's|@M4_DEBUGFILE[@]|$(M4_DEBUGFILE)|g' \
50	-e 's|@AWK[@]|$(AWK)|g' \
51	-e 's|@VERSION[@]|$(VERSION)|g' \
52	-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
53	-e 's|@configure_input[@]|Generated from $@.in; do not edit by hand.|g'
54
55# autoconf is written in M4sh.
56# FIXME: this target should depend on the frozen files below lib/m4sugar,
57# otherwise autom4te may pick up a frozen m4sh.m4f from an earlier
58# installation below the same $(prefix); work around this with --melt.
59autoconf.in: $(srcdir)/autoconf.as $(m4sh_m4f_dependencies)
60	$(MY_AUTOM4TE) --language M4sh --cache '' --melt $(srcdir)/autoconf.as -o $@
61
62## All the scripts depend on Makefile so that they are rebuilt when the
63## prefix etc. changes.  It took quite a while to have the rule correct,
64## don't break it!
65## Use chmod -w to prevent people from editing the wrong file by accident.
66$(bin_SCRIPTS): Makefile
67	rm -f $@ $@.tmp
68	$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp
69	chmod +x $@.tmp
70	chmod a-w $@.tmp
71	mv $@.tmp $@
72
73autoconf: autoconf.in
74autoheader: $(srcdir)/autoheader.in
75autom4te: $(srcdir)/autom4te.in
76autoreconf: $(srcdir)/autoreconf.in
77autoscan: $(srcdir)/autoscan.in
78autoupdate: $(srcdir)/autoupdate.in
79ifnames: $(srcdir)/ifnames.in
80
81
82## --------------- ##
83## Building TAGS.  ##
84## --------------- ##
85
86TAGS_DEPENDENCIES = $(EXTRA_DIST)
87
88letters = abcdefghijklmnopqrstuvwxyz
89LETTERS = ABCDEFGHIJKLMNOPQRSTUVWXYZ
90DIGITS = 0123456789
91WORD_REGEXP = [$(LETTERS)$(letters)_][$(LETTERS)$(letters)$(DIGITS)_]*
92ETAGS_PERL = --lang=perl \
93  autoheader.in autoreconf.in autoupdate.in autoscan.in autom4te.in \
94  ifnames.in
95ETAGS_SH = --lang=none --regex='/\($(WORD_REGEXP)\)=/\1/' \
96  autoconf.in
97
98ETAGS_ARGS = $(ETAGS_PERL) $(ETAGS_SH)
99