# $(datadir) or other do_subst'ituted variables change.
automake: automake.in
aclocal: aclocal.in
-automake aclocal: Makefile
- $(AM_V_at)rm -f $@ $@-t
- $(AM_V_GEN)in=$@.in; $(do_subst) <$(srcdir)/$@.in >$@-t
+automake aclocal: Makefile lib/gen-perl-protos
+ $(AM_V_GEN)rm -f $@ $@-t $@-t2 \
+## Common substitutions.
+ && in=$@.in && $(do_subst) <$(srcdir)/$$in >$@-t \
+## Auto-compute prototypes of perl subroutines.
+ && $(PERL) -w $(srcdir)/lib/gen-perl-protos $@-t > $@-t2 \
+ && mv -f $@-t2 $@-t \
## We can't use '$(generated_file_finalize)' here, because currently
## Automake contains occurrences of unexpanded @substitutions@ in
## comments, and that is perfectly legit.
- $(AM_V_at)chmod a+x,a-w $@-t && mv -f $@-t $@
+ && chmod a+x,a-w $@-t && mv -f $@-t $@
+EXTRA_DIST += lib/gen-perl-protos
# The master location for INSTALL is lib/INSTALL.
# This is where "make fetch" will install new versions.
# Prototypes for all subroutines.
-sub unlink_tmp (;$);
-sub xmkdir_p ($);
-sub check_acinclude ();
-sub reset_maps ();
-sub install_file ($$);
-sub list_compare (\@\@);
-sub scan_m4_dirs ($$@);
-sub scan_m4_files ();
-sub add_macro ($);
-sub scan_configure_dep ($);
-sub add_file ($);
-sub scan_file ($$$);
-sub strip_redundant_includes (%);
-sub trace_used_macros ();
-sub scan_configure ();
-sub write_aclocal ($@);
-sub usage ($);
-sub version ();
-sub handle_acdir_option ($$);
-sub parse_arguments ();
-sub parse_ACLOCAL_PATH ();
+#! Prototypes here will automatically be generated by the build system.
################################################################
use File::Spec;
use Carp;
+## ----------------------- ##
+## Subroutine prototypes. ##
+## ----------------------- ##
+
+#! Prototypes here will automatically be generated by the build system.
+
+
## ----------- ##
## Constants. ##
## ----------- ##
################################################################
-## --------------------------------- ##
-## Forward subroutine declarations. ##
-## --------------------------------- ##
-sub register_language (%);
-sub file_contents_internal ($$$%);
-sub define_files_variable ($\@$$);
-
# &initialize_per_input ()
# ------------------------
# Uncategorized errors about the current Makefile.am.
sub err_am ($;%)
{
- msg_am ('error', @_);
+ msg_am ('error', shift, @_);
}
# err_ac ($MESSAGE, [%OPTIONS])
# Uncategorized errors about configure.ac.
sub err_ac ($;%)
{
- msg_ac ('error', @_);
+ msg_ac ('error', shift, @_);
}
# msg_am ($CHANNEL, $MESSAGE, [%OPTIONS])
dosubst automake-$APIVERSION/Automake/Config.in \
automake-$APIVERSION/Automake/Config.pm
-# Create temporary replacement for aclocal.
-dosubst aclocal.in aclocal.tmp
-
# Overwrite amversion.m4.
dosubst m4/amversion.in m4/amversion.m4
-# Create temporary replacement for automake.
-dosubst automake.in automake.tmp
+# Create temporary replacement for aclocal and automake.
+for p in aclocal automake; do
+ dosubst $p.in $p.tmp
+ $PERL -w lib/gen-perl-protos $p.tmp > $p.tmp2
+ mv -f $p.tmp2 $p.tmp
+done
# Create required makefile snippets.
$PERL ./gen-testsuite-part > t/testsuite-part.tmp
--- /dev/null
+#!/usr/bin/env perl
+#
+# Copyright (C) 2013 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 3, 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, see <http://www.gnu.org/licenses/>.
+
+use warnings;
+use strict;
+
+my @lines = <>;
+my @protos = map { /^(sub \w+\s*\(.*\))/ ? ("$1;") : () } @lines;
+
+while (defined ($_ = shift @lines))
+ {
+ if (/^#!.* prototypes/i)
+ {
+ print "# BEGIN AUTOMATICALLY GENERATED PROTOTYPES\n";
+ print join ("\n", sort @protos) . "\n";
+ print "# END AUTOMATICALLY GENERATED PROTOTYPES\n";
+ }
+ else
+ {
+ print;
+ }
+ }
automake_diff_no = 8
aclocal_diff_no = 9
sc_diff_automake sc_diff_aclocal: sc_diff_% :
- @set +e; tmp=$*-diffs.tmp; \
- diff -u $(srcdir)/$*.in $* > $$tmp; test $$? -eq 1 || exit 1; \
- added=`grep -v '^+++ ' $$tmp | grep -c '^+'` || exit 1; \
- removed=`grep -v '^--- ' $$tmp | grep -c '^-'` || exit 1; \
- test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
+ @set +e; \
+ in=$*-in.tmp out=$*-out.tmp diffs=$*-diffs.tmp \
+ && sed '/^#!.*[pP]rototypes/d' $(srcdir)/$*.in > $$in \
+ && sed '/^# BEGIN.* PROTO/,/^# END.* PROTO/d' $* > $$out \
+ && { diff -u $$in $$out > $$diffs; test $$? -eq 1; } \
+ && added=`grep -v '^+++ ' $$diffs | grep -c '^+'` \
+ && removed=`grep -v '^--- ' $$diffs | grep -c '^-'` \
+ && test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
|| { \
echo "Found unexpected diffs between $*.in and $*"; \
echo "Lines added: $$added" ; \
echo "Lines removed: $$removed"; \
- cat $$tmp >&2; \
+ cat $$diffs; \
exit 1; \
- } >&1; \
- rm -f $$tmp
+ } >&2; \
+ rm -f $$in $$out $$diffs
## Expect no instances of '${...}'. However, $${...} is ok, since that
## is a shell construct, not a Makefile construct.