[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multiple rules for same target: what is the order of prerequisites i
From: |
Bahman Movaqar |
Subject: |
Re: Multiple rules for same target: what is the order of prerequisites in $^ and what does $< expand to? |
Date: |
Mon, 02 Oct 2023 12:00:17 -0700 |
User-agent: |
Evolution 3.50.0 |
On Mon, 2023-10-02 at 14:56 -0400, Paul Smith wrote:
> On Mon, 2023-10-02 at 11:48 -0700, Bahman Movaqar wrote:
> > my-target : foo
> > my-target :
> > @echo 'my-target: $$(<) is $(<)'
>
> This is an unusual way to construct this rule. Normally it would be:
>
> my-target : foo
> @echo 'my-target: $$< is $<'
>
> whereupon the value of $< is reliably "foo" regardless of anything else
> in the makefile.
Thanks for the hint re style. Finding good examples of writing easy-to-
read make files is no easy feat. That's why I do have these inaccuracies
in my personal style.
>
> > That brings me to the natural question: why would anyone ever use
> > `$(<)'? In other words, what is an appropriate usecase for that
> > variable?
>
> You have to use automatic variables, including $<, when you write
> implicit rules. There is no other option.
That makes sense. Thanks.
--
Bahman
Join the chatter on Matrix:
🌐 https://matrix.to/#/#.mk:matrix.org
Subscribe to the Lemmy community:
🌐 https://lemmy.ml/c/makefile