mkdep.c question (2.3.49)

From: Rask Ingemann Lambertsen (rask@kampsax.k-net.dk)
Date: Sat Mar 04 2000 - 07:04:56 EST


   I'm wondering about this function in mkdep.c:

/*
 * Handle an #include line.
 */
void handle_include(int type, const char * name, int len)
{
        struct path_struct *path = path_array+type;

        if (len == 14 && !memcmp(name, "linux/config.h", len))
                return;

        if (len >= 7 && !memcmp(name, "config/", 7))
                define_config(name+7, len-7-2);

        memcpy(path->buffer+path->len, name, len);
        path->buffer[path->len+len] = '\0';
        if (access(path->buffer, F_OK) != 0)
                return;

        if (!hasdep) {
                hasdep = 1;
                printf("%s:", depname);
        }
        printf(" \\\n %s", path->buffer);
}

in particular this part:

        if (access(path->buffer, F_OK) != 0)
                return;

   It looks obviously wrong to me, and it breaks in a situation like
this:

#include "firmware.h"

where the firmware.h file is generated from another file (say firmware.s)
by a Makefile rule. Is there any good reason for the access() check in the
#include "foobar.h" case and not just for the #include <foobar.h> case?

   I see two options:

1) Adding such dependencies to the Makefile manually. This is how it is
done for some SCSI drivers. But doesn't it defeat the purpose of mkdep to
some extent?

2) Modifying mkdep to handle the case:

--- linux/scripts/mkdep.c-bak Fri Jan 14 03:03:58 2000
+++ linux/scripts/mkdep.c Sat Mar 4 12:23:18 2000
@@ -190,7 +190,7 @@
 
         memcpy(path->buffer+path->len, name, len);
         path->buffer[path->len+len] = '\0';
- if (access(path->buffer, F_OK) != 0)
+ if (type == 0 && access(path->buffer, F_OK) != 0)
                 return;
 
         if (!hasdep) {

Regards,

/ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻTŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\
| Rask Ingemann Lambertsen | E-mail: mailto:rask@kampsax.k-net.dk |
| Registered Phase5 developer | WWW: http://www.gbar.dtu.dk/~c948374/ |
| A4000, 896 kkeys/s (RC5-64) | "ThrustMe" on XPilot, ARCnet and IRC |
| Eight out of every five people are math illiterates. |

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:16 EST