automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [FYI] [ng] refactor: use .DEFAULT_GOAL to set the default


From: Stefano Lattarini
Subject: [Automake-NG] [FYI] [ng] refactor: use .DEFAULT_GOAL to set the default rule
Date: Wed, 9 May 2012 13:12:29 +0200

This change should introduce no semantic change, but allows
a minor simplification in automake.in.

* automake.in ($output_all): Don't define nor use anymore,
its role and function merged with '$output_rules'.
* lib/am/header-vars.am (.DEFAULT_GOAL): Define to 'all'.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in           |   16 +++++++---------
 lib/am/header-vars.am |    4 ++++
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/automake.in b/automake.in
index 483bb79..a47aedc 100644
--- a/automake.in
+++ b/automake.in
@@ -496,7 +496,6 @@ my $output_deps_greatest_timestamp;
 # These variables are used when generating each Makefile.in.
 # They hold the Makefile.in until it is ready to be printed.
 my $output_vars;
-my $output_all;
 my $output_header;
 my $output_rules;
 my $output_trailer;
@@ -647,7 +646,6 @@ sub initialize_per_input ()
     $output_deps_greatest_timestamp = 0;
 
     $output_vars = '';
-    $output_all = '';
     $output_header = '';
     $output_rules = '';
     $output_trailer = '';
@@ -4476,15 +4474,15 @@ sub handle_all ($)
        # by changing the order of dependencies to the "all" because
        # that breaks when using parallel makes.  Instead we handle
        # things explicitly.
-       $output_all .= ("all: @local_headers"
-                       . "\n\t\$(MAKE) "
-                       . (var ('SUBDIRS') ? 'all-recursive' : 'all-am')
-                       . "\n\n");
+        $output_rules .= ("all: @local_headers"
+                          . "\n\t\$(MAKE) "
+                          . (var ('SUBDIRS') ? 'all-recursive' : 'all-am')
+                          . "\n\n");
       }
     else
       {
-       $output_all .= "all: " . (var ('SUBDIRS')
-                                 ? 'all-recursive' : 'all-am') . "\n\n";
+        $output_rules .= "all: " . (var ('SUBDIRS')
+                                    ? 'all-recursive' : 'all-am') . "\n\n";
       }
 }
 
@@ -7988,7 +7986,7 @@ sub generate_makefile ($$)
 
   # We make sure that 'all:' is the first target.
   my $output =
-    "$output_vars$output_all$output_header$output_rules$output_trailer";
+    "$output_vars$output_header$output_rules$output_trailer";
 
   # Decide whether we must update the output file or not.
   # We have to update in the following situations.
diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am
index a081639..0d73850 100644
--- a/lib/am/header-vars.am
+++ b/lib/am/header-vars.am
@@ -16,6 +16,10 @@
 
 VPATH = @srcdir@
 
+## The 'all' target must be the default one, independently from the
+## position it is declared in the output Makefile.
+.DEFAULT_GOAL := all
+
 ## Emulate VPATH rewrites.  This uses only GNU make primitives, which
 ## allows us to avoid extra forks.
 am__vpath_rewrite = \
-- 
1.7.9.5




reply via email to

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