bug-make
[Top][All Lists]
Advanced

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

Re: phony fails when the target is a recipe


From: Thomas Lynch
Subject: Re: phony fails when the target is a recipe
Date: Tue, 2 Apr 2019 13:15:56 +0200

p.s.

GNU Make 4.2.1
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


On Tue, Apr 2, 2019 at 1:11 PM Thomas Lynch <address@hidden> wrote:
We have had a lot of problems with phony hints being ignored and makefiles not running. 

I've narrowed it down to a small example.  See the transcript below in this email, or the code at 
In this example there is a target, 'lib', and there happens to be a directory with the same name - this is a common combination.   There is a phony declaration for lib, but it gets ignored.   

I've added a second phony target, 'version', which also has a directory.   That works.  The only difference is that the target is not given as a pattern.  I've also run this example with a target that does not correspond to a file or directory, and that also works as expected.  

So it appears that phony hints are ignored if targets are patterns rather than literals.  Consequently it appear that there is no way to give phony hints in fancy makefiles that use general recipes. 

Seems the phony hints should be checked against the target provided to make, which will be literal, and then prevent the directory search.  Apparently this is not the case.  If it is only to be checked when there is a match to a provided target, then that check would hopefully occur after the pattern expansion.  It isn't clear to me where else it is possible to do the check, but somehow it is doing the check somewhere else.

---------------->

2019-04-02T10:48:22Z
address@hidden/subu_land/subu/try/phony_general_targets§
> cat makefile 


.PHONY: lib version

version:
@echo "version 0.1"

%::
@echo $@



2019-04-02T10:48:27Z
address@hidden/subu_land/subu/try/phony_general_targets§
> mkdir version lib

2019-04-02T10:48:38Z
address@hidden/subu_land/subu/try/phony_general_targets§
> ls
lib  makefile  version

2019-04-02T10:48:42Z
address@hidden/subu_land/subu/try/phony_general_targets§
> make version
version 0.1

2019-04-02T10:48:50Z
address@hidden/subu_land/subu/try/phony_general_targets§
> make code
code

2019-04-02T10:48:57Z
address@hidden/subu_land/subu/try/phony_general_targets§
> make lib
make: Nothing to be done for 'lib'.

2019-04-02T10:49:00Z
address@hidden/subu_land/subu/try/phony_general_targets§



reply via email to

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