bug-make
[Top][All Lists]
Advanced

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

Re: [Fwd: isatty function?]


From: Paul D. Smith
Subject: Re: [Fwd: isatty function?]
Date: Thu, 12 Sep 2002 14:02:47 -0400

%% mst <address@hidden> writes:

  m> How about a way to call "system" without catching stdout, let
  m> stdout be copied as is to the child process?

  >> Hmm.  Maybe.  I still don't know that it's that useful.

  m> I know I wanted to get the exit status of the program into a
  m> variable many times.  This would be possible:

While not saying I think a $(system ...) function is not useful (I still
have this under advisement), I will say that the examples you give are
already fairly easily done:

  m> ifeq ($(system test -e filename),0)
  m> --FILE exists
  m> else
  m> --FILE does not exist
  m> endif

This is much more efficiently done with the $(wildcard) function:

 ifneq ($(wildcard filename),)
 --FILE exists
 else
 --FILE does not exist
 endif

Avoids a shell invocation, test invocation, etc.

  m> Another example: print date to stdout while makefile is evaluated:

  m> dummy:=$(shell date)

Yes; you can do this but it's a big more ugly:

  dummy := $(shell date 1>&2)

also the result goes to STDERR instead of STDOUT, which might not be
what you wanted.

-- 
-------------------------------------------------------------------------------
 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]