Evgeny Sologubov wrote:
> Thanks a lot! I've got a night of good meditation (-:
> The core idea for me is $(__FILE__) variable since it allows
> "namespacing" of included *.mk files.

Yup, that's certainly a benefit.

The primary reason I started using $(__FILE__) was to allow for included makefiles to 
know where they are in relation to the includer.  This, in turn, allows them to 
include other makefiles relative to them.  For example:

# ./GNUmakefile
$(call include-makefile,path/to/GNUinfo.mk)

# path/to/GNUinfo.mk
$(call include-makefile,$(dir $(__FILE__))GNUhelper.mk)

> NY> I'm sure you have some more questions, so, ask away.
> 
> Only one question. You wrote:
> 
> NY>    $(2): | $(dir $(2))
>              ^
>              |
>   What is that mean?
>   Just another way to enforce rebuild?

You forgot the '.' at the end.  It should be:

    $(2): | $(dir $(2)).

"Order rules" were introduced in make-3.80.  They mean that the LHS is dependent on 
the RHS's existence only.

The above basically says that $(2) is dependent on its directory existing.  Somewhere 
else in my makefiles, I have the rule:

%/.:
        mkdir -p $@

Why the '.' at the end?  I found out that GNU make will strip the trailing '/' from 
dependencies.

Noel
-- 
NOTICE: If received in error, please destroy and notify sender.  Sender does not waive 
confidentiality or privilege, and use is prohibited.


_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to