diff options
author | Roland McGrath <roland@redhat.com> | 1992-12-09 20:34:36 +0000 |
---|---|---|
committer | Roland McGrath <roland@redhat.com> | 1992-12-09 20:34:36 +0000 |
commit | 1faf31158c84ff87a499379c9bf42022c0375249 (patch) | |
tree | e84fdf1f6af6787beec356993a5ab3f21382b063 | |
parent | 0a7da8a929d13551070ed85af204736e6a2c72c4 (diff) | |
download | gunmake-1faf31158c84ff87a499379c9bf42022c0375249.tar.gz |
Formerly remake.c.~39~
-rw-r--r-- | remake.c | 41 |
1 files changed, 28 insertions, 13 deletions
@@ -786,10 +786,12 @@ remake_file (file) } /* Return the mtime of a file, given a `struct file'. - Caches the time in the struct file to avoid excess stat calls. If the file - is not found, and SEARCH is nonzero, VPATH searching and replacement is - done. If that fails, a library (-lLIBNAME) is tried but the library's - actual name (/lib/libLIBNAME.a, etc.) is not substituted into FILE. */ + Caches the time in the struct file to avoid excess stat calls. + + If the file is not found, and SEARCH is nonzero, VPATH searching and + replacement is done. If that fails, a library (-lLIBNAME) is tried and + the library's actual name (/lib/libLIBNAME.a, etc.) is substituted into + FILE. */ time_t f_mtime (file, search) @@ -916,8 +918,8 @@ library_search (lib) { static char *dirs[] = { - "/usr/lib", "/lib", + "/usr/lib", LIBDIR, /* Defined by configuration. */ 0 }; @@ -926,17 +928,18 @@ library_search (lib) char *buf = xmalloc (sizeof (LIBDIR) + 8 + strlen (libname) + 4 + 2 + 1); char **dp; - for (dp = dirs; *dp != 0; ++dp) + sprintf (buf, "lib%s.a", libname); + + /* Look first for `libNAME.a' in the current directory. */ + + if (name_mtime (libname) != (time_t) -1) { - sprintf (buf, "%s/lib%s.a", *dp, libname); - if (name_mtime (buf) != (time_t) -1) - { - *lib = buf; - return 1; - } + *lib = buf; + return 1; } - sprintf (buf, "lib%s.a", libname); + /* Now try VPATH search on that. */ + libname = buf; if (vpath_search (&libname)) { @@ -945,6 +948,18 @@ library_search (lib) return 1; } + /* Now try the standard set of directories. */ + + for (dp = dirs; *dp != 0; ++dp) + { + sprintf (buf, "%s/lib%s.a", *dp, libname); + if (name_mtime (buf) != (time_t) -1) + { + *lib = buf; + return 1; + } + } + free (buf); return 0; } |