summaryrefslogtreecommitdiff
path: root/devel/bmake/files/dir.c
diff options
context:
space:
mode:
authorbsiegert <bsiegert@pkgsrc.org>2011-06-18 22:17:41 +0000
committerbsiegert <bsiegert@pkgsrc.org>2011-06-18 22:17:41 +0000
commit7cb16bb66575467ac59352068eaec344242b439a (patch)
treec8f5dd7d540977ec601c02e7d04c13e80115f641 /devel/bmake/files/dir.c
parent92219014db9b676e01e78bbe73c3877f94f2a471 (diff)
downloadpkgsrc-7cb16bb66575467ac59352068eaec344242b439a.tar.gz
Import bmake-20110606. Many changes, among them:
- unit-tests/modts now works on MirBSD - meta mode - ApplyModifiers: when we parse a variable which is not the entire modifier string, or not followed by ':', do not consider it as containing modifiers. - when long modifiers fail to match, check sysV style. - :hash - cheap 32bit hash of value - :localtime, :gmtime - use value as format string for strftime. - fix for use after free() in CondDoExists(). - boot-strap (TOOL_DIFF): aparently at least on linux distro formats the output of 'type' differently - so eat any "()" - correct sysV substitution handling of empty lhs and variable - correct exists() check for dir with trailing / - correct handling of modifiers for non-existant variables during evaluation of conditionals. - fix for incorrect .PARSEDIR when .OBJDIR is re-computed after makefiles have been read. - fix example of :? modifier in man page. - sigcompat.c: convert to ansi so we can use higher warning levels. - parse.c: SunOS 5.8 at least does not have MAP_FILE - use mmap(2) if available, for reading makefiles - to ensure unit-tests results match, need to control LC_ALL as well as LANG. - if stale dependency is an IMPSRC, search via .PATH - machine.sh: like os.sh, allow for uname -p producing useless drivel - boot-strap: document configure knobs for meta and filemon.
Diffstat (limited to 'devel/bmake/files/dir.c')
-rw-r--r--devel/bmake/files/dir.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/devel/bmake/files/dir.c b/devel/bmake/files/dir.c
index e4fe4280b92..680f7c37d2a 100644
--- a/devel/bmake/files/dir.c
+++ b/devel/bmake/files/dir.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.1.1.5 2009/09/18 20:55:25 joerg Exp $ */
+/* $NetBSD: dir.c,v 1.1.1.6 2011/06/18 22:17:55 bsiegert Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.1.1.5 2009/09/18 20:55:25 joerg Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.1.1.6 2011/06/18 22:17:55 bsiegert Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
#else
-__RCSID("$NetBSD: dir.c,v 1.1.1.5 2009/09/18 20:55:25 joerg Exp $");
+__RCSID("$NetBSD: dir.c,v 1.1.1.6 2011/06/18 22:17:55 bsiegert Exp $");
#endif
#endif /* not lint */
#endif
@@ -1061,6 +1061,7 @@ Dir_FindFile(const char *name, Lst path)
Boolean hasSlash; /* true if 'name' contains a / */
struct stat stb; /* Buffer for stat, if necessary */
Hash_Entry *entry; /* Entry for mtimes table */
+ const char *trailing_dot = ".";
/*
* Find the final component of the name and note whether it has a
@@ -1165,6 +1166,11 @@ Dir_FindFile(const char *name, Lst path)
return NULL;
}
+ if (*cp == '\0') {
+ /* we were given a trailing "/" */
+ cp = trailing_dot;
+ }
+
if (name[0] != '/') {
Boolean checkedDot = FALSE;
@@ -1272,6 +1278,10 @@ Dir_FindFile(const char *name, Lst path)
* b/c we added it here. This is not good...
*/
#ifdef notdef
+ if (cp == traling_dot) {
+ cp = strrchr(name, '/');
+ cp += 1;
+ }
cp[-1] = '\0';
(void)Dir_AddDir(path, name);
cp[-1] = '/';
@@ -1434,6 +1444,31 @@ Dir_MTime(GNode *gn)
fullName = NULL;
else {
fullName = Dir_FindFile(gn->name, Suff_FindPath(gn));
+ if (fullName == NULL && gn->flags & FROM_DEPEND &&
+ !Lst_IsEmpty(gn->iParents)) {
+ char *cp;
+
+ cp = strrchr(gn->name, '/');
+ if (cp) {
+ /*
+ * This is an implied source, and it may have moved,
+ * see if we can find it via the current .PATH
+ */
+ cp++;
+
+ fullName = Dir_FindFile(cp, Suff_FindPath(gn));
+ if (fullName) {
+ /*
+ * Put the found file in gn->path
+ * so that we give that to the compiler.
+ */
+ gn->path = bmake_strdup(fullName);
+ fprintf(stdout,
+ "%s: ignoring stale %s for %s, found %s\n",
+ progname, makeDependfile, gn->name, fullName);
+ }
+ }
+ }
if (DEBUG(DIR))
fprintf(debug_file, "Found '%s' as '%s'\n",
gn->name, fullName ? fullName : "(not found)" );