[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: executing a rule prior to any targets?
From: |
Paul D. Smith |
Subject: |
Re: executing a rule prior to any targets? |
Date: |
Sat, 19 Oct 2002 09:10:21 -0400 |
%% gk <address@hidden> writes:
g> Yes, the method you suggest above does work but the problem is that
g> output is 'swallowed' by assignment to _x and doesn't appear in the
g> terminal.
That has nothing to do with whether you assign the value to a variable
or not. That's how the shell function is defined: see the GNU make
manual. If you didn't assign it to a function you'd get syntax errors,
because the function would expand to the output of the submake, then
make would try to parse that.
$(shell ...) in make works like backticks (``) in sh; that's its whole
purpose.
g> I would like to be have $(MAKE) recurse run just like if I had
g> typed 'make recurse' on the command line.
You can't do that using shell.
g> I wanted to do something similar with a 'debug' rule to echo some
g> makefile variables to the terminal; to somehow invoke the rule from
g> the makefile, without it having to be a target.
You can't do that.
Why don't you want it to be a target?
g> * I do not want to specify 'recurse' as a command line goal; I want to
g> build $(MAKECMDGOALS) in each directory in my list:
g> recurse :
g> @for dir in $(SUBDIRS); do\
g> $(MAKE) -C $$dir $(MAKECMDGOALS); \
g> done
See the GNU make manual for some reasons why doing submakes inside a
loop like this is suboptimal.
g> I could add 'recurse' as a command line goal, then remove it from
g> $(MAKECMDGOALS) in the makefile:
g> GOALS = $(filter-out recurse, $(MAKECMDGOALS) )
g> recurse :
g> @for dir in $(SUBDIRS); do\
g> $(MAKE) -C $$dir $(GOALS); \
g> done
You will have to do something like this. I can't think of any other way
to manage it. You could put the test into the shell script instead of
using make functions, but I don't know that it is much cleaner.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
- executing a rule prior to any targets?, gk, 2002/10/18
- Re: executing a rule prior to any targets?, Paul D. Smith, 2002/10/19
- Re: executing a rule prior to any targets?, gk, 2002/10/19
- Re: executing a rule prior to any targets?,
Paul D. Smith <=
- Re: executing a rule prior to any targets?, gk, 2002/10/20
- Re: executing a rule prior to any targets?, Philip Guenther, 2002/10/20
- Recursive Make Considered Harmful (was: Re: executing a rule prior to any targets?), gk, 2002/10/20
- Re: Recursive Make Considered Harmful (was: Re: executing a rule prior to any targets?), Philip Guenther, 2002/10/20
- Re: Recursive Make Considered Harmful (was: Re: executing a rule prior to any targets?), gk, 2002/10/23
- Re: Recursive Make Considered Harmful (was: Re: executing a rule prior to any targets?), Philip Guenther, 2002/10/24
- Re: Recursive Make Considered Harmful (was: Re: executing a rule prior to any targets?), gk, 2002/10/24
- Re: Recursive Make Considered Harmful (was: Re: executing arule prior to any targets?), Johan Bezem, 2002/10/24
- Re: Recursive Make Considered Harmful [Long Post], Johan Bezem, 2002/10/22
- Re: Recursive Make Considered Harmful [Long Post], gk, 2002/10/24