Greg, in regards to another question you had - no I don't think there
is value in having a variant if statement that treats 'm' differently.
You can already get the same effect by using 'CONFIG_FOO=y' or
'CONFIG_FOO=m' instead of plain 'CONFIG_FOO'.

You are much better than I at finding examples of weird stuff in the
config system, though, so let me know if this doesn't cover all cases.

[I wrote]
> else_dep() is a simple matter of reversing the polarity of the guard.

No it's not - I just realised that this breaks nested if_dep.

> I suppose Bourne-feature-completeness would demand 'elif_dep' as
> well.

I also realised that else_dep and elif_dep are exactly the same except
that else_dep doesn't take a dep line.  So else_dep now does double
duty:

  if_dep CONFIG_FOO
    ...
  else_dep CONFIG_BAR
    ...
  else_dep CONFIG_BAZ !CONFIG_XYZZY
    ...
  else_dep
    ...
  fi_dep

Of course if one feels uncomfortable about an empty 'else_dep' line
one can always append a dummy 'y'.

Incremental patch (lightly tested) over the one earlier in the thread:

--- 2.5.31/scripts/Menuconfig   2002-08-15 03:57:59.000000000 -0500
+++ 2.5.31w/scripts/Menuconfig  2002-08-15 03:55:22.000000000 -0500
@@ -130,7 +130,7 @@
 # Use boolean transforms, or nest conditionals.
 function dep_calc () {
        local neg arg ordep
-       if [ "$nest_ifdep" = n ]; then
+       if [ "$nest_ifdep" = n -o "$nest_ifdep" = x ]; then
                cur_dep=n;
                return 1;
        fi
@@ -171,7 +171,15 @@
        nest_ifdep=$cur_dep
 }
 
-function endif () {
+function else_dep () {
+       case "$nest_ifdep" in
+         y | m | x) nest_ifdep=x ;;
+         n) fi_dep; if_dep "$@" ;;
+         *) ;; # syntax error: else without if, or similar
+       esac
+}
+
+function fi_dep () {
        nest_ifdep=${nest_stack%%' '*}
        nest_stack=${nest_stack#*' '}
 }


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
kbuild-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/kbuild-devel

Reply via email to