[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [HELP] PHONY pattern rule makes the file w/ the same name
From: |
Bahman Movaqar |
Subject: |
Re: [HELP] PHONY pattern rule makes the file w/ the same name |
Date: |
Wed, 04 Oct 2023 07:40:24 -0700 |
User-agent: |
Evolution 3.50.0 |
Hit "Send" too soon.
To make matters more complicated, in the previous snippet, if I declare
`echo.%' as below (w/o any pattern-rule prerequisite) then Make behaves
as expected.
—————————————————————————————————————————————————————————————————
####################################################
# ./mk/echo.mk
####################################################
.PHONY : echo.%
echo.% :
@echo 'echo invoked with "$(*)"'
####################################################
# shell
####################################################
$ make echo.hello-there
echo invoked with "hello-there"
—————————————————————————————————————————————————————————————————
🤯
On Wed, 2023-10-04 at 07:34 -0700, Bahman Movaqar wrote:
> Hey all 👋
>
> To my mind, whenever a target is marked as PHONY it is supposed to
> simply
> ignore files with the same name. And that should be the behaviour of
> PHONY pattern rules too.
>
> With that said, I need some help understanding what happens in the
> following scenario please.
>
>
> —————————————————————————————————————————————————————————————————
>
> ####################################################
> # shell
> ####################################################
>
> $ ls *
>
> Makefile
>
> mk:
> echo.mk
>
> ####################################################
> # ./Makefile
> ####################################################
>
> include mk/echo.mk
>
> ####################################################
> # ./mk/echo.mk
> ####################################################
>
> .PHONY : a-target
>
> a-target.% :
> @echo 'a-target invoked with "$(*)"'
>
> ###
>
> .PHONY : echo.%
>
> echo.% : a-target.invoked-by-echo
> @echo 'echo invoked with "$(*)"'
>
> ####################################################
> # shell
> ####################################################
>
> $ make echo.hello-there
>
> a-target invoked with "invoked-by-echo"
> echo invoked with "mk/mk"
> echo invoked with "hello-there"
>
> —————————————————————————————————————————————————————————————————
>
> I wasn't expecting PHONY `echo.%' to be invoked for `echo.mk' which is
> a
> file.
>
> Am I missing something obvious in my snippet? Have I misunderstood the
> concept of PHONY?
--
Bahman
Join the chatter on Matrix:
🗣️ https://matrix.to/#/#.mk:matrix.org
Subscribe to the Lemmy community:
🐭 https://lemmy.ml/c/makefile