Hello,
I would like my Makefile to:
1. Check if a variable is set to specific value,
2. If it is, execute a script and get its return value,
3. Stop executing Makefile depending upon return value.
Here is the Makefile I have:
`Makefile`
-------------------------------------------------------------
FORCE=true
all: check_force
@echo "success"
check_force:
ifeq ($(FORCE),true)
$(shell sh ./prompt.sh)
endif
-------------------------------------------------------------
and here is the `prompt.sh` file:
`prompt.sh`
-------------------------------------------------------------
while true;
do
read -p "Are you sure you want force to be \"true\"? (y/n) " resp
case $resp in
[Yy]* ) echo "You picked yes"; exit 0;;
[Nn]* ) echo "You picked no"; exit 1;;
* ) echo "You picked nonsense";;
esac
done
-------------------------------------------------------------
I have tried many different variations of this with various
errors/problems, but basically I would like to stop execution if FORCE
is set to "true" and if the user selects "n" in the prompt. If the user
selects "y" I would like things to continue (in this case simply echo
"success"). If FORCE is not set to "true", I don't want the script to
execute at all.
Thanks for any help! Ask for more details if I'm not making sense...
Cheers,
Thomas
_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make