Re: building modules out of tree: how the header include paths work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 16 Dec 2008, Matthias Kaehlcke wrote:

> hi robert,
>
> El Tue, Dec 16, 2008 at 12:18:55PM -0500 Robert P. J. Day ha dit:
>
> >
> >   i don't have access to a test system at the moment, so i'll
> > embarrass myself by just asking:
> >
> >   when i'm writing a loadable module to be built out-of-tree, how do i
> > properly configure the header file search path so i can include
> > locally-written header files in my module?
> >
> >   say i have a module source file that needs to include the relative
> > header file "../include/header.h".  i'm fairly sure i can just write:
> >
> >   #include "../include/header.h"
> >
> > and that will work with no additional configuration.  (this suggests
> > that the kernel module build process automatically adds the source
> > directory to its header file search path, correct?  otherwise, the
> > above couldn't possibly work.)
> >
> >   but what if i want to just say:
> >
> >   #include "header.h"
> >
> > what's the proper way to invoke the kernel source tree Makefile to add
> > the header file directory to the header file search path?  thanks.  i
> > realize this is a simple question, i just don't have access to my work
> > system at the moment to check it myself.
>
> i usually compile out-of-tree modules with the following command (from
> the module source dir)
>
> make -C <kernel_sources> SUBDIRS=$PWD modules

  in the newer kernels, wouldn't you use "M=" as opposed to
"SUBDIRS="?  although i'm guessing SUBDIRS still works.

> #include "header.h"
>
> should work

  yes, that works now, i'm guessing because the build process
automatically extends the header search path to include the module
source directory.  what i'm after is how to *extend* that search path
so i don't have to include header files by their absolute or relative
search path based on the module source directory.

  am i making any sense?

rday
--

========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
    Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux