Re: Targets directory name concatenation strangeness

2017-08-03 Thread Kyle Rose
On Thu, Aug 3, 2017 at 12:53 PM, Martin Dorey wrote: > "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 ha

Re: Targets directory name concatenation strangeness

2017-08-03 Thread Benjamin Cama
Hi Martin, Le jeudi 03 août 2017 à 16:53 +, 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: > > martind@swiftboat:~/tmp/benjamin-cama-2017-08-03$ cat Makefile > SUBDIR = $(@D) > $(SUBDIR

RE: Targets directory name concatenation strangeness

2017-08-03 Thread Martin Dorey
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: martind@swiftboat:~/tmp/benjamin-cama-2017-08-03$ cat Makefile SUBDIR = $(@D) $(SUBDIR)/target-%: martind@swiftboat:~/tmp/benjamin-cama-2017-08-03$ make -n -p 2>&1 | gre

Re: Fwd: Re: Target-specific variable in subdirectory problem

2017-08-03 Thread Benjamin Cama
Hi Sven, Le jeudi 03 août 2017 à 16:46 +0100, Sven C. Dack a écrit : > it's a common practise to create a Makefile for each subdirectory and > have it include definitions from a parent Makefile. That's probably why > you don't see that many directory-spanning features in make. It's easier > to man

Fwd: Re: Target-specific variable in subdirectory problem

2017-08-03 Thread Sven C. Dack
Hello Benjamin, it's a common practise to create a Makefile for each subdirectory and have it include definitions from a parent Makefile. That's probably why you don't see that many directory-spanning features in make. It's easier to manage Makefiles in a structure similar to the source code inst

Targets directory name concatenation strangeness

2017-08-03 Thread Benjamin Cama
OK, new subject as this specific behavior gets stranger. Le jeudi 03 août 2017 à 17:27 +0200, Benjamin Cama a écrit : > Le jeudi 03 août 2017 à 15:06 +, Edward Welbourne a écrit : > > Benjamin Cama (3 August 2017 17:00) > > > Well, I tried: > > > > > >SUBDIR = $(dir $@) > > >$(

Re: Target-specific variable in subdirectory problem

2017-08-03 Thread Benjamin Cama
Le jeudi 03 août 2017 à 15:06 +, Edward Welbourne a écrit : > Benjamin Cama (3 August 2017 17:00) > > Well, I tried: > > > >SUBDIR = $(dir $@) > >$(SUBDIR)/target-%: > > … > > > > But it doesn't work. But without a slash (which is already present at > > the end of $(SUB

Re: Target-specific variable in subdirectory problem

2017-08-03 Thread Benjamin Cama
Le jeudi 03 août 2017 à 14:59 +0200, Benjamin Cama a écrit : > To further enhance my understanding of the “right” usage of Makefiles, > would you advise me to explicitly specify the subdirectory in the > target > definition? Because I feel that counting on pattern rules to match in > subdirectory i

Re: Target-specific variable in subdirectory problem

2017-08-03 Thread Benjamin Cama
Le jeudi 03 août 2017 à 09:20 -0400, Kyle Rose a écrit : > On Aug 3, 2017 9:00 AM, "Benjamin Cama" wrote: > Anyway, it seems that a global variable would solve my problem, and > indeed it looks a bit more right this way: I can still get the stem in > my recipe (with $*), an

Re: Target-specific variable in subdirectory problem

2017-08-03 Thread Kyle Rose
On Aug 3, 2017 9:00 AM, "Benjamin Cama" wrote: Anyway, it seems that a global variable would solve my problem, and indeed it looks a bit more right this way: I can still get the stem in my recipe (with $*), and everything works as expected. It's just that the global namespace is “polluted” by thi

Re: Target-specific variable in subdirectory problem

2017-08-03 Thread Benjamin Cama
Hi Paul, Le mercredi 02 août 2017 à 15:16 -0400, Paul Smith a écrit : > On Wed, 2017-08-02 at 20:03 +0100, Sven C. Dack wrote: > > On 02/08/17 11:19, Benjamin Cama wrote: > > > Hi, > > > > > > I may be doing something wrong, but the following Makefile gives me > > > strange results: the target-sp