%% Kovalevich Victor <[EMAIL PROTECTED]> writes: kv> <html> kv> <head> kv> </head> kv> <body>
Please don't send HTML to the mailing lists; plain text is just fine. Thanks! kv> Hi!<br> kv> I have one question: can I use 'include' instruction in a make file that kv> is included by this instruction in an other make file. For example:<br> kv> <br> kv> <b>~/dir1/Makefile.inc:<br> kv> </b><br> kv> <i>#<br> kv> # ~/dir1/Makefile.inc file body<br> kv> ROOT=${HOME}<br> kv> </i><br> kv> <b>~/dir1</b><i>/</i><b>dir2/Makefile.inc:<br> kv> </b><br> kv> <i>#<br> kv> # ~/dir1/dir2/Makefile.inc file body<br> kv> include ../Makefile.inc<br> kv> </i><br> kv> <b>~/dir1/dir2/dir3/makefile:<br> kv> </b><br> kv> <i>#<br> kv> # ~/dir1/dir2/dir3/makefile file body<br> kv> include ../Makefile.inc<br> kv> usage:<br> kv> @ echo Root directory is ${ROOT}<br> kv> </i><br> kv> when I launched make process in ~/dir/dir2/dir2 directory I got following kv> messages:<br> kv> <br> kv> ../Makefile.inc:3: ../Makefile.inc: Too many open files<br> kv> Root directory is<br> kv> <br> kv> that means ROOT variable was not defined. Is there a defect of kv> make or did I do any mistake ? Unfortunately I did not find any kv> information about restriction of 'include' instruction usage in kv> make documentation. Can anyone explain me this effect? There is no restriction on the include instruction and recursion. The problem is that you are thinking that each makefile includes files relative to where the makefile is. That's not how it works: each include is made relative to the directory make was invoked in. So, in dir1/dir2/Makefile when you say "include ../Makefile.inc", if you run that from dir1/dir2/dir3 then you'll include dir1/dir2/Makefile.inc, _NOT_ (as you apparently want) dir1/Makefile.inc. The "too many open files" error is a hint: make is recursively opening the same makefile over and over again until it runs out of file descriptors. -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://www.paulandlesley.org/gmake/ "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Bug-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-make