This is the mail archive of the gcc-bugs@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: DJGPP stage 2 C++ makefile failure


> From: "Mark E." <snowball3@bigfoot.com>
> Date: Sat, 15 Jul 2000 01:36:20 -0400
> 
> A change about 2 1/2 months ago means that the quoted version of CC is passed 
> to the g++ directory. What gcc's Makefile passes in the case of DJGPP is 
> this:
> SUBDIR_FLAGS_TO_PASS = $(ORDINARY_FLAGS_TO_PASS) \
> 	"CC=`echo \`case '\$(CC)' in stage*) echo '\$(CC)' | sed -e 
> 's|stage|../stage|g';; *) echo '\$(CC)';; esac\` | 
> $(PREPEND_DOTDOT_TO_RELATIVE_PATHS)`"
> 
> The backslash in front of the instances of $(CC) causes the failure. For 
> example:
> 
> CC=/djgpp/cvs/gcc/build/gcc/stage1
> 
> all:
> 	@echo \$(CC)
> 
> 'make all' here prints '\/djgpp/cvs/gcc/build/gcc/stage1'.

Add "SHELL = /bin/sh" to the Makefile and then try @echo "\$(CC)"
(with the quotes) instead.  Did it work now?

However, it is not clear to me that this "@echo \$(CC)" snippet indeed
reproduces the real problem, because you didn't show enough of the
original Makefile for me to judge (and I don't have latest GCC sources
to look myself).  For the reasons I explain below, it is very
important to see the exact command of the rule that fails to run,
including the expansion of each variable it uses.

> Most likely, DJGPP's Make treats a backslash as a filename character

This is true, but only up to a point.  A backslash might be treated as
a normal character (as opposed to a quoting character special for the
shell), but this treatment is different depending on the value of
$SHELL known to Make, and on the exact context where the backslash is
seen.  For example, if you can arrange for \$(CC) be inside double
quotes by the time it is used in a rule's command, it will most
probably work as expected (assuming you have "SHELL = /bin/sh"
somewhere in the Makefile).  Using $$(CC) instead might also help.
For additional insight, see the function
construct_command_argv_internal on job.c in GNU Make sources, in
particular around line 2545 (in the latest Make release 3.79.1).

> However, I have no idea what to do to fix it. Help?

You need to make sure Make runs that command through Bash, not
directly (i.e., not via `system').  Can you verify that it does?

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