This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: nested backticks in Makefile
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'DJ Delorie'" <dj at redhat dot com>, <gcc at gcc dot gnu dot org>
- Date: Tue, 27 Mar 2007 18:03:54 +0100
- Subject: RE: nested backticks in Makefile
- References: <200703271654.l2RGsvZ2008245@greed.delorie.com>
On 27 March 2007 17:55, DJ Delorie wrote:
> When cross compiling with a sysroot, you sometimes end up with nested
> backticks.
>
> The case we're seeing it with is m32r-elf, where gcc_tooldir is defined
> thusly:
>
> gcc_tooldir = $(libsubdir)/$(unlibsubdir)/`echo $(exec_prefix) | sed -e
> 's|^$(prefix)||' -e 's|/$(dollar)||' -e 's|^[^/]|/|' -e
> 's|/[^/]*|../|g'`$(target_noncanonical)
>
> and SYSTEM_HEADER_DIR is thusly:
>
> CROSS_SYSTEM_HEADER_DIR = $(gcc_tooldir)/sys-include
> SYSTEM_HEADER_DIR = `echo $(CROSS_SYSTEM_HEADER_DIR) | sed -e :a -e
> 's,[^/]*/\.\.\/,,' -e ta`
>
> Note that we have gcc_tooldir inside backticks, resulting in
> `...`...`...`, which bash obviously is going to misinterpret.
>
> Given that we require GNU make, is the right solution to use $(shell
> echo ...) for one of those to disambiguate it?
Or how about using ':=' to force immediate evaluation? Does $gcc_tooldir
change during the course of a build? If not, it seems pointlessly wasteful to
repeatedly invoke shell/echo/sed every single time it's referred to...
cheers,
DaveK
--
Can't think of a witty .sigline today....