[Top][All Lists]

[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


assume two makefiles "asd/" and "asd/", and
"asd/" contains the directive "include".
I start it with "make -f asd/" and to my surprise get
the error "asd/ 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', 

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__))/

Any chance that this will be changed ?


reply via email to

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