[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: |
Wed, 27 Sep 2023 08:07:32 -0700 |
User-agent: |
Evolution 3.50.0 |
On Wed, 2023-09-27 at 16:50 +0200, Renaud Pacalet wrote:
> %.a: %.b
>
> a.a: a.c
> echo $^
>
> I would not say that the pattern rule and the explicit rule are
> equivalent because they have different prerequisite lists, the former
> has no recipe, the latter has one. Yet, running 'touch a.c a.b; make -s
> a.a' prints only 'a.c', which shows that the pattern rule is ignored.
To my mind, it makes sense b/c `a.a' is more specific than `%.a' and as
such the prerequisites declared by the pattern rule do not apply.
To add a little twist here, the following snippet produces `foo a.c' 🙂
🙶
%.a : X = foo
%.a: %.b
a.a: a.c
@echo $(X) $(^)
🙸
--
Bahman
Join the chatter on Matrix:
🌐 https://matrix.to/#/#.mk:matrix.org
Subscribe to the Lemmy community:
🌐 https://lemmy.ml/c/makefile
Re: Multiple rules for same target: what is the order of prerequisites in $^ and what does $< expand to?, Mark Piffer, 2023/09/27