Index: function.c
===================================================================
RCS file: /sources/make/make/function.c,v
retrieving revision 1.102
diff -u -r1.102 function.c
--- function.c	11 May 2007 20:57:21 -0000	1.102
+++ function.c	27 May 2007 02:59:44 -0000
@@ -1996,6 +1996,27 @@
 }
 
 static char *
+func_mtime (char *o, char **argv, const char *funcname UNUSED)
+{
+  struct file *f;
+  FILE_TIMESTAMP t1;
+  time_t t;
+  char str[12]; /* Enough for a signed 32-bit integer + null */
+  int strl;
+
+  f = enter_file (strcache_add (argv[0]));
+  t1 = file_mtime (f);
+  if (t1 == NONEXISTENT_MTIME)
+    return o;
+
+  t = FILE_TIMESTAMP_S (t1);
+  strl = snprintf(str, sizeof str, "%ld", t);
+  o = variable_buffer_output (o, str, strl);
+
+  return o;
+}
+
+static char *
 func_abspath (char *o, char **argv, const char *funcname UNUSED)
 {
   /* Expand the argument.  */
@@ -2086,6 +2107,7 @@
   { STRING_SIZE_TUPLE("eq"),            2,  2,  1,  func_eq},
   { STRING_SIZE_TUPLE("not"),           0,  1,  1,  func_not},
 #endif
+  { STRING_SIZE_TUPLE("mtime"),         1,  1,  1,  func_mtime},
 };
 
 #define FUNCTION_TABLE_ENTRIES (sizeof (function_table_init) / sizeof (struct function_table_entry))
