[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: user input
From: |
Noel Yap |
Subject: |
Re: user input |
Date: |
Mon, 10 Nov 2003 14:18:58 -0500 |
At one point I was trying to do something similar. The problem I ran into was
that the interactivity occurred each time the makefile was parsed and reparsed.
I've since put this on hold indefinitely.
Noel
"Paul D. Smith" wrote:
>
> %% "Gustavo A. Baratto" <address@hidden> writes:
>
> gab> is there any other way to handle user input? I came up with this,
> gab> but I think it is pretty lame. pretty sure there a smarter way to
> gab> this...
>
> Make is not designed to be an interactive tool; it's designed and
> intended to be non-interactive. So, no, I don't know of any
> fundamentally better way to do what you're asking (although if it were
> me I wouldn't bother with creating shell scripts, etc. and I'd just
> do it something like this:
>
> QUERYUSER = $(shell echo "$1" 1>&2; read input; echo $$input)
>
> VALUE1 := $(call QUERYUSER, Enter value 1:)
> VALUE2 := $(call QUERYUSER, Enter value 2:)
>
> This does write the prompt to stderr instead of stdout, but...
>
> But, if it _really_ were up to me I wouldn't use interactivity at all.
> I'd check if the variables were set and if not I'd just fail, and have
> people set them on the command line:
>
> ifndef VALUE1
> $(error Please set the VALUE1 variable.")
> endif
> ifndef VALUE2
> $(error Please set the VALUE2 variable.")
> endif
>
> --
> -------------------------------------------------------------------------------
> Paul D. Smith <address@hidden> 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
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-make
--
NOTICE: If received in error, please destroy and notify sender. Sender does
not waive confidentiality or privilege, and use is prohibited.