[riot-devel] Location of header files

Oleg Hahm oliver.hahm at inria.fr
Thu Jun 20 13:09:36 CEST 2013


Dear rioters,

writing a new application for RIOT, I'm stumbling once again about the same
old question: what would be the best way to store and include header files?

Currently most of the header files are located within an include subdirectory
of the module's directory, e.g. headers for the kernel itself are found in
core/include or headers for the lpc2387 are found in cpu/lpc2387/include.
However, some headers are stored in more generic include directories, one
level above the module directory (e.g. sys/include) or even directly within
the same directory as the C files (e.g. sys/net/sixlowpan or drivers/cc110x/).

This situation is clearly poor and unsatisfying. Additionally, it raises the
question about how to include the headers into C files. Should each
application add every single include path to its Makefile and then just put a
  include "foobar.h"
into the source code or is it "better" to include relative paths like
  include "sys/foo/foobar.h"
?

I really think we should tidy up this mess once and for all. So, what do you
prefer? Put all headers into a generic path (like *nix system do)? Something
like RIOT/include/. Or enforce the policy to store headers closely to the
corresponding C files? And if so, would you prefer separate include
directories or mingle source and header files?

Personally, I would vote to locate header files into an include subdirectory
of the corresponding module. In my opinion, this is the cleanest solution and
obeys RIOT's modularity best. I would then configure the Make system in a way,
that include paths are set accordingly to the used modules in the
application's Makefile. Whaddayathink?

Cheers,
Oleg
-- 
panic("Attempted to kill the idle task!");
        linux-2.2.16/kernel/exit.c


More information about the devel mailing list