This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: rfc: new libgcc build mechanism


I see where we're miscommunicating here.
Details below.

> Donn Terry <donnte@microsoft.com>:
> > I don't follow.  The inner echo outputs the value of the
> > CC macro, and munges it for the "stage" change.  The outer
> > echo makes it a string (as opposed to a command to be
> > executed) to pass it to the second sed to do .. insertion.
> 
> sorry, that makes no sense to me.  I think you're confused.
> this is perfectly legal make & sh:

What you have is legal, it's just not possible in this circumstance.
Look at Makefile.in.  It looks like (again, with $() used instead
of ``):

SUBDIR_FLAGS_TO_PASS = $(ORDINARY_FLAGS_TO_PASS) \
        "CC=$$(echo @cc_set_by_configure@ |
$(PREPEND_DOTDOT_TO_RELATIVE_PATHS) )"

@cc_set_by_configure@ is either `` (or $()) but both the
opening and closing `` or () must be within that configure
macro (@cc_set_by_configure@) because it's used elsewhere.
the echo is there to re-quote the result of @cc_set_by_configure@
(whatever it might be) so it can be passed to $(PREPEND...)
rather than having its RESULT passed to $(PREPEND...)

> 
>   FOO=`						\
>     case '$(CC)' in				\
>       (stage*)					\
> 	echo '$(CC)' |				\
> 	  sed -e 's|stage|../stage|g'		\
> 	;;					\
>       (*)					\
> 	echo '$(CC)'				\
> 	;;					\
>     esac |					\
          ^^  <<< there's a required ` at this point, due
                  to outside constraints!  Without the
                  echo, it would run the compiler and pass
                  that result to $(PREPEND...)
>       $(PREPEND_DOTDOT_TO_RELATIVE_PATHS)	\
>   `
> 
> you don't need to wrap the case statement in an `echo`.  I
> put while loops and case statements and if statements in
> middle of pipelines all the time.
> 
> btw, using balanced () for case statements isn't portable.

I know that.  However, it makes it much easier to balance
other parenthesis to be sure everything else is working, and since
my shell (and any posix conforming shell must) accept it,
for now it's useful.  (See POSIX.2-1992 P147 L 1216 and 1216
and P844/L3792ff).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]