From 04688283cde4388cbea5c8b7ea5d418d14338363 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 2 Jan 1996 02:19:43 +0000 Subject: [PATCH] Many changes from Franc,ois --- ChangeLog | 41 ++++++ Makefile.am | 2 +- Makefile.in | 49 ++----- automake.in | 308 +++++++++++++++++++++++++----------------- clean-kr.am | 1 - clean.am | 1 - compile-kr.am | 1 - compile-vars.am | 1 - compile.am | 2 +- data.am | 1 - depend.am | 3 +- dist-subd-top.am | 1 - dist-subd.am | 1 - dist-vars.am | 1 - dist.am | 1 - footer.am | 1 - header-vars.am | 18 --- kr-vars.am | 1 - lib/am/Makefile.am | 2 +- lib/am/clean.am | 1 - lib/am/compile.am | 2 +- lib/am/data.am | 1 - lib/am/depend.am | 3 +- lib/am/footer.am | 1 - lib/am/header-vars.am | 18 --- lib/am/library.am | 1 - lib/am/mans-vars.am | 1 - lib/am/program.am | 1 - lib/am/remake-hdr.am | 1 - lib/am/scripts.am | 1 - lib/am/subdirs.am | 1 - lib/am/tags.am | 1 - lib/am/texinfos.am | 1 - libraries-clean.am | 1 - libraries-vars.am | 1 - libraries.am | 1 - library.am | 1 - mans-vars.am | 1 - program.am | 1 - programs-clean.am | 1 - programs.am | 1 - remake-hdr.am | 1 - remake-subd.am | 1 - remake.am | 1 - scripts-clean.am | 1 - scripts.am | 1 - subdirs.am | 1 - tags-clean.am | 1 - tags-subd.am | 5 +- tags.am | 1 - texi-clean.am | 1 - texi-version.am | 1 - texinfos-vars.am | 1 - texinfos.am | 1 - 54 files changed, 246 insertions(+), 249 deletions(-) diff --git a/ChangeLog b/ChangeLog index ffb2b3a6..87e43895 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,46 @@ Mon Jan 1 15:43:25 1996 Tom Tromey + * automake.in (handle_merge_targets): 'check' target depends on + 'all'. + (file_contents): Don't be so verbose. + (read_am_file): Ditto. + (read_am_file): Must use substr to check for trailing \. + (am_install_var): Use push_phony_cleaners. + (file_contents): Set $was_rule when assuming a rule is seen. + (read_am_file): Ditto. + (do_one_clean_target): Removed spurious newline. + + Some changes from François Pinard: + * Removed trailing whitespace from all '.am' files. + * tags-subd.am (ID): Use &&, not ;. + (TAGS): Ditto. + * automake.in (parse_arguments): Removed useless message. + (parse_arguments): Don't explicitly referenced STDERR. + (require_argument): Ditto. + (am_error): Ditto. + (set_strictness): Ditto. + (file_contents): Ditto. + (read_am_file): Ditto. + (generate_makefile): Style tweaks. + (handle_programs): Ditto. + (handle_libraries): Ditto. + (handle_texinfo): Ditto. + (handle_man_pages): Ditto. + (handle_tags): Ditto. + (handle_dist): Ditto. + (handle_subdirs): Ditto. + (handle_configure): Ditto. + (handle_footer): Don't put newline before footer.am contents. + (handle_merge_targets): Style tweaks. + (do_one_clean_target): Ditto. + (dirname): Ditto. + (am_variable): Ditto. + Defined some new constants. + (generate_makefile): Don't call generate_header. + (generate_header): Removed. + (file_contents): Rewrote. + (read_am_file): Rewrote. + * automake.in (generate_makefile): Handle phony target. (do_one_clean_target): Pretty-print dependencies. (handle_installdirs): Pretty-print rule. diff --git a/Makefile.am b/Makefile.am index 3ede9f99..f818a14d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -49,7 +49,7 @@ automake: automake.in # Tag before making distribution. Also, don't make a distribution if # checks fail. Also, make sure the NEWS file is up-to-date. cvs-dist: maintainer-check - if sed 1q NEWS | grep -e "$(VERSION)"; then :; else \ + @if sed 1q NEWS | grep -e "$(VERSION)"; then :; else \ echo "NEWS not updated; not releasing" 1>&2; \ exit 1; \ fi diff --git a/Makefile.in b/Makefile.in index 3cf67fa6..8e6e7749 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,20 +1,5 @@ # Makefile.in generated automatically by automake 0.26 from Makefile.am -# Copyright (C) 1994, 1995 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. SHELL = /bin/sh @@ -72,13 +57,11 @@ DIST_SUBDIRS = samples/cpio/*Makefile.am # The following requires a fixed version of the Emacs 19.30 etags. ETAGS_ARGS = automake.in --lang=none \ --regex='/^@node[ \t]+\([^,]+\)/\1/' automake.texi - - SCRIPTS= $(bin_SCRIPTS) + MAKEINFO = makeinfo TEXI2DVI = texi2dvi - INFOS = automake.info* INFO_DEPS = automake.info DVIS = automake.dvi @@ -90,14 +73,15 @@ DIST_COMMON = mkinstalldirs configure Makefile.in stamp-vti configure.in \ ChangeLog THANKS README version.texi mdate-sh TODO INSTALL Makefile.am \ texinfo.tex NEWS aclocal.m4 install-sh + PACKAGE = @PACKAGE@ VERSION = @VERSION@ DISTFILES = $(SOURCES) $(HEADERS) $(TEXINFOS) $(INFOS) $(MANS) \ $(DIST_OTHER) $(DIST_COMMON) $(DATA) - default: all + mostlyclean-binSCRIPTS: clean-binSCRIPTS: @@ -143,9 +127,9 @@ distclean-vti: maintainer-clean-vti: rm -f stamp-vti version.texi - automake.info: automake.texi version.texi + .texi.info: $(MAKEINFO) -I$(srcdir) $< @@ -208,12 +192,12 @@ $(srcdir)/configure: configure.in $(ACLOCAL) id: ID ID: - here=`pwd`; cd $(srcdir) && mkid -f $$here/ID $(SOURCES) $(HEADERS) + here=`pwd` && cd $(srcdir) && mkid -f $$here/ID $(SOURCES) $(HEADERS) tags: TAGS TAGS: - here=`pwd`; cd $(srcdir) && etags $(ETAGS_ARGS) $(SOURCES) $(HEADERS) -o $$here/TAGS + here=`pwd` && cd $(srcdir) && etags $(ETAGS_ARGS) $(SOURCES) $(HEADERS) -o $$here/TAGS mostlyclean-tags: @@ -242,14 +226,13 @@ dist: $(DISTFILES) chmod -R a+r $(distdir) tar -chozf $(distdir).tar.gz $(distdir) rm -rf $(distdir) - all: info $(SCRIPTS) $(DATA) info: $(INFO_DEPS) dvi: $(DVIS) -check: +check: all installcheck: @@ -265,6 +248,7 @@ uninstall: uninstall-binSCRIPTS uninstall-info uninstall-pkgdataDATA installdirs: $(top_srcdir)/mkinstalldirs $(bindir) $(infodir) $(pkgdatadir) + mostlyclean-generic: test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) @@ -277,37 +261,34 @@ distclean-generic: maintainer-clean-generic: test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) - mostlyclean: mostlyclean-binSCRIPTS mostlyclean-vti mostlyclean-info \ mostlyclean-tags mostlyclean-generic - clean: clean-binSCRIPTS clean-vti clean-info clean-tags clean-generic \ mostlyclean - distclean: distclean-binSCRIPTS distclean-vti distclean-info \ distclean-tags distclean-generic clean - rm -f config.status maintainer-clean: maintainer-clean-binSCRIPTS maintainer-clean-vti \ maintainer-clean-info maintainer-clean-tags maintainer-clean-generic \ distclean - @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." rm -f config.status -.PHONY: default binSCRIPTS uninstall-binSCRIPTS mostlyclean-vti \ -distclean-vti clean-vti maintainer-clean-vti install-info \ -uninstall-info mostlyclean-info distclean-info clean-info \ +.PHONY: default mostlyclean-binSCRIPTS distclean-binSCRIPTS \ +clean-binSCRIPTS maintainer-clean-binSCRIPTS uninstall-binSCRIPTS \ +mostlyclean-vti distclean-vti clean-vti maintainer-clean-vti \ +install-info uninstall-info mostlyclean-info distclean-info clean-info \ maintainer-clean-info uninstall-pkgdataDATA tags id mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags dist all info dvi check \ installcheck install-exec install-data install uninstall installdirs \ mostlyclean-generic distclean-generic clean-generic \ maintainer-clean-generic clean mostlyclean distclean maintainer-clean + # Some simple checks: # * syntax check with perl4 and perl5. # * make sure the scripts don't use 'true' @@ -333,17 +314,15 @@ automake: automake.in # Tag before making distribution. Also, don't make a distribution if # checks fail. Also, make sure the NEWS file is up-to-date. cvs-dist: maintainer-check - if sed 1q NEWS | grep -e "$(VERSION)"; then :; else \ + @if sed 1q NEWS | grep -e "$(VERSION)"; then :; else \ echo "NEWS not updated; not releasing" 1>&2; \ exit 1; \ fi cvs tag `echo "Release-$(VERSION)" | sed 's/\./-/g'` $(MAKE) dist - .SUFFIXES: .SUFFIXES: .texi .info .dvi # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: - diff --git a/automake.in b/automake.in index 36725102..0ebcb1ba 100755 --- a/automake.in +++ b/automake.in @@ -32,7 +32,13 @@ $VERSION = "@VERSION@"; $prefix = "@prefix@"; $am_dir = "@datadir@/@PACKAGE@"; - +# String constants. +$IGNORE_PATTERN = "^##([^#].*)?\$"; +$WHITE_PATTERN = "^[ \t]*\$"; +$COMMENT_PATTERN = "^#"; +$RULE_PATTERN = "^([a-zA-Z_.][-.a-zA-Z0-9_.]*) *:"; +$MACRO_PATTERN = "^([A-Za-z][A-Za-z0-9_]*)[ \t]*=[ \t]*(.*)\$"; + # Constants to define the "strictness" level. $NORMAL = 0; @@ -150,8 +156,7 @@ sub parse_arguments } elsif ($arglist[0] =~ /^-/) { - print STDERR "automake: unrecognized option -- \`$arglist[0]'\n"; - exit 1; + die "automake: unrecognized option -- \`$arglist[0]'\n"; } else { @@ -172,15 +177,8 @@ sub parse_arguments push (@make_list, $_); } - if ($#make_list >= 0) - { - print "automake: using ", join (' ', @make_list), "\n"; - } - else - { - print STDERR "automake: no \"Makefile.am\" found or specified\n"; - exit 1; - } + die "automake: no \"Makefile.am\" found or specified\n" + if $#make_list < 0; } return (@make_list); @@ -190,11 +188,8 @@ sub parse_arguments sub require_argument { local ($arg, @arglist) = @_; - if ($#arglist >= 0) - { - print STDERR "automake: no argument given for option \`$arg'\n"; - exit 1; - } + die "automake: no argument given for option \`$arg'\n" + if $#arglist >= 0; } ################################################################ @@ -211,13 +206,8 @@ sub generate_makefile # FIXME with new 'dist' target, don't need Makefile.in. Probably # should remove it here. &push_dist_common ('Makefile.in', 'Makefile.am'); - push (@sources, '$(SOURCES)') if (defined $contents{'SOURCES'}); - push (@objects, '$(OBJECTS)') if (defined $contents{'OBJECTS'}); - - # Generate header before reading .am file. The header must come - # before anything else, and read_am_file copies code into the - # output. - &generate_header; + push (@sources, '$(SOURCES)') if defined $contents{'SOURCES'}; + push (@objects, '$(OBJECTS)') if defined $contents{'OBJECTS'}; # This is always the default target. This gives us freedom to do # things in whatever order is convenient. @@ -273,18 +263,6 @@ sub generate_makefile ################################################################ -# Generate header of Makefile.in. -sub generate_header -{ - $output_vars = - ($output_vars - . "# Makefile.in generated automatically by automake " - . $VERSION - . " from Makefile.am\n"); - - $output_vars .= &file_contents ('header-vars'); -} - # Return object extension. Just once, put some code into the output. sub get_object_extension { @@ -388,7 +366,7 @@ sub handle_programs 'programs', 'PROGRAMS', 'bin', 'sbin', 'libexec', 'noinst'); # FIXME error if PROGRAMS defined but no blah_PROGRAMS defined. - return if ($#proglist < 0); + return if $#proglist < 0; local ($obj) = &get_object_extension; local ($one_file, $munge); @@ -415,7 +393,7 @@ sub handle_libraries 'libraries', 'LIBRARIES', 'lib', 'pkglib', 'noinst'); # FIXME error if LIBRARIES defined but no blah_LIBRARIES defined. - return if ($#liblist < 0); + return if $#liblist < 0; # Generate _LIBFILES variables. Too bad we can't do this in # am_install_var. @@ -475,7 +453,7 @@ sub handle_scripts sub handle_texinfo { local ($texis) = &am_variable ('TEXINFOS'); - return if (!$texis); + return if ! $texis; local (@texis) = split (/\s+/, $texis); if ($#texis > 0) @@ -552,7 +530,7 @@ sub handle_texinfo # Handle any man pages. sub handle_man_pages { - return if (! defined $contents{'MANS'}); + return if ! defined $contents{'MANS'}; # We generate the manpage install code by hand to avoid the use of # basename in the generated Makefile. @@ -560,7 +538,8 @@ sub handle_man_pages local (%sections, %inames, %secmap, %fullsecmap); foreach (@mans) { - m/^(.*)\.([0-9])([a-z]*)$/; + # FIXME: statement without effect: + /^(.*)\.([0-9])([a-z]*)$/; $sections{$2} = 1; $inames{$1} = $_; $secmap{$1} = $2; @@ -624,12 +603,12 @@ sub handle_tags local ($tagging) = 0; push (@phony, 'tags'); - if (defined ($contents{'SUBDIRS'})) + if (defined $contents{'SUBDIRS'}) { $output_rules .= &file_contents ('tags'); $tagging = 1; } - elsif ($dir_holds_sources || defined ($contents{'ETAGS_ARGS'})) + elsif ($dir_holds_sources || defined $contents{'ETAGS_ARGS'}) { $output_rules .= &file_contents ('tags-subd'); push (@phony, 'id'); @@ -677,7 +656,7 @@ sub handle_dist } else { - $output_rules .= &file_contents (defined ($contents{'SUBDIRS'}) + $output_rules .= &file_contents (defined $contents{'SUBDIRS'} ? 'dist-subd-top' : 'dist'); } @@ -725,7 +704,7 @@ sub handle_dependencies # Handle subdirectories. sub handle_subdirs { - return if (! defined ($contents{'SUBDIRS'})); + return if ! defined $contents{'SUBDIRS'}; $output_rules .= &file_contents ('subdirs'); @@ -788,8 +767,8 @@ sub handle_configure &require_file ($NORMAL, 'mkinstalldirs'); } - if (defined ($contents{'CONFIG_HEADER'}) - && $contents{'CONFIG_HEADER'} !~ m,/,) + if (defined $contents{'CONFIG_HEADER'} + && $contents{'CONFIG_HEADER'} !~ /\//) { # Header defined and in this directory. if (-f 'acconfig.h') @@ -848,7 +827,7 @@ sub handle_footer { $output_trailer .= ".SUFFIXES: " . join (' ', @suffixes) . "\n"; } - $output_trailer .= "\n" . &file_contents ('footer'); + $output_trailer .= &file_contents ('footer'); } # Deal with installdirs target. @@ -876,6 +855,7 @@ sub handle_merge_targets &do_one_merge_target ('all', @all); &do_one_merge_target ('info', @info); &do_one_merge_target ('dvi', @dvi); + push (@check, 'all'); &do_one_merge_target ('check', @check); &do_one_merge_target ('installcheck', @installcheck); @@ -944,7 +924,7 @@ sub handle_merge_targets $output_rules .= ("install-exec: " . join (' ', @install_exec) . "\n\n"); - push (@install, 'install-exec') if (!$recursive_install); + push (@install, 'install-exec') if !$recursive_install; push (@phony, 'install-exec'); } if ($#install_data >= 0) @@ -952,7 +932,7 @@ sub handle_merge_targets $output_rules .= ("install-data: " . join (' ', @install_data) . "\n\n"); - push (@install, 'install-data') if (!$recursive_install); + push (@install, 'install-data') if !$recursive_install; push (@phony, 'install-data'); } @@ -1023,10 +1003,7 @@ sub do_one_clean_target # clean<-mostlyclean derivation). In this case the target is # implicitly known to be 'clean'. local ($flag) = $target; - if (!$flag) - { - $target = 'clean'; - } + $target = 'clean' if ! $flag; grep (($_ = $name . 'clean-' . $_) && 0, @deps); if ($flag) @@ -1037,7 +1014,6 @@ sub do_one_clean_target } } &pretty_print_rule ($name . $target . ": ", '', @deps); - $output_rules .= "\n"; # FIXME shouldn't we really print these messages before running # the dependencies? @@ -1139,30 +1115,73 @@ sub read_am_file { local ($amfile) = @_; - if (! open (AMFILE, $amfile)) - { - print STDERR "automake: couldn't open $amfile: $!\n"; - exit 1; - } + local ($header_vars) = &file_contents ('header-vars'); + + open (AM_FILE, $amfile) || die "automake: couldn't open $amfile: $!\n"; + + $output_vars .= ("# Makefile.in generated automatically by automake " + . $VERSION . " from Makefile.am\n"); local ($saw_bk) = 0; local ($was_rule) = 0; + local ($spacing) = ''; + local ($comment) = ''; local ($last_var_name) = ''; - local ($saved_comments) = ''; - while () + while () { - chop; + if (/$IGNORE_PATTERN/o) + { + # Merely delete comments beginning with two hashes. + } + elsif (/$WHITE_PATTERN/o) + { + # Stick a single white line before the incoming macro or rule. + $spacing = "\n"; + } + elsif (/$COMMENT_PATTERN/o) + { + # Stick comments before the incoming macro or rule. + $comment .= $spacing . $_; + $spacing = ''; + } + else + { + last; + } + } + + $output_vars .= $comment . "\n" . $header_vars; + $comment = ''; + $spacing = "\n"; - if ($saw_bk) + while ($_) + { + if (/$IGNORE_PATTERN/o) + { + # Merely delete comments beginning with two hashes. + } + elsif (/$WHITE_PATTERN/o) + { + # Stick a single white line before the incoming macro or rule. + $spacing = "\n"; + } + elsif (/$COMMENT_PATTERN/o) + { + # Stick comments before the incoming macro or rule. + $comment .= $spacing . $_; + $spacing = ''; + } + elsif ($saw_bk) { if ($was_rule) { - $output_trailer .= $_ . "\n"; + $output_trailer .= $_; + $saw_bk = /\\$/; } else { - $output_vars .= $_ . "\n"; + $output_vars .= $_; if (substr ($_, -1) eq "\\") { $contents{$last_var_name} .= substr ($_, 0, @@ -1172,33 +1191,25 @@ sub read_am_file { $contents{$last_var_name} .= $_; } + $saw_bk = /\\$/; } } - elsif (/^\#/) - { - # Got a comment. We save comments until we get a - # non-comment, and then we add the last comments. - $saved_comments .= $_ . "\n"; - } - elsif ($_ eq '@kr@') - { - # Special case: this means we want automatic - # de-ANSI-fication. FIXME think of a better way. - $contents{'@kr@'} = 1; - } - elsif (m/^ *([a-zA-Z_.][-.a-zA-Z0-9_.]*) *:/) + elsif (/$RULE_PATTERN/o) { + # warn "** Saw rule .$1.\n"; # Found a rule. $was_rule = 1; # Value here doesn't matter; for targets we only note # existence. $contents{$1} = 1; - $output_trailer .= $saved_comments . $_ . "\n"; - $saved_comments = ''; + $output_trailer .= $comment . $spacing . $_; + $comment = $spacing = ''; + $saw_bk = /\\$/; } - elsif (m/^ *([A-Za-z][A-Za-z0-9_]*)[ \t]*=[ \t]*(.*)$/) + elsif (/$MACRO_PATTERN/o) { - # Found a variable reference. + # warn "** Saw macro .$1.\n"; + # Found a macro definition. $was_rule = 0; $last_var_name = $1; if (substr ($2, -1) eq "\\") @@ -1209,39 +1220,30 @@ sub read_am_file { $contents{$1} = $2; } - $output_vars .= $saved_comments . $_ . "\n"; - $saved_comments = ''; + $output_vars .= $comment . $spacing . $_; + $comment = $spacing = ''; + $saw_bk = /\\$/; } - elsif (m/^$/) + elsif ($_ eq "\@kr\@\n") { - # Special rule: if looking at a blank line, append it to - # whatever we saw last. - if ($was_rule) - { - $output_trailer .= $saved_comments . "\n"; - } - else - { - $output_vars .= $saved_comments . "\n"; - } - $saved_comments = ''; + # Special case: this means we want automatic + # de-ANSI-fication. FIXME think of a better way. + $contents{'@kr@'} = 1; } else { # This isn't an error; it is probably a continued rule. # In fact, this is what we assume. - $output_trailer .= $_ . "\n"; + $was_rule = 1; + $output_trailer .= $comment . $spacing . $_; + $comment = $spacing = ''; + $saw_bk = /\\$/; } - $saw_bk = (substr ($_, -1) eq "\\"); + $_ = ; } - # Include trailing comments with variables for now. - $output_vars .= $saved_comments; - - # Include some space after user code. - $output_vars .= "\n"; - $output_trailer .= "\n"; + $output_trailer .= $comment; } ################################################################ @@ -1368,26 +1370,87 @@ sub initialize_per_input ################################################################ -# Return contents of a file from $am_dir. +# Return contents of a file from $am_dir, automatically skipping +# macros or rules which are already known. sub file_contents { local ($basename) = @_; local ($file) = $am_dir . '/' . $basename . '.am'; - if (! open (FC_FILE, $file)) - { - print STDERR "automake: installation error: cannot open \"$file\"\n"; - exit 1; - } + open (FC_FILE, $file) + || die "automake: installation error: cannot open \"$file\"\n"; + + local ($was_rule) = 0; + local ($result_vars) = ''; + local ($result_rules) = ''; + local ($comment) = ''; + local ($spacing) = "\n"; + local ($skipping) = 0; - # Lines starting with "##" are comments for developer use only. - local ($result) = ''; while () { - $result .= $_ unless ( m/^##/); + if (/$IGNORE_PATTERN/o) + { + # Merely delete comments beginning with two hashes. + } + elsif (/$WHITE_PATTERN/o) + { + # Stick a single white line before the incoming macro or rule. + $spacing = "\n"; + } + elsif (/$COMMENT_PATTERN/o) + { + # Stick comments before the incoming macro or rule. + $comment .= $spacing . $_; + $spacing = ''; + } + elsif ($saw_bk) + { + if ($was_rule) + { + $result_rules .= $_ if ! $skipping; + } + else + { + $result_vars .= $_ if ! $skipping; + } + $saw_bk = /\\$/; + } + elsif (/$RULE_PATTERN/o) + { + # warn "** Found rule .$1.\n"; + # Found a rule. + $was_rule = 1; + $skipping = defined $contents{$1}; + warn "** Skip $skipping\n" if $skipping; + $result_rules .= $comment . $spacing . $_ if ! $skipping; + $comment = $spacing = ''; + $saw_bk = /\\$/; + } + elsif (/$MACRO_PATTERN/o) + { + # warn "** Found macro .$1.\n"; + # Found a variable reference. + $was_rule = 0; + $skipping = defined $contents{$1}; + warn "** Skip $skipping\n" if $skipping; + $result_vars .= $comment . $spacing . $_ if ! $skipping; + $comment = $spacing = ''; + $saw_bk = /\\$/; + } + else + { + # This isn't an error; it is probably a continued rule. + # In fact, this is what we assume. + $was_rule = 1; + $result_rules .= $comment . $spacing . $_ if ! $skipping; + $comment = $spacing = ''; + $saw_bk = /\\$/; + } } + close (FC_FILE); - return $result; + return $result_vars . $result_rules . $comment; } # Return contents of some Makefile.am variable. Allow for AM_ style @@ -1396,7 +1459,7 @@ sub am_variable { local ($varname) = @_; - return (defined ($contents{'AM_' . $varname}) + return (defined $contents{'AM_' . $varname} ? $contents{'AM_' . $varname} : $contents{$varname}); } @@ -1455,7 +1518,7 @@ sub am_install_var ($munge = $clean_templ) =~ s/\@DIR\@/$_/g; $output_rules .= $munge; push (@clean, $_ . $primary); - push (@phony, $_ . $primary); + &push_phony_cleaners ($_ . $primary); } push (@used, '$(' . $one_name . ')'); @@ -1586,8 +1649,7 @@ sub set_strictness } else { - print STDERR "automake: level \`$name' not recognized\n"; - exit 1; + die "automake: level \`$name' not recognized\n"; } } @@ -1601,11 +1663,7 @@ sub dirname local ($sub); ($sub = $file) =~ s,/+[^/]+,,g; - if ($sub eq $file) - { - $sub = '.'; - } - + $sub = '.' if $sub eq $file; return $sub; } @@ -1621,7 +1679,7 @@ sub mkdir # Print an error message and set exit status. sub am_error { - print STDERR "automake: ${am_file}.am: ", join (' ', @_), "\n"; + warn "automake: ${am_file}.am: ", join (' ', @_), "\n"; $exit_status = 1; } diff --git a/clean-kr.am b/clean-kr.am index 5938cb5e..c6fdbdc5 100644 --- a/clean-kr.am +++ b/clean-kr.am @@ -7,4 +7,3 @@ distclean-kr: rm -f ansi2knr maintainer-clean-kr: - diff --git a/clean.am b/clean.am index 927272bd..85618968 100644 --- a/clean.am +++ b/clean.am @@ -12,4 +12,3 @@ distclean-generic: maintainer-clean-generic: test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) - diff --git a/compile-kr.am b/compile-kr.am index f014f541..8c2ef453 100644 --- a/compile-kr.am +++ b/compile-kr.am @@ -17,4 +17,3 @@ ansi2knr: ansi2knr.o $(OBJECTS): $(ANSI2KNR) ansi2knr.o: $(CONFIG_HEADER) - diff --git a/compile-vars.am b/compile-vars.am index 41ea7711..d44f6c84 100644 --- a/compile-vars.am +++ b/compile-vars.am @@ -10,4 +10,3 @@ LIBS = @LIBS@ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) LINK = $(CC) $(LDFLAGS) -o $@ - diff --git a/compile.am b/compile.am index 36371bca..2570db79 100644 --- a/compile.am +++ b/compile.am @@ -2,6 +2,7 @@ $(COMPILE) $< mostlyclean-compile: +## Don't remove 'core.*' because some distributions have eg "core.c". rm -f *.o core clean-compile: @@ -10,4 +11,3 @@ distclean-compile: rm -f *.tab.c maintainer-clean-compile: - diff --git a/data.am b/data.am index f07b81e8..64270a5b 100644 --- a/data.am +++ b/data.am @@ -8,4 +8,3 @@ uninstall-@DIR@DATA: for p in $(@DIR@_DATA); do \ rm -f $(@DIR@dir)/$$p; \ done - diff --git a/depend.am b/depend.am index 25b74a8c..2ebc5d6c 100644 --- a/depend.am +++ b/depend.am @@ -22,8 +22,7 @@ $(DEP_FILES): $(srcdir)/.deps/.P $(srcdir)/.deps/%.P: $(srcdir)/%.c @echo "mkdeps $< > $@" - @$(MKDEP) $< > $@-tmp + @$(MKDEP) $< | sed 's,$(srcdir)/,,g' > $@-tmp @mv $@-tmp $@ # End of maintainer-only section - diff --git a/dist-subd-top.am b/dist-subd-top.am index 34d2a7e1..85b135b7 100644 --- a/dist-subd-top.am +++ b/dist-subd-top.am @@ -35,4 +35,3 @@ dist: $(DISTFILES) chmod -R a+r $(distdir) tar -chozf $(distdir).tar.gz $(distdir) rm -rf $(distdir) - diff --git a/dist-subd.am b/dist-subd.am index 826cc53c..1ea36ae9 100644 --- a/dist-subd.am +++ b/dist-subd.am @@ -6,4 +6,3 @@ dist: $(DISTFILES) || ln $(srcdir)/$$file $(distdir)/$$file \ || cp -p $(srcdir)/$$file $(distdir)/$$file; \ done - diff --git a/dist-vars.am b/dist-vars.am index 80c8a942..71165cdf 100644 --- a/dist-vars.am +++ b/dist-vars.am @@ -3,4 +3,3 @@ VERSION = @VERSION@ DISTFILES = $(SOURCES) $(HEADERS) $(TEXINFOS) $(INFOS) $(MANS) \ $(DIST_OTHER) $(DIST_COMMON) $(DATA) - diff --git a/dist.am b/dist.am index aaf07626..391b2642 100644 --- a/dist.am +++ b/dist.am @@ -17,4 +17,3 @@ dist: $(DISTFILES) chmod -R a+r $(distdir) tar -chozf $(distdir).tar.gz $(distdir) rm -rf $(distdir) - diff --git a/footer.am b/footer.am index ddf006f2..739cc538 100644 --- a/footer.am +++ b/footer.am @@ -1,4 +1,3 @@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: - diff --git a/header-vars.am b/header-vars.am index df4831d3..1cfd360e 100644 --- a/header-vars.am +++ b/header-vars.am @@ -1,20 +1,3 @@ -# Copyright (C) 1994, 1995 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. - SHELL = /bin/sh srcdir = @srcdir@ @@ -46,4 +29,3 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ - diff --git a/kr-vars.am b/kr-vars.am index a5f77e47..1dd941dc 100644 --- a/kr-vars.am +++ b/kr-vars.am @@ -1,3 +1,2 @@ ANSI2KNR = @ANSI2KNR@ kr = @U@ - diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index 3ede9f99..f818a14d 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -49,7 +49,7 @@ automake: automake.in # Tag before making distribution. Also, don't make a distribution if # checks fail. Also, make sure the NEWS file is up-to-date. cvs-dist: maintainer-check - if sed 1q NEWS | grep -e "$(VERSION)"; then :; else \ + @if sed 1q NEWS | grep -e "$(VERSION)"; then :; else \ echo "NEWS not updated; not releasing" 1>&2; \ exit 1; \ fi diff --git a/lib/am/clean.am b/lib/am/clean.am index 927272bd..85618968 100644 --- a/lib/am/clean.am +++ b/lib/am/clean.am @@ -12,4 +12,3 @@ distclean-generic: maintainer-clean-generic: test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) - diff --git a/lib/am/compile.am b/lib/am/compile.am index 36371bca..2570db79 100644 --- a/lib/am/compile.am +++ b/lib/am/compile.am @@ -2,6 +2,7 @@ $(COMPILE) $< mostlyclean-compile: +## Don't remove 'core.*' because some distributions have eg "core.c". rm -f *.o core clean-compile: @@ -10,4 +11,3 @@ distclean-compile: rm -f *.tab.c maintainer-clean-compile: - diff --git a/lib/am/data.am b/lib/am/data.am index f07b81e8..64270a5b 100644 --- a/lib/am/data.am +++ b/lib/am/data.am @@ -8,4 +8,3 @@ uninstall-@DIR@DATA: for p in $(@DIR@_DATA); do \ rm -f $(@DIR@dir)/$$p; \ done - diff --git a/lib/am/depend.am b/lib/am/depend.am index 25b74a8c..2ebc5d6c 100644 --- a/lib/am/depend.am +++ b/lib/am/depend.am @@ -22,8 +22,7 @@ $(DEP_FILES): $(srcdir)/.deps/.P $(srcdir)/.deps/%.P: $(srcdir)/%.c @echo "mkdeps $< > $@" - @$(MKDEP) $< > $@-tmp + @$(MKDEP) $< | sed 's,$(srcdir)/,,g' > $@-tmp @mv $@-tmp $@ # End of maintainer-only section - diff --git a/lib/am/footer.am b/lib/am/footer.am index ddf006f2..739cc538 100644 --- a/lib/am/footer.am +++ b/lib/am/footer.am @@ -1,4 +1,3 @@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: - diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am index df4831d3..1cfd360e 100644 --- a/lib/am/header-vars.am +++ b/lib/am/header-vars.am @@ -1,20 +1,3 @@ -# Copyright (C) 1994, 1995 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. - SHELL = /bin/sh srcdir = @srcdir@ @@ -46,4 +29,3 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ - diff --git a/lib/am/library.am b/lib/am/library.am index f45e6327..e8e75502 100644 --- a/lib/am/library.am +++ b/lib/am/library.am @@ -2,4 +2,3 @@ lib@LIBRARY@.a: $(@LIBRARY@_OBJECTS) $(@LIBRARY@_LIBADD) rm -f lib@LIBRARY@.a $(AR) cru lib@LIBRARY@.a $(@LIBRARY@_OBJECTS) $(@LIBRARY@_LIBADD) $(RANLIB) lib@LIBRARY@.a - diff --git a/lib/am/mans-vars.am b/lib/am/mans-vars.am index d0f97231..2c447038 100644 --- a/lib/am/mans-vars.am +++ b/lib/am/mans-vars.am @@ -1,2 +1 @@ NROFF = nroff - diff --git a/lib/am/program.am b/lib/am/program.am index da987935..f37fd916 100644 --- a/lib/am/program.am +++ b/lib/am/program.am @@ -1,3 +1,2 @@ @PROGRAM@: $(@PROGRAM@_OBJECTS) $(LINK) $(@PROGRAM@_OBJECTS) $(@PROGRAM@_LDADD) $(LIBS) - diff --git a/lib/am/remake-hdr.am b/lib/am/remake-hdr.am index a7475d20..5c1cd8e2 100644 --- a/lib/am/remake-hdr.am +++ b/lib/am/remake-hdr.am @@ -5,4 +5,3 @@ $(srcdir)/$(CONFIG_HEADER).in: stamp-h.in $(srcdir)/stamp-h.in: configure.in $(ACLOCAL) $(ACCONFIG) $(CONFIG_TOP) $(CONFIG_BOT) cd $(srcdir) && autoheader echo timestamp > $(srcdir)/stamp-h.in - diff --git a/lib/am/scripts.am b/lib/am/scripts.am index 0ea6734b..382ff82e 100644 --- a/lib/am/scripts.am +++ b/lib/am/scripts.am @@ -10,4 +10,3 @@ uninstall-@DIR@SCRIPTS: for p in $(@DIR@_SCRIPTS); do \ rm -f $(@DIR@dir)/`echo $$p|sed '$(transform)'`; \ done - diff --git a/lib/am/subdirs.am b/lib/am/subdirs.am index c835340c..6d6a666a 100644 --- a/lib/am/subdirs.am +++ b/lib/am/subdirs.am @@ -20,4 +20,3 @@ maintainer-clean-recursive: ## recursive rule. || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" - diff --git a/lib/am/tags.am b/lib/am/tags.am index 0b718ed9..1ef7e447 100644 --- a/lib/am/tags.am +++ b/lib/am/tags.am @@ -13,4 +13,3 @@ TAGS: ## Make sure we have something to run etags on. test -z "$(ETAGS_ARGS)$(CONFIG_HEADER)$(SOURCES)$(HEADERS)$$tags" \ || etags $(ETAGS_ARGS) $$tags $(CONFIG_HEADER) $(SOURCES) $(HEADERS) - diff --git a/lib/am/texinfos.am b/lib/am/texinfos.am index aa4d9e10..7fb2d5a4 100644 --- a/lib/am/texinfos.am +++ b/lib/am/texinfos.am @@ -32,4 +32,3 @@ uninstall-info: cd $(srcdir) && for file in *.info*; do \ rm -f $(infodir)/$$file; \ done - diff --git a/libraries-clean.am b/libraries-clean.am index b232e69c..07687cf9 100644 --- a/libraries-clean.am +++ b/libraries-clean.am @@ -6,4 +6,3 @@ clean-@DIR@LIBRARIES: distclean-@DIR@LIBRARIES: maintainer-clean-@DIR@LIBRARIES: - diff --git a/libraries-vars.am b/libraries-vars.am index 42d214ba..ee51c070 100644 --- a/libraries-vars.am +++ b/libraries-vars.am @@ -1,3 +1,2 @@ AR = ar RANLIB = @RANLIB@ - diff --git a/libraries.am b/libraries.am index 3f88d422..f52a460b 100644 --- a/libraries.am +++ b/libraries.am @@ -12,4 +12,3 @@ uninstall-@DIR@LIBRARIES: for p in $(@DIR@_LIBFILES); do \ rm -f $(@DIR@dir)/$$p; \ done - diff --git a/library.am b/library.am index f45e6327..e8e75502 100644 --- a/library.am +++ b/library.am @@ -2,4 +2,3 @@ lib@LIBRARY@.a: $(@LIBRARY@_OBJECTS) $(@LIBRARY@_LIBADD) rm -f lib@LIBRARY@.a $(AR) cru lib@LIBRARY@.a $(@LIBRARY@_OBJECTS) $(@LIBRARY@_LIBADD) $(RANLIB) lib@LIBRARY@.a - diff --git a/mans-vars.am b/mans-vars.am index d0f97231..2c447038 100644 --- a/mans-vars.am +++ b/mans-vars.am @@ -1,2 +1 @@ NROFF = nroff - diff --git a/program.am b/program.am index da987935..f37fd916 100644 --- a/program.am +++ b/program.am @@ -1,3 +1,2 @@ @PROGRAM@: $(@PROGRAM@_OBJECTS) $(LINK) $(@PROGRAM@_OBJECTS) $(@PROGRAM@_LDADD) $(LIBS) - diff --git a/programs-clean.am b/programs-clean.am index 84f2f64e..d0e57f62 100644 --- a/programs-clean.am +++ b/programs-clean.am @@ -6,4 +6,3 @@ clean-@DIR@PROGRAMS: distclean-@DIR@PROGRAMS: maintainer-clean-@DIR@PROGRAMS: - diff --git a/programs.am b/programs.am index dd8e62d1..91055b45 100644 --- a/programs.am +++ b/programs.am @@ -10,4 +10,3 @@ uninstall-@DIR@PROGRAMS: for p in $(@DIR@_PROGRAMS); do \ rm -f $(@DIR@dir)/`echo $$p|sed '$(transform)'`; \ done - diff --git a/remake-hdr.am b/remake-hdr.am index a7475d20..5c1cd8e2 100644 --- a/remake-hdr.am +++ b/remake-hdr.am @@ -5,4 +5,3 @@ $(srcdir)/$(CONFIG_HEADER).in: stamp-h.in $(srcdir)/stamp-h.in: configure.in $(ACLOCAL) $(ACCONFIG) $(CONFIG_TOP) $(CONFIG_BOT) cd $(srcdir) && autoheader echo timestamp > $(srcdir)/stamp-h.in - diff --git a/remake-subd.am b/remake-subd.am index 59188ac0..4c4739f8 100644 --- a/remake-subd.am +++ b/remake-subd.am @@ -3,4 +3,3 @@ $(srcdir)/Makefile.in: Makefile.am Makefile: ../config.status Makefile.in cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status - diff --git a/remake.am b/remake.am index bb9b9edb..15b5c238 100644 --- a/remake.am +++ b/remake.am @@ -9,4 +9,3 @@ config.status: configure ./config.status --recheck $(srcdir)/configure: configure.in $(ACLOCAL) cd $(srcdir) && autoconf - diff --git a/scripts-clean.am b/scripts-clean.am index 3ee5d191..3abceee6 100644 --- a/scripts-clean.am +++ b/scripts-clean.am @@ -6,4 +6,3 @@ clean-@DIR@SCRIPTS: distclean-@DIR@SCRIPTS: maintainer-clean-@DIR@SCRIPTS: - diff --git a/scripts.am b/scripts.am index 0ea6734b..382ff82e 100644 --- a/scripts.am +++ b/scripts.am @@ -10,4 +10,3 @@ uninstall-@DIR@SCRIPTS: for p in $(@DIR@_SCRIPTS); do \ rm -f $(@DIR@dir)/`echo $$p|sed '$(transform)'`; \ done - diff --git a/subdirs.am b/subdirs.am index c835340c..6d6a666a 100644 --- a/subdirs.am +++ b/subdirs.am @@ -20,4 +20,3 @@ maintainer-clean-recursive: ## recursive rule. || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" - diff --git a/tags-clean.am b/tags-clean.am index 6f32baf9..f97233db 100644 --- a/tags-clean.am +++ b/tags-clean.am @@ -6,4 +6,3 @@ distclean-tags: rm -f TAGS ID maintainer-clean-tags: - diff --git a/tags-subd.am b/tags-subd.am index c8d21200..69db3b7c 100644 --- a/tags-subd.am +++ b/tags-subd.am @@ -1,10 +1,9 @@ id: ID ID: - here=`pwd`; cd $(srcdir) && mkid -f $$here/ID $(SOURCES) $(HEADERS) + here=`pwd` && cd $(srcdir) && mkid -f $$here/ID $(SOURCES) $(HEADERS) tags: TAGS TAGS: - here=`pwd`; cd $(srcdir) && etags $(ETAGS_ARGS) $(SOURCES) $(HEADERS) -o $$here/TAGS - + here=`pwd` && cd $(srcdir) && etags $(ETAGS_ARGS) $(SOURCES) $(HEADERS) -o $$here/TAGS diff --git a/tags.am b/tags.am index 0b718ed9..1ef7e447 100644 --- a/tags.am +++ b/tags.am @@ -13,4 +13,3 @@ TAGS: ## Make sure we have something to run etags on. test -z "$(ETAGS_ARGS)$(CONFIG_HEADER)$(SOURCES)$(HEADERS)$$tags" \ || etags $(ETAGS_ARGS) $$tags $(CONFIG_HEADER) $(SOURCES) $(HEADERS) - diff --git a/texi-clean.am b/texi-clean.am index 4da74941..a691e378 100644 --- a/texi-clean.am +++ b/texi-clean.am @@ -12,4 +12,3 @@ distclean-info: maintainer-clean-info: rm -f $(INFOS) - diff --git a/texi-version.am b/texi-version.am index 62b5d44d..b9cc8dc2 100644 --- a/texi-version.am +++ b/texi-version.am @@ -23,4 +23,3 @@ distclean-vti: maintainer-clean-vti: rm -f stamp-vti version.texi - diff --git a/texinfos-vars.am b/texinfos-vars.am index de1b8179..8f6dade7 100644 --- a/texinfos-vars.am +++ b/texinfos-vars.am @@ -1,3 +1,2 @@ MAKEINFO = makeinfo TEXI2DVI = texi2dvi - diff --git a/texinfos.am b/texinfos.am index aa4d9e10..7fb2d5a4 100644 --- a/texinfos.am +++ b/texinfos.am @@ -32,4 +32,3 @@ uninstall-info: cd $(srcdir) && for file in *.info*; do \ rm -f $(infodir)/$$file; \ done - -- 2.43.5