automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

47-factored-mans.patch


From: Akim Demaille
Subject: 47-factored-mans.patch
Date: Wed, 21 Feb 2001 18:23:43 +0100

FYI, here is the result on CVS Autoconf:

/tmp/ace % for i in **/Makefile.in                                   19:29 remo
diff -u $i.bak $i
--- man/Makefile.in.bak Tue Feb 20 19:15:30 2001
+++ man/Makefile.in     Tue Feb 20 19:28:59 2001
@@ -109,6 +109,7 @@


 install-man1:
+       @$(NORMAL_INSTALL)
        $(mkinstalldirs) $(DESTDIR)$(man1dir)
        @list='$(man1_MANS)'; \
        l2='$(man_MANS)'; for i in $$l2; do \
@@ -128,6 +129,7 @@
        done

 uninstall-man1:
+       @$(NORMAL_UNINSTALL)
        @list='$(man1_MANS)'; \
        l2='$(man_MANS)'; for i in $$l2; do \
          case "$$i" in \
@@ -142,12 +144,6 @@
          echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
          rm -f $(DESTDIR)$(man1dir)/$$inst; \
        done
-install-man: $(MANS)
-       @$(NORMAL_INSTALL)
-       $(MAKE) $(AM_MAKEFLAGS) install-man1
-uninstall-man:
-       @$(NORMAL_UNINSTALL)
-       $(MAKE) $(AM_MAKEFLAGS) uninstall-man1
 tags: TAGS
 TAGS:

@@ -219,6 +215,8 @@

 distclean-am: clean-am distclean-generic

+install-man: install-man1
+
 maintainer-clean: maintainer-clean-am

 maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -226,6 +224,8 @@
 mostlyclean: mostlyclean-am

 mostlyclean-am: mostlyclean-generic
+
+uninstall-man: uninstall-man1

 .PHONY: all all-am check check-am clean clean-generic distclean \
        distclean-generic distdir dvi dvi-am info info-am install \




This patch raises a question I asked myself several times: uniq'ing
the dependencies.  I'm pulled between the idea that it might cover
serious bugs, and on the other hand that we are looking for ways to
make our lifes easier.  In the present case, if, in addition to
sorting, we uniq the dependencies, them we don't even need the evil
&depend call to PHONY install-man and uninstall-man: just add

.PHONY: install-man uninstall-man

in mans.am, et voila`!  If we don't uniq, given that this file is
loaded for each section of the man pages, we'd get several PHONY
declarations for these two.

This is not the first time I meet this desire, and actually most
explicit &depend in automake could be removed.  Maybe introducing a
new syntax for conditional dependencies?

.PHONY:? install-man uninstall-man

or whatever the syntax, something saying `add me if not already
included'?

Heeeeeeeeeeelp!



Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * automake.in (&handle_man_pages): Let install-man and
        uninstall-man be handled by the dependency tracker.
        (&initialize_per_input): Let %dependencies track them.
        * mans.am: Add the needed hooks.

Index: automake.in
--- automake.in Tue, 20 Feb 2001 18:59:32 +0100 akim (am/f/39_automake.i 1.55 
755)
+++ automake.in Tue, 20 Feb 2001 19:40:16 +0100 akim (am/f/39_automake.i 1.55 
755)
@@ -2528,7 +2528,6 @@ sub handle_man_pages

     # Now for each section, generate an install and unintall rule.
     # Sort sections so output is deterministic.
-    local (@namelist);
     foreach my $sect (sort keys %sections)
     {
        &define_variable ('man' . $sect . 'dir', '$(mandir)/man' . $sect);
@@ -2536,24 +2535,13 @@ sub handle_man_pages
            unless defined $options{'no-installman'};
        $output_rules .= &file_contents ('mans',
                                         &transform ('SECTION', $sect));
-       push (@namelist, 'install-man' . $sect);
     }
+    &depend ('.PHONY', 'install-man', 'uninstall-man');

     # We don't really need this, but we use it in case we ever want to
     # support noinst_MANS.
     &define_variable ("MANS", join (' ', sort keys %vlist));

-    # Generate list of install dirs.
-    $output_rules .= ("install-man: \$(MANS)\n"
-                     . "address@hidden(NORMAL_INSTALL)\n");
-    &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @namelist);
-    &depend ('.PHONY', 'install-man');
-
-    $output_rules .= "uninstall-man:address@hidden(NORMAL_UNINSTALL)\n";
-    grep ($_ = 'un' . $_, @namelist);
-    &pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @namelist);
-    &depend ('.PHONY', 'uninstall-man');
-
     $output_vars .= &file_contents ('mans-vars');

     if (! defined $options{'no-installman'})
@@ -6578,6 +6566,11 @@ sub initialize_per_input
     # in Makefile: keeping related stuff altogether.
     %dependencies =
       (
+       # Installing/uninstalling.
+       'install-man'         => [],
+       'uninstall-man'       => [],
+
+       # Cleaning.
        'clean-am'             => [],
        'mostlyclean-am'       => [],
        'maintainer-clean-am'  => [],
@@ -6587,9 +6580,10 @@ sub initialize_per_input
        'maintainer-clean'     => [],
        'distclean'            => [],

-       # Building all the flavors of distributions.
+       # Tarballing.
        'dist-all'             => [],

+       # Phoning.
        '.PHONY'               => []
       );
     # Holds the factored actions.  Tied to %DEPENDENCIES, i.e., filled
Index: mans.am
--- mans.am Sun, 28 Jan 2001 15:51:12 +0100 akim (am/g/24_mans.am 1.2 644)
+++ mans.am Tue, 20 Feb 2001 19:27:48 +0100 akim (am/g/24_mans.am 1.2 644)
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright 1998 Free Software Foundation, Inc.
+## Copyright 1998, 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
@@ -15,7 +15,10 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.
+
+install-man .PHONY: address@hidden@
 address@hidden@:
+       @$(NORMAL_INSTALL)
        $(mkinstalldirs) $(DESTDIR)$(address@hidden@dir)
        @list='$(address@hidden@_MANS)'; \
 ## Extract all items from man_MANS that should go in this section.
@@ -41,7 +44,9 @@
        done

 ## This is just completely gross.
+uninstall-man .PHONY: address@hidden@
 address@hidden@:
+       @$(NORMAL_UNINSTALL)
        @list='$(address@hidden@_MANS)'; \
 ## Extract all items from man_MANS that should go in this section.
 ## This must be done dynamically to support conditionals.
@@ -61,5 +66,3 @@
          echo " rm -f $(DESTDIR)$(address@hidden@dir)/$$inst"; \
          rm -f $(DESTDIR)$(address@hidden@dir)/$$inst; \
        done
-
-.PHONY: address@hidden@ address@hidden@



reply via email to

[Prev in Thread] Current Thread [Next in Thread]