Hello Vincent,

Perhaps someone here in help-gnu-utils will know the answer to your
question.  I do not and therefore cannot answer.  But I think you
would have an excellent result if you were to ask your question in the
help-m...@gnu.org mailing list.  That is dedicated to GNU make and is
where all of the GNU make expertise is discussed.  I suggest you ask
your question there.

If it were me I would do everything in the shell instead of trying to
do it in make.  I would either use shell substitution or use sed or a
combination.  In the end it probably depends upon what you know better.

  case $option in *=) : okay, has equal ;; *) option=$option= ;; esac

Also, use of 'echo -n' isn't portable.  Consider using 'printf' when
you don't want to print a newline for portable operation.

> my problem is with the for loop shown. OPTIONS variable has various
> fields in it. Some fields have a '=' in them ie. FOO=512 and some
> don't. Because I have a broken tool which gets confused by variables
> which don't have an equal sign in them I am trying to go through
> them and convert "FOO=512 BAR" into "FOO=512 BAR=".

Pesky CAD tools.  :-)

> The trouble is that the findstring never finds anything and I get
> "FOO=512= BAR=". When I replace the whole findstring command with 1,
> I get the then case of the 'if' but no amount trial made findstring
> work. Any ideas what my problem is or how to do what I need
> differently?

Perhaps this?

DO_SIM:
        [many echo commands] >> sim.tcl
        for option in $(OPTIONS); do  \
          case \$option in *=) : has equal ;; *) option=\$option= ;; esac  \
          printf "%s" "$option" >> sim.tcl;  \
        done
        [more echo command] >> sim.tcl

Or perhaps you could post process the file?

DO_SIM:
        [many echo commands] >> sim.tcl
        for option in $(OPTIONS); do  \
          echo "$option";  \
        done | sed 's/$/=/;s/==*$/=/' | tr "\n" " " >> sim.tcl;
        [more echo command] >> sim.tcl

Bob

Reply via email to