automake-patches
[Top][All Lists]
Advanced

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

[FYI] {branch-1.13.2} make flags analysis: refactor, to reduce code dupl


From: Stefano Lattarini
Subject: [FYI] {branch-1.13.2} make flags analysis: refactor, to reduce code duplication
Date: Thu, 2 May 2013 00:13:05 +0200

And make it a little more reliable.

* t/header-vars.am (am__make_running_with_option): Here.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 lib/am/header-vars.am | 40 +++++++++++++++++-----------------------
 1 file changed, 17 insertions(+), 23 deletions(-)

diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am
index 4ad1783..3de46dc 100644
--- a/lib/am/header-vars.am
+++ b/lib/am/header-vars.am
@@ -44,15 +44,11 @@ am__make_running_with_option = \
            exit 1;; \
     esac; \
     am__has_opt=no; \
+    am__flags=$$MAKEFLAGS; \
     if $(am__is_gnu_make); then \
-## GNU make: $(MAKEFLAGS) is quite tricky there, while the older variable
-## $(MFLAGS) behaves much better.  So use the latter.
-      for am__flg in $$MFLAGS; do \
-        case $$am__flg in \
-          *=*|--*) ;; \
-          -*$$am__target_option*) am__has_opt=yes; break;; \
-        esac; \
-      done; \
+## The format of $(MAKEFLAGS) is quite tricky with GNU make; the
+## variable $(MFLAGS) behaves much better in that regard.  So use it.
+      am__flags=$$MFLAGS; \
     else \
 ## Non-GNU make: we must rely on $(MAKEFLAGS).  This is tricker and more
 ## brittle, but is the best we can do.
@@ -68,24 +64,22 @@ am__make_running_with_option = \
            am__bs=\\; \
            am__flags=`printf '%s\n' "$$MAKEFLAGS" \
             | sed "s/$$am__bs$$am__bs[$$am__bs $$am__bs        ]*//g"`;; \
-         *) \
-           am__flags=$$MAKEFLAGS;; \
       esac; \
-      am__skip_next=no; \
-      for am__flg in $$am__flags; do \
-        if test $$am__skip_next = yes; then \
-          am__skip_next=no; \
-          continue; \
-        fi; \
-        case $$am__flg in \
-          *=*|--*) ;; \
+    fi; \
+    am__skip_next=no; \
+    for am__flg in $$am__flags; do \
+      if test $$am__skip_next = yes; then \
+        am__skip_next=no; \
+        continue; \
+      fi; \
+      case $$am__flg in \
+        *=*|--*) ;; \
 ## Quite ugly special-casing.  We might need other similar ones actually,
 ## but let's wait until the need arises.
-          -I) am__skip_next=yes;; \
-          *$$am__target_option*) am__has_opt=yes; break;; \
-        esac; \
-      done;\
-    fi; \
+        -I) am__skip_next=yes;; \
+        *$$am__target_option*) am__has_opt=yes; break;; \
+      esac; \
+    done;\
     unset am__skip_next am__flg am__flags am__target_option; \
     test $$am__has_opt = yes; \
   }
-- 
1.8.3.rc0.19.g7e6a0cc




reply via email to

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