Reading User Input in a Makefile Script
I have a very simple Makefile (that just recursively calls another subdirectory make):
all:
cd addons/godot-haskell-plugin && make && cd -
run:
cd addons/godot-haskell-plugin && make run && cd -
What I'd like to do is
- Check if shell variable
ENV_VARis defined. - If it is, then run the Makefile as usual (i.e.,
ENV_VAR=1 make allshould do exactly asmake allabove). - If it isn't, then prompt the user with a message "Warning: ENV_VAR isn't defined; continue? [Y/n]", where an input of "Y" passes
make allandmake runas usual, and an input of "n" simply echos a message and exits.
I know that to do this in bash you would use a combination of echo and read functions. But it's unclear how to do this in Make.