help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: user input


From: Paul D. Smith
Subject: Re: user input
Date: Mon, 10 Nov 2003 14:06:09 -0500

%% "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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]