On Tue, 2013-08-13 at 17:02 +0200, andreas graeper wrote: > target: xxx > @[ "$(origin $(*))" != "undefined" ] && echo "$($(*))" > > `make -f that-makefile goal` is called from shell script > > i tried to call a test makefile with and without goal > > make > and > make <goal> > and i thought i could find the goal in $0 or $1 .. . is there a > automatic variable that tells me whether an explicit goal was given as > argument.
No; automatic variables are values that are only relevant for a given target. "Whether there was an explicit goal given as a command line argument" is a global setting for the entire make invocation, so doesn't belong there. Look up the MAKECMDGOALS variable in the GNU make manual. > and what is $*. in which cases it can be != 'undefined' ( result from > $(origin $(*)) ) The meaning of $* can be found in the GNU make manual section on automatic variables. It means the part of the target which matches a pattern. Note it will be empty if there's no pattern or suffix that matches this target. However note that origin takes the NAME of a variable. So by passing it $* the code is checking to see if the variable with the NAME $* is defined or not. If it wanted to see if the variable "*" itself is defined or not, it would call $(origin *) So in your example, if $* is "target", then this checks to see if the variable $(target) is defined or not. _______________________________________________ Help-make mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-make
