[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Targets directory name concatenation strangeness
From: |
Benjamin Cama |
Subject: |
Re: Targets directory name concatenation strangeness |
Date: |
Thu, 03 Aug 2017 19:05:10 +0200 |
Hi Martin,
Le jeudi 03 août 2017 à 16:53 +0000, Martin Dorey a écrit :
> You're trying to use an automatic variable in a scope where it doesn't
> have the value you want. make -p is how I'd debug such:
>
> address@hidden:~/tmp/benjamin-cama-2017-08-03$ cat Makefile
> SUBDIR = $(@D)
> $(SUBDIR)/target-%:
> address@hidden:~/tmp/benjamin-cama-2017-08-03$ make -n -p 2>&1 | grep target-
> | grep -v FEATURES
> /target-%:
> address@hidden:~/tmp/benjamin-cama-2017-08-03$
>
> The documentation, specifically
> https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html,
> speaks directly to this case:
>
> "It’s very important that you recognize the limited scope in which
> automatic variable values are available: they only have values within
> the recipe. In particular, you cannot use them anywhere within the
> target list of a rule; they have no value there and will expand to the
> empty string."
Thank you very much for this reminder, and the "-p" switch that I did
not know. Examining the example without a slash with it made me realize
that it then works because the target is then the bare pattern filename
($(SUBDIR) is empty and there is no slash added before the file name),
which can match in any subdirectory. So, I was actually back where I
started.
Thanks again for these explanations!
--
Benjamin Cama - Tél : 258
- Re: Target-specific variable in subdirectory problem, (continued)
- Re: Target-specific variable in subdirectory problem, Paul Smith, 2017/08/02
- Re: Target-specific variable in subdirectory problem, Benjamin Cama, 2017/08/03
- Message not available
- Re: Target-specific variable in subdirectory problem, Benjamin Cama, 2017/08/03
- Targets directory name concatenation strangeness, Benjamin Cama, 2017/08/03
- RE: Targets directory name concatenation strangeness, Martin Dorey, 2017/08/03
- Re: Targets directory name concatenation strangeness,
Benjamin Cama <=
- Re: Targets directory name concatenation strangeness, Kyle Rose, 2017/08/03
Fwd: Re: Target-specific variable in subdirectory problem, Sven C. Dack, 2017/08/03