[Patch, Build+Fortran] PR54725 - correctly set TARGET_SYSTEM_ROOT for CPP
Tobias Burnus
burnus@net-b.de
Fri Oct 19 08:22:00 GMT 2012
gfortran was ignoring the TARGET_SYSTEM_ROOT and thus searched in
/usr/include for files specified with "#include"/"include" files and for
.mod files.
The solution is to do in gcc/fortran/cpp.c the same as it is done in
gcc/c-family/c-opts.c.
However, the TARGET_SYSTEM_ROOT also has to be available. For C/C++
that's done via gcc/Makefile.in:
CFLAGS-c-family/c-opts.o += @TARGET_SYSTEM_ROOT_DEFINE@
For Fortran, we have to to it likewise, but slightly different:
The gcc/Makefile.in gets updated by configure and written to
$BUILD/gcc/Makefile. At that point the @TARGET...@ has been replaced by
the actual value.
For Fortran, the gcc/fortran/Make-lang.in is included in
$BUILD/gcc/Makefile:
include $(LANG_MAKEFRAGS)
Thus, we cannot use @TARGET_...@ as it won't get replaced. Hence, I
create a Makefile variable in gcc/Makefile.in and set it there, which
then in turn gets used in gcc/fortran/Make-lang.in.
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
Tobias
PS: I haven't yet cross compiled and thus checked whether it indeed works.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: target_root.diff
Type: text/x-patch
Size: 2140 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20121019/f5ad4ec0/attachment.bin>
More information about the Fortran
mailing list