help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

include ... why not search in same directory ?


From: Markus Mauhart
Subject: include ... why not search in same directory ?
Date: Thu, 17 Apr 2003 14:54:01 +0200

Hi,


assume two makefiles "asd/1.mk" and "asd/2.mk", and
"asd/1.mk" contains the directive "include 2.mk".
I start it with "make -f asd/1.mk" and to my surprise get
the error "asd/1.mk:5: 2.mk: No such file or directory".
(make 3.8, built and run under cygwin)
Now looking into the docu it seems that this is no bug
but the designed behaviour:

------------------
3.3 Including Other Makefiles:
....
If the specified name does not start with a slash, and the file is not found
in the current directory, several other directories are searched. First, any
directories you have specified with the `-I' or `--include-dir' option are
searched (see section Summary of Options). Then the following directories
(if they exist) are searched, in this order: `prefix/include' (normally
`/usr/local/include' (1)) `/usr/gnu/include', `/usr/local/include', 
`/usr/include'.
------------------

OTOH I wouldnt be surprised when "in the current directory" originally ment
"in the current makefile's directory".


So why doesnt look make 1st inside the current makefile's own
directory as it is the case with the C-preprocessor ?
It's very hard to work around this behaviour cause there is
no builtin variable $(__FILE__) which could be used for ...

    include $(dir $(__FILE__))/2.mk.

Any chance that this will be changed ?


Thanks,
Markus.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]