[Top][All Lists]

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

Re: can't compute prerequisites in static pattern rule

From: Noel Yap
Subject: Re: can't compute prerequisites in static pattern rule
Date: Wed, 17 Dec 2003 08:30:29 -0500

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/

# path/to/
$(call include-makefile,$(dir $(__FILE__))

> 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.

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

reply via email to

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