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


Thanks for the help Eli.

> knowing how that command looks like in the Makefile.  Also, please
> make sure that cp/Makefile does say "SHELL = /bin/sh".

It does.

I do think I stumbled on a solution to the problem. Here's a new sample 
Makefile:

SHELL=/bin/sh
CC=stage1/xgcc -Bstage1/
CFLAGS=-v
PREPEND_DOTDOT_TO_RELATIVE_PATHS = sed \
	-e 's|^ *[^ /][^ /]*/|%&|' \
	-e 's| -B| -B%|g' \
	-e 's|% *[^- /]|%&|g' \
	-e 's|%% *|../|g' \
	-e 's|%||g'
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)`"
# Flags to pass when recursing into a frontend subdirectory.
LANG_FLAGS_TO_PASS = $(SUBDIR_FLAGS_TO_PASS) \
all:
	echo $(LANG_FLAGS_TO_PASS)
	$(MAKE) -f ./makef $(LANG_FLAGS_TO_PASS)


makef:
all:
	echo $(CC)

CC will contain that pesky backslash and this is as you explained. It's set 
by this line in gcc's configure:
	quoted_cc_set_by_configure="\\\`case '\\\$(CC)' in stage*) echo '\\\$(CC)' | 
sed -e 's|stage|../stage|g';; *) echo '\\\$(CC)';; esac\\\`"

which is then substituted into the generated Makefile. If this line is 
changed to use one backslash before $(CC) instead of three, then the lone 
backslash goes away in the Makefile. From reading the comment in the 
configure script, I think the idea is to quote CC so it survives into a sub-
make when you have CC="stage1/xgcc -Bstage1/". To make that work, I think 
quoted_cc_* above needs to be changed to:
	quoted_cc_set_by_configure="\\\`case '\$(CC)' in stage*) echo '\$(CC)' | sed 
-e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\\\`"

with that change, I get a definition of SUBDIR_FLAGS_TO_PASS that doesn't 
introduce a backslash:

SHELL=/bin/sh
CC=stage1/xgcc -Bstage1/
PREPEND_DOTDOT_TO_RELATIVE_PATHS = sed \
	-e 's|^ *[^ /][^ /]*/|%&|' \
	-e 's| -B| -B%|g' \
	-e 's|% *[^- /]|%&|g' \
	-e 's|%% *|../|g' \
	-e 's|%||g'
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)`"
# Flags to pass when recursing into a frontend subdirectory.
LANG_FLAGS_TO_PASS = $(SUBDIR_FLAGS_TO_PASS) \
	"CFLAGS=$(LOOSE_CFLAGS)"
all:
	echo $(CC)
	echo $(LANG_FLAGS_TO_PASS)
	$(MAKE) -f ./makef $(LANG_FLAGS_TO_PASS)



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