This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
gdb/921: Makefile.in rewrites .c.o target to ignore CPPFLAGS (multiple)
- From: starksb at ebi dot ac dot uk
- To: gdb-gnats at sources dot redhat dot com
- Date: 10 Jan 2003 14:55:42 -0000
- Subject: gdb/921: Makefile.in rewrites .c.o target to ignore CPPFLAGS (multiple)
- Reply-to: starksb at ebi dot ac dot uk
>Number: 921
>Category: gdb
>Synopsis: Makefile.in rewrites .c.o target to ignore CPPFLAGS (multiple)
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 10 06:58:02 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: David Starks-Browning
>Release: 5.3 (and many previous)
>Organization:
>Environment:
One that uses libraries and include files in custom location, specified with environment variables:
LDFLAGS=-L/my/local/lib
CPPFLAGS=-I/my/local/include
>Description:
gdb/Makefile.in rewrites the .c.o default rule to ignore CPPFLAGS. In fact this happens in a great many Makefile.in files throughout the distribution.
The standard default rule is basically:
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $<
The offending Makefile.in files override it thus:
# Prevent Sun make from putting in the machine type. Setting
# TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1.
.c.o:
${CC} -c ${INTERNAL_CFLAGS} $<
where
INTERNAL_CFLAGS = $(WARN_CFLAGS) ${CFLAGS} ${GLOBAL_CFLAGS} ${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${BFD_CFLAGS}
This causes problems because ./configure will use the standard default rule and honor CPPFLAGS, and will set the appropriate HAVE_WHATEVER_H flag in configure.in. But during make, the .h files cannot be found, because CPPFLAGS is lost.
>How-To-Repeat:
NB it is also necessary to uncomment empty LDFLAGS definition in top-level Makefile.in, otherwise empty definition overrides environment variable.
>Fix:
Modify offending Makefile.in files to look like this instead:
.c.o:
${CC} -c ${INTERNAL_CFLAGS} $(CPPFLAGS) $<
Also remove empty "LDFLAGS =" from toplevel Makefile.in.
>Release-Note:
>Audit-Trail:
>Unformatted: