Since c3b39d0654c3 "[SV 62514] Honor command line interface flags", make
incorrectly filters oute multiple -C arguments with the same directoy
string:

$ cd /test && make -C a -C a
make: Entering directory '/test/a'

$ make -C /test/a -C /test/b -C /test/a
make: Entering directory '/test/b'

Skip -C when filtering out duplicate options to fix this.
---
 src/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main.c b/src/main.c
index 6a129768093c..f2069bb9ed11 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3247,9 +3247,10 @@ decode_switches (int argc, const char **argv, enum 
variable_origin origin)
                     }
 
                   /* Filter out duplicate options.
+                     Directory changes are cumulative.
                      Order matters for warnings.
                      Allow duplicate makefiles for backward compatibility.  */
-                  if (cs->c != 'f' && cs->c != WARN_OPT)
+                  if (cs->c != 'f' && cs->c != WARN_OPT && cs->c != 'C')
                     {
                       unsigned int k;
                       for (k = 0; k < sl->idx; ++k)
-- 
2.39.5


Reply via email to