3
votes

I have a directory which internal contains sub directories. I want to include the parent directory as include path in make file for header files. Is there a syntax so that all the sub directories are searched for the header files.

[EDIT] Posting the question in more detail
There are three sub folders in a parent folder
parentFolder/child1
parentFolder/child2
parentFolder/child3

There are header files in each all subfolders

Using -I option in makefile for header file path, i have to use
HEADER_PATH += -I./parentFolder
HEADER_PATH += -I./parentFolder/child1
HEADER_PATH += -I./parentFolder/child2
HEADER_PATH += -I./parentFolder/child3

Is there any way I can mention only the parent folder , but the search for header files will happen in all the subfolders also
1
What compiler are you using? Could you show us the rule? - Beta
I am using g++ in linux - SathyaKrishna Prabhu Tadepalli

1 Answers

3
votes

http://www.gnu.org/software/make/manual/html_node/Recursion.html

Setup variable in first makefile and export it for sub-dirs. If you want to be able to invoke make in subdirs manually - i suppose best way to achieve this is either using configure-like systems to generate paths for you, or setting global variable (e.g. YOURPROJECT_DIR) in .profile or .bashrc and using it in makefiles.

I would like to see better solutions since i've encountered quite the same problem some time ago.