On Wed, 2007-03-21 at 23:17 -0400, Frazer Worley wrote: > > We work in configuration management areas which is identifed using the > $WORKSPACE environment variable. > > eg WORKSPACE= /prj/qct/qctps/eng_dev/workspaces/fworley/devel/axi_ws > > All files specified in the Makefile are thus relative to $WORKSPACE. > > SCRATCH_DIR= ${WORKSPACE}/scratch/${USER} > > Under a workspace there can be several levels of subdirectories and > the paths can become distractingly long and lead to very noisy looking > output from the commands invoked by Make. > > It would be preferable if the $WORKSPACE variable were not expanded by > Make
Well, obviously make has to expand the variable internally, or else it can't find the targets and prerequisites that it needs to determine if things need to be rebuilt. So, apparently what you are asking is if the variable can be expanded by make internally, but still display the unexpanded value to the user. But the problem is, how can make decide what should be expanded and what shouldn't be? Your rule is uses $(SCRATCH_DIR), and you want that expanded partly (to $WORKSPACE/scratch/fworley) but not completely... I'm sure you can see that make itself cannot determine what you really want. You have two choices that I can see: First, write your rules so they use $$WORKSPACE instead of $(WORKSPACE). Note you CANNOT use the same variables such as SCRATCH_DIR both for make and for your rules; the make-targeted version must use $(WORKSPACE) while the version appearing in the command scripts must use $$WORKSPACE. The only other alternative is to change your rules to echo one form of the rules (processed to replace $(WORKSPACE) with $$WORKSPACE) while invoking a different one. Something like this: %.x : %.y @echo '$(subst $(WORKSPACE),$$WORKSPACE,$(DO) $(MY) $(COMPILE))' @$(DO) $(MY) $(COMPILE) I suppose a third option is to run make inside a filter that does this for you; something like: #!/bin/sh make "$@" | sed "s,$WORKSPACE,\$WORKSPACE,g" -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> 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 _______________________________________________ Help-make mailing list Help-make@gnu.org http://lists.gnu.org/mailman/listinfo/help-make