Subject: Re: "Soft" make dependencies? Was: make build problem - BIND
To: None <current-users@NetBSD.ORG>
From: Takahiro Kambe <taca@sky.yamashina.kyoto.jp>
List: current-users
Date: 05/30/2001 09:34:06
In message <20010530002923.15333.qmail@mail.netbsd.org>
on Wed, 30 May 2001 09:30:57 +0900,
Takahiro Kambe <taca@sky.yamashina.kyoto.jp> wrote:
> Anyway, here is my several minitues simple (or dirty) hack. Warning
> message sould be ignored that honoring some options.
Oh, please ignore previouse one.
--
Takahiro Kambe <taca@sky.yamashina.kyoto.jp>
--- main.c.orig Sat Jan 20 17:22:18 2001
+++ main.c Wed May 30 09:33:11 2001
@@ -808,7 +808,7 @@
} else if (!ReadMakefile("makefile", NULL))
(void)ReadMakefile("Makefile", NULL);
- (void)ReadMakefile(".depend", NULL);
+ (void)ReadMakefile(".depend", "dummy");
Var_Append("MFLAGS", Var_Value(MAKEFLAGS, VAR_GLOBAL, &p1), VAR_GLOBAL);
if (p1)
@@ -975,6 +975,9 @@
FILE *stream;
size_t len = MAXPATHLEN;
char *name, *path = emalloc(len);
+ struct stat st;
+ time_t cur_mtime;
+ static time_t old_mtime;
if (!strcmp(fname, "-")) {
Parse_File("(stdin)", stdin);
@@ -1007,8 +1010,19 @@
* placement of the setting here means it gets set to the last
* makefile specified, as it is set by SysV make.
*/
-found: Var_Set("MAKEFILE", fname, VAR_GLOBAL);
- Parse_File(fname, stream);
+found: if (fstat(fileno(stream), &st) == 0)
+ cur_mtime = st.st_mtime;
+ else
+ cur_mtime = old_mtime;
+ if (q == NULL || cur_mtime > old_mtime) {
+ Var_Set("MAKEFILE", fname, VAR_GLOBAL);
+ Parse_File(fname, stream);
+ if (cut_mtime > old_mtime)
+ old_mtime = cur_mtime;
+ } else if (q != NULL && cur_mtime <= old_mtime)
+ (void)fprintf(stderr,
+ "make warning: older %s was ignored,\n",
+ fname);
(void)fclose(stream);
}
free(path);