Hi,
I have the following problem which seems to me as a bug.
I am sorry if I am missing something.
The GNU make version is:
GNU Make version 3.78.1, by Richard Stallman and Roland McGrath.
Built for sparc-sun-solaris2.7
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
Free Software Foundation, Inc.
What I have is a recursive make. The visual effect I am
getting is the following:
make[1]: Entering directory `/export/home/tst/lynx'
make[2]: Entering directory `/export/home/tst/lynx'
make[2]: *** No rule to make target `w'. Stop.
make[2]: Leaving directory `/export/home/tst/lynx'
make[1]: *** [all_orig] Error 2
make[1]: Leaving directory `/export/home/tst/lynx'
make: *** [all] Error 2
After I did further investigation I realized that this fake
target 'w' comes from the '-w' option we are passing to
the recursive makes:
I did a little correction to the source code to aid the debugging
of the child make:
File variable.c:define_variable_in_set()
if (v != 0)
{
if (env_overrides && v->origin == o_env)
/* V came from in the environment. Since it was defined
before the switches were parsed, it wasn't affected by -e. */
v->origin = o_env_override;
/* A variable of this name is already defined.
If the old definition is from a stronger source
than this one, don't redefine it. */
if ((int) origin >= (int) v->origin)
{
if (v->value != 0)
free (v->value);
v->value = xstrdup (value);
v->origin = origin;
v->recursive = recursive;
if ((strcmp(v->name, "MAKEFLAGS") == 0) && (v->value[0] == 'w'))
{
static volatile int i = 1;
for (; i != 0;)
sleep(1); <--- here we are waiting for the gdb to
attach the child make
printf("newval1=%s\n", v->value);
}
}
After I attached the child make I have the following:
(gdb) where
#0 0xff2975bc in _sigsuspend ()
#1 0xff250144 in _libc_sleep ()
#2 0x24b40 in define_variable_in_set (name=0x2da58 "MAKEFLAGS",
length=9,
value=0xffbeeb29 "w", origin=o_file, recursive=1, set=0x42dbc)
at variable.c:109
#3 0x24c20 in define_variable (name=0x2da58 "MAKEFLAGS", length=9,
value=0xffbeeb29 "w", origin=o_file, recursive=1) at variable.c:145
#4 0x17074 in define_makeflags (all=0, makefile=0) at main.c:2523
#5 0x1524c in main (argc=5, argv=0xffbef894, envp=0x47db8) at
main.c:1257
For frame #4 (define_makeflags()):
(gdb) print flagstring
$1 = 0xffbeeb28 "-w" <---
my guest is that that's the -w comming from the calling make asking as
to print the current working directory.
The above situation is generated by the following code as far as I can
tell:
main.c:define_makeflags (): line 2523
v = define_variable ("MAKEFLAGS", 9,
/* If there are switches, omit the leading dash
unless it is a single long option with two
leading dashes. */
&flagstring[(flagstring[0] == '-'
&& flagstring[1] != '-')
? 1 : 0],
/* This used to use o_env, but that lost when a
makefile defined MAKEFLAGS. Makefiles set
MAKEFLAGS to add switches, but we still want
to redefine its value with the full set of
switches. Of course, an override or command
definition will still take precedence. */
o_file, 1);
Here flashstring is "-w"
&flagstring[(flagstring[0] == '-'
&& flagstring[1] != '-')
? 1 : 0],
The line:
flagstring[0] == '-' && flagstring[1] != '-' ? 1: 0
generates 1.
As a result we are defining the MAKEFLAGS variable
"w". The w is a new target (fake one) for the child make.
Best Regards,
Kamen