• Kai Germaschewski's avatar
    kbuild: Make dependencies at compile time · 04bd7217
    Kai Germaschewski authored
    Making dependencies once up front is not ideal. For one, you don't need
    them initially, since when you don't have the .o file, you bet you have
    to build it no matter what the dependencies say - dependencies are about
    deciding when to *re*build.
    
    There's more reasons, like:
    o you don't even know which files you'll build, so you have to go over
      all files (even over drivers/{sbus,s390,...} on i386)
    o generated files don't exist yet, so you cannot pick up dependencies
      on them
    o even if dependencies are right initially, they change when you work on 
      your tree or patch it, and nobody will notice unless you run "make dep"
      explicitly again
    
    Anyway, gcc knows hows to emit a correct dependency list, so we just use
    that. Well, a little bit of hacking is necessary to remove the dependency
    on autoconf.h and put in individual CONFIG_WHAT_EVER dependencies instead,
    since otherwise changing one config option would cause everything to be
    rebuilt.
    
    I should add that I didn't come up with this all by myself, most work
    is actually done in gcc and there were discussions about using -MD on
    kbuild-devel way back, so I should mention Keith Owens and Michael
    Elizabeth Chastain, and probably others that I forgot, so I apologize
    just in case.
    04bd7217
fixdep.c 8.77 KB