I have the following (very simplified) Makefile:
# Makefile MAKESH=shell USER=$($MAKESH logname) which aims to store my login name in the USER variable as if the $(shell logname) command was invoked. However this doesn't happen. I suspect that it's due to the way make evaluates variables.
Does anyone have some more insight to this or a possible workaround i.e. explicitly tell make that $MAKESH is actually the shell command?
Thanks.
Edit
Consider the following example:
#parent.mk ... include child.mk ... ------------------- #child.mk export $(shell logname)/path1 export $(shell logname)/path2 ------------------- #bash_script.sh ... source child.mk ... (in this example, sourcing child.mk fails)
Essentially, what I wanted to do is to create a file that exports pathnames depending on the current user. The syntax should be valid both for makefiles and bash scripts, since it can be included/sourced from both places.
I also wanted to do subtle changes to these files, since they are part of a larger project and the interconnections are a bit confusing.
I have finally decided to go with this:
#parent.mk ... export logname=$(shell logname) include child.mk ... ------------------- #child.mk export $(logname)/path1 export $(logname)/path2 ------------------- #bash_script.sh ... source child.mk ... which is quite hacky, a tiny bit dangerous, but works. If you know a more elegant way/aprroach, let me know.
Finally, thank you for your solutions (and your warnings), which are valid for the pre-editted question.
shellcommand, but theshellfunction.:=for the assignment