|
|
Subscribe / Log in / New account

Driver porting: compiling external modules with local includes

Driver porting: compiling external modules with local includes

Posted Aug 9, 2004 21:22 UTC (Mon) by cpp9999 (guest, #23889)
Parent article: Driver porting: compiling external modules

I'm having trouble compiling an external module under the following dir structure
A local header file sits in a directory other than the one that contains the main file
See below:
home_dir/dirA/local.h
home_dir/dirB/main.c

sample main.c file
#include "dirA/local.h"
main ()
{
/* some code */
}

# make -C /usr/src/linux-2.6.7 SUBDIRS=$(PWD) modules
When I try to compile I get the following error messages
Entering directory /usr/src/linux-2.6.7
CC [M] /home_dir/dirB/main.c:15:32: dirA/local.h: No such file or directory

Obviously when I am in /usr/src/linux-2.6.7 I cannot see local.h.

Any ideas how to fix this? Thanks


to post comments

Driver porting: compiling external modules with local includes

Posted Oct 15, 2004 16:48 UTC (Fri) by geoff_o (guest, #25424) [Link] (1 responses)

I've also been searching for the answer to this question.

What I'd like to be able to do is set a couple of extra 'include' paths. (I note from earlier articles that setting 'CFLAGS' is .. umm.. discouraged.)

I hope there's a work around, otherwise it makes it difficult to develop modules outside the kernel tree that depend on each other.

Does there exist a solution?

Thanks,

Geoff

Driver porting: compiling external modules with local includes

Posted Oct 20, 2004 5:24 UTC (Wed) by amcrae (guest, #25501) [Link]

What I'd like to be able to do is set a couple of extra 'include' paths. (I note from earlier articles that setting 'CFLAGS' is .. umm.. discouraged.)

I needed to do the same thing. You can do this with the EXTRA_CFLAGS Makefile variable:

...
obj-m += file.o
EXTRA_CFLAGS += -I$(obj)/../include

Cheers,
AMc


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds