Index: ChangeLog
from Akim Demaille <[EMAIL PROTECTED]>
* automake.in (@installdirs): Remove.
(&file_contents): Be able to grow Automake macros with `+='.
(&handle_texinfo, &handle_man_pages, &am_install_var): Let your
files define INSTALLDIRS.
(&handle_installdirs): Remove the code, just output `install.am'.
(&handle_factored_dependencies): Uniq dependencies.
(&transform): Also call &transform_cond on your arguments.
(&handle_dist): Adjust.
* data.am, header.am, libs.am, lisp.am, ltlib.am, mans.am, progs.am,
* python.am, scripts.am, texinfos.am: Extend $(INSTALLDIRS).
Index: Makefile.in
--- Makefile.in Thu, 22 Feb 2001 22:00:07 +0100 akim (am/h/16_Makefile.i 1.19 644)
+++ Makefile.in Sat, 24 Feb 2001 15:37:22 +0100 akim (am/h/16_Makefile.i 1.19 644)
@@ -153,7 +153,6 @@
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL)
./config.status
aclocal: $(top_builddir)/config.status aclocal.in
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL)
./config.status
-
install-binSCRIPTS: $(bin_SCRIPTS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@@ -246,7 +245,6 @@
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
.dvi.ps:
$(DVIPS) $< -o $@
-
install-info-am: $(INFO_DEPS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(infodir)
@@ -312,7 +310,6 @@
rm -f $$i-[0-9]*; \
fi; \
done
-
install-dist_pkgdataDATA: $(dist_pkgdata_DATA)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(pkgdatadir)
@@ -330,7 +327,6 @@
echo " rm -f $(DESTDIR)$(pkgdatadir)/$$f"; \
rm -f $(DESTDIR)$(pkgdatadir)/$$f; \
done
-
install-dist_scriptDATA: $(dist_script_DATA)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(scriptdir)
@@ -537,12 +533,10 @@
all-am: Makefile $(INFO_DEPS) $(SCRIPTS) $(DATA)
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
+
installdirs: installdirs-recursive
installdirs-am:
- $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(infodir) \
- $(DESTDIR)$(dist_pkgdatadir) \
- $(DESTDIR)$(dist_scriptdir)
-
+ $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(infodir)
+$(DESTDIR)$(pkgdatadir) $(DESTDIR)$(scriptdir)
mostlyclean-generic:
Index: automake.in
--- automake.in Sat, 24 Feb 2001 15:01:49 +0100 akim (am/f/39_automake.i 1.72 755)
+++ automake.in Sat, 24 Feb 2001 15:37:04 +0100 akim (am/f/39_automake.i 1.72 755)
@@ -2438,7 +2438,6 @@ sub handle_texinfo
if (! defined $options{'no-installinfo'})
{
- push (@installdirs, '$(DESTDIR)$(infodir)');
# Make sure documentation is made and installed first. Use
# $(INFO_DEPS), not 'info', because otherwise recursive makes
# get run twice during "make all".
@@ -2511,8 +2510,6 @@ sub handle_man_pages
foreach my $sect (sort keys %sections)
{
&define_variable ('man' . $sect . 'dir', '$(mandir)/man' . $sect);
- push (@installdirs, '$(DESTDIR)$(mandir)/man' . $sect)
- unless defined $options{'no-installman'};
$output_rules .= &file_contents ('mans',
&transform ('SECTION', $sect));
}
@@ -2780,9 +2777,7 @@ sub handle_dist
$xform
. &transform ('DIST-TARGETS' => join (" ", @dist_targets),
'TOP_DISTDIR' => $top_distdir)
- . &transform_cond ('DIST-TARGETS' =>
- scalar @dist_targets,
- 'DISTDIR' =>
+ . &transform_cond ('DISTDIR' =>
! &variable_defined ('distdir')));
}
@@ -3529,26 +3524,9 @@ sub handle_footer
# Deal with installdirs target.
sub handle_installdirs
{
- # GNU Makefile standards recommend this.
- if (&variable_defined ('SUBDIRS'))
- {
- # We create a separate `-am' target so that the -recursive
- # rule will work correctly.
- $output_rules .= ("installdirs: installdirs-recursive\n"
- . "installdirs-am:\n");
- &depend ('.PHONY', 'installdirs-am');
- }
- else
- {
- $output_rules .= "installdirs:\n";
- }
- &depend ('.PHONY', 'installdirs');
- if (@installdirs)
- {
- &pretty_print_rule ("\t" . '$(mkinstalldirs) ', "\t\t",
- @installdirs);
- }
- $output_rules .= "\n";
+ $output_rules .= &file_contents
+ ('install',
+ transform ('INSTALLDIRS' => $am_var_defs{'INSTALLDIRS'}));
}
# There are several targets which need to be merged. This is because
@@ -3867,7 +3845,7 @@ sub handle_factored_dependencies
next
unless @{$dependencies{$_}} || $actions{$_};
&pretty_print_rule ("$_:", "\t",
- sort @{$dependencies{$_}});
+ uniq (sort @{$dependencies{$_}}));
$output_rules .= $actions{$_};
$output_rules .= "\n";
}
@@ -6516,8 +6494,6 @@ sub initialize_per_input
%dist_dirs = ();
# List of dependencies for the obvious targets.
- @installdirs = ();
-
@info = ();
@dvi = ();
@all = ();
@@ -6831,12 +6807,21 @@ sub file_contents
}
elsif (/$MACRO_PATTERN/mso)
{
- $result_vars .= "$separator$comment$_\n"
- unless defined $contents{$1};
- $comment = $separator = '';
- &prog_error ("$file:$.: macro \`$1' with trailing backslash")
+ my ($var, $type, $val) = ($1, $2, $3);
+ &prog_error ("$file:$.: macro \`$var' with trailing backslash")
if /\\$/;;
- $am_var_defs{$1} = $3;
+ # Accumulating variables must not be output.
+ if ($type eq '+')
+ {
+ $am_var_defs{$var} .= ($am_var_defs{$var} && ' ') . $val;
+ }
+ else
+ {
+ $am_var_defs{$var} = $val;
+ $result_vars .= "$separator$comment$_\n"
+ unless defined $contents{$var};
+ }
+ $comment = $separator = '';
}
else
{
@@ -6855,16 +6840,19 @@ sub file_contents
# &transform (%PAIRS)
# -------------------
# Create a replacement expression suitable for file_contents
-# to replace each key of %PAIRS by its value.
+# to replace each key of %PAIRS by its value. Also uses &transform_cond
+# on %PAIRS.
sub transform (%)
{
my (%pairs) = @_;
my $result = '';
- foreach my $token (sort keys %pairs)
+ while (my ($token, $val) = each %pairs)
{
- $result .= "s/\Q\@$token\@\E/\Q$pairs{$token}\E/g;";
+ $result .= "s/\Q\@$token\@\E/\Q$val\E/g;";
}
+
+ $result .= &transform_cond (%pairs);
return $result;
}
@@ -6880,9 +6868,9 @@ sub transform_cond (%)
my (%pairs) = @_;
my $result = '';
- foreach my $token (sort keys %pairs)
+ while (my ($token, $val) = each %pairs)
{
- if ($pairs{$token})
+ if ($val)
{
$result .= "s/\Q?$token?\E//g;s/^.*\Q?!$token?\E.*\$//g;";
}
@@ -7192,8 +7180,6 @@ sub am_install_var
. &transform_cond ('BASE' => $strip_subdir)
. $ltxform
. $cygxform);
-
- push (@installdirs, '$(DESTDIR)$(' . $X . 'dir)');
}
}
Index: data.am
--- data.am Wed, 21 Feb 2001 21:04:28 +0100 akim (am/g/46_data.am 1.5 644)
+++ data.am Sat, 24 Feb 2001 15:09:16 +0100 akim (am/g/46_data.am 1.5 644)
@@ -16,6 +16,7 @@
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
+INSTALLDIRS += $(DESTDIR)$(@NDIR@dir)
.PHONY install-data-am: install-@DIR@DATA
install-@DIR@DATA: $(@DIR@_DATA)
@$(NORMAL_INSTALL)
Index: header.am
--- header.am Wed, 21 Feb 2001 21:04:28 +0100 akim (am/g/38_header.am 1.6 644)
+++ header.am Sat, 24 Feb 2001 15:09:50 +0100 akim (am/g/38_header.am 1.6 644)
@@ -16,6 +16,7 @@
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
+INSTALLDIRS += $(DESTDIR)$(@NDIR@dir)
.PHONY install-data-am: install-@DIR@HEADERS
install-@DIR@HEADERS: $(@DIR@_HEADERS)
@$(NORMAL_INSTALL)
Index: libs.am
--- libs.am Wed, 21 Feb 2001 21:04:28 +0100 akim (am/g/32_libs.am 1.2 644)
+++ libs.am Sat, 24 Feb 2001 15:11:42 +0100 akim (am/g/32_libs.am 1.2 644)
@@ -1,5 +1,5 @@
## automake - create Makefile.in from Makefile.am
-## Copyright 1994, 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
+## Copyright 1994, 1995, 1996, 1998, 1999, 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
@@ -16,6 +16,7 @@
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
+INSTALLDIRS += $(DESTDIR)$(@NDIR@dir)
.PHONY install-exec-am: install-@DIR@LIBRARIES
install-@DIR@LIBRARIES: $(@DIR@_LIBRARIES)
@$(NORMAL_INSTALL)
Index: lisp.am
--- lisp.am Wed, 21 Feb 2001 21:04:28 +0100 akim (am/g/29_lisp.am 1.6 644)
+++ lisp.am Sat, 24 Feb 2001 15:10:35 +0100 akim (am/g/29_lisp.am 1.6 644)
@@ -16,6 +16,7 @@
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
+INSTALLDIRS += $(DESTDIR)$(@NDIR@dir)
.PHONY install-data-am: install-@DIR@LISP
install-@DIR@LISP: $(@DIR@_LISP) $(ELCFILES)
@$(NORMAL_INSTALL)
Index: ltlib.am
--- ltlib.am Wed, 21 Feb 2001 21:04:28 +0100 akim (am/g/27_ltlib.am 1.2 644)
+++ ltlib.am Sat, 24 Feb 2001 15:10:51 +0100 akim (am/g/27_ltlib.am 1.2 644)
@@ -17,6 +17,7 @@
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
+INSTALLDIRS += $(DESTDIR)$(@NDIR@dir)
.PHONY install-exec-am: install-@DIR@LTLIBRARIES
install-@DIR@LTLIBRARIES: $(@DIR@_LTLIBRARIES)
@$(NORMAL_INSTALL)
Index: mans.am
--- mans.am Thu, 22 Feb 2001 20:30:43 +0100 akim (am/g/24_mans.am 1.5 644)
+++ mans.am Sat, 24 Feb 2001 15:14:13 +0100 akim (am/g/24_mans.am 1.5 644)
@@ -16,6 +16,7 @@
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
+?INSTALL_MAN?INSTALLDIRS += $(DESTDIR)$(man@SECTION@dir)
.PHONY install-man: install-man@SECTION@
install-man@SECTION@: $(man@SECTION@_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
Index: progs.am
--- progs.am Wed, 21 Feb 2001 21:04:28 +0100 akim (am/g/20_progs.am 1.2 644)
+++ progs.am Sat, 24 Feb 2001 15:08:42 +0100 akim (am/g/20_progs.am 1.2 644)
@@ -16,6 +16,7 @@
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
+INSTALLDIRS += $(DESTDIR)$(@NDIR@dir)
.PHONY install-exec-am: install-@DIR@PROGRAMS
install-@DIR@PROGRAMS: $(@DIR@_PROGRAMS)
@$(NORMAL_INSTALL)
Index: python.am
--- python.am Wed, 21 Feb 2001 21:04:28 +0100 akim (am/g/19_python.am 1.3 644)
+++ python.am Sat, 24 Feb 2001 15:12:07 +0100 akim (am/g/19_python.am 1.3 644)
@@ -1,5 +1,5 @@
## automake - create Makefile.in from Makefile.am
-## Copyright 1999 Free Software Foundation, Inc.
+## Copyright 1999, 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
@@ -16,6 +16,7 @@
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
+INSTALLDIRS += $(DESTDIR)$(@DIR@dir)
.PHONY install-exec-am: install-@DIR@PYTHON
install-@DIR@PYTHON: $(@DIR@_PYTHON)
@$(NORMAL_INSTALL)
Index: scripts.am
--- scripts.am Wed, 21 Feb 2001 21:04:28 +0100 akim (am/g/15_scripts.am 1.2 644)
+++ scripts.am Sat, 24 Feb 2001 15:12:23 +0100 akim (am/g/15_scripts.am 1.2 644)
@@ -1,5 +1,5 @@
## automake - create Makefile.in from Makefile.am
-## Copyright 1994, 1995, 1996, 1998, 1999 Free Software Foundation, Inc.
+## Copyright 1994, 1995, 1996, 1998, 1999, 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
@@ -16,6 +16,7 @@
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
+INSTALLDIRS += $(DESTDIR)$(@NDIR@dir)
.PHONY install-exec-am: install-@DIR@SCRIPTS
install-@DIR@SCRIPTS: $(@DIR@_SCRIPTS)
@$(NORMAL_INSTALL)
Index: texinfos.am
--- texinfos.am Wed, 21 Feb 2001 21:04:28 +0100 akim (am/g/10_texinfos.a 1.8 644)
+++ texinfos.am Sat, 24 Feb 2001 15:13:16 +0100 akim (am/g/10_texinfos.a 1.8 644)
@@ -138,6 +138,7 @@
## break a possible install-sh reference.
## Funny name due to --cygnus influence; we want to reserve
## `install-info' for the user.
+?INSTALL-INFO?INSTALLDIRS += $(DESTDIR)$(infodir)
.PHONY: install-info-am
?INSTALL-INFO?install-data-am: install-info-am
install-info-am: $(INFO_DEPS)
Index: m4/Makefile.in
--- m4/Makefile.in Wed, 21 Feb 2001 21:04:28 +0100 akim (am/h/15_Makefile.i 1.14 644)
+++ m4/Makefile.in Sat, 24 Feb 2001 15:37:24 +0100 akim (am/h/15_Makefile.i 1.14 644)
@@ -99,7 +99,6 @@
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL)
./config.status
-
install-m4dataDATA: $(m4data_DATA)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(m4datadir)
@@ -155,9 +154,9 @@
all-am: Makefile $(DATA)
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
-installdirs:
- $(mkinstalldirs) $(DESTDIR)$(m4datadir)
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(m4datadir)
mostlyclean-generic:
Index: tests/Makefile.in
--- tests/Makefile.in Sat, 24 Feb 2001 13:30:31 +0100 akim (am/h/14_Makefile.i 1.16
644)
+++ tests/Makefile.in Sat, 24 Feb 2001 15:37:25 +0100 akim (am/h/14_Makefile.i 1.16
+644)
@@ -457,8 +457,8 @@
all-am: Makefile
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install
-installdirs:
+installdirs:
mostlyclean-generic:
Index: install.am
--- install.am Sat, 24 Feb 2001 15:39:26 +0100 akim ()
+++ install.am Sat, 24 Feb 2001 15:35:27 +0100 akim (am/h/26_install.am 644)
@@ -0,0 +1,26 @@
+## automake - create Makefile.in from Makefile.am
+## Copyright 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.
+
+?SUBDIRS?.PHONY: installdirs installdirs-am installdirs-recursive
+?SUBDIRS?installdirs: installdirs-recursive
+?SUBDIRS?installdirs-am:
+?SUBDIRS??INSTALLDIRS? $(mkinstalldirs) @INSTALLDIRS@
+
+?!SUBDIRS?.PHONY: installdirs
+?!SUBDIRS?installdirs:
+?!SUBDIRS??INSTALLDIRS? $(mkinstalldirs) @INSTALLDIRS@