help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gmake: how to avoid $$@ usage?


From: Ernest
Subject: gmake: how to avoid $$@ usage?
Date: Mon, 28 Feb 2005 16:39:00 -0600
User-agent: Xnews/5.04.25

The GNU make manual, section 10.5.3, mentions the use of the SysV-style 
automatic variables $$@, $$(@D), and $$(@F), and that these "bizarre" uses 
are not necessary ("there are other ways to accomplish the same results").  
How?

For example, I need to do some stuff like what's shown below, where the 
prereq names are determined by a semi-complex manipulation of the target 
name (it's actually much more complex than this example).  This doesn't 
work, though.

# assume there are MANY targets of the form "build_all", and the
# ${FN1} function needs to work for all of them
# (comp_all, clobber_all, etc.)

# this will set ACTION to the target name without the "_all" on
# the end, and then push that value on to the FN2 variable for
# further manipulation.
FN1 = $(foreach ACTION,$(patsubst %_all,%,$$@),${FN2})
FN2 = _${ACTION}_actions_

# the ${FN1} prereq in the following case should ultimately become
# the string "_build_actions_"

build_all : ${FN1}

_build_actions_ : other stuff


reply via email to

[Prev in Thread] Current Thread [Next in Thread]