mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 09:12:44 +00:00
Make ReadMakefile() operate using the realpath(3) name for the file handed to
it, which means that relative paths will be expanded to absolute paths, and filenames without a path will end up with their absolute path included as well. This aids tremendously in debugging a build using our make(1) with multiple Makefile's, such as when there is a syntax error in a file in a sub-directory as per <bsd.subdir.mk>. Normally we'd end up with just "Makefile" known about the Makefile in question, which means that an error would be useless for someone trying to debug their build system, now we end up with a complete real pathname for the Makefile. So mostly this is useful in a debugging context, but possibly others too (I haven't thought of them yet, but they probably are more useful if you make Dir_FindFile use realpath(3), but that's another story). Reviewed by: -current MFC after: 2 weeks
This commit is contained in:
parent
bb0d293f15
commit
21b8b7cb3c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=97077
@ -919,12 +919,16 @@ ReadMakefile(p, q)
|
|||||||
/* if we've chdir'd, rebuild the path name */
|
/* if we've chdir'd, rebuild the path name */
|
||||||
if (curdir != objdir && *fname != '/') {
|
if (curdir != objdir && *fname != '/') {
|
||||||
(void)snprintf(path, MAXPATHLEN, "%s/%s", curdir, fname);
|
(void)snprintf(path, MAXPATHLEN, "%s/%s", curdir, fname);
|
||||||
if ((stream = fopen(path, "r")) != NULL) {
|
if (realpath(path, path) != NULL &&
|
||||||
|
(stream = fopen(path, "r")) != NULL) {
|
||||||
fname = path;
|
fname = path;
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
} else if ((stream = fopen(fname, "r")) != NULL)
|
} else if (realpath(fname, path) != NULL) {
|
||||||
goto found;
|
fname = path;
|
||||||
|
if ((stream = fopen(fname, "r")) != NULL)
|
||||||
|
goto found;
|
||||||
|
}
|
||||||
/* look in -I and system include directories. */
|
/* look in -I and system include directories. */
|
||||||
name = Dir_FindFile(fname, parseIncPath);
|
name = Dir_FindFile(fname, parseIncPath);
|
||||||
if (!name)
|
if (!name)
|
||||||
|
Loading…
Reference in New Issue
Block a user