Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 09-15-2009, 04:02 PM   #1
LQ Newbie
Registered: Sep 2009
Posts: 4

Rep: Reputation: 0
Question How to add include path to kernel module Makefile


I have probably a stupid question. How do I add an include path for kernel module makefile? I want to include "test_kernel.h" in test_module.c
test_kernel.h resides in a different directory with relative path "../../common/" . I can include the file specifying the relative path, which works OK:

#include "../../common/test_kernel.h"

I would like include it without the relative path and specify path in Makefile similar to -I option available in application makefiles. I have tried EXTRA_CFLAGS += -I../../common/ in the makefile but no use. Any suggestions?

Old 09-16-2009, 08:59 AM   #2
LQ Newbie
Registered: Sep 2009
Posts: 4

Original Poster
Rep: Reputation: 0

Relative paths don't work. It has to be absolute path.
eg EXTRA_CFLAGS += -I$(PWD)/../../common/
Old 09-16-2009, 09:09 AM   #3
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Originally Posted by oblix View Post

Relative paths don't work. It has to be absolute path.
eg EXTRA_CFLAGS += -I$(PWD)/../../common/
Hi oblix,

Welcome to LQ

If your issue is really solved, you can if you like, use the "Thread Tools" menu near the top of the page, and officially mark the thread [solved]

Also, I noticed that you posted your thread in more than one forum; please do not do that -- if you discover that you should have posted your question in a different place, please use the REPORT button and ask for it to be moved for you
I'll have your other thread closed.


Last edited by GrapefruiTgirl; 09-16-2009 at 09:11 AM.


makefile, modules

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
old 2.4 kernel module makefile reuse kannankvs Programming 0 08-18-2009 07:54 PM
need help in writing Makefile for module in 2.6 kernel videsh Programming 1 01-19-2006 07:35 AM
recompile kernel to include module samfrog88 Linux - Software 1 01-06-2005 06:28 PM
Use mkinitrd to include module in kernel Travers Linux - Newbie 1 07-23-2004 02:35 PM
module makefile for c++ in kernel 2.6 yuhuahe Linux - Software 0 04-14-2004 06:03 PM

All times are GMT -5. The time now is 05:43 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration