help-make
[Top][All Lists]
Advanced

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

Re: Capturing output of unix commands in Makefile


From: Paul D. Smith
Subject: Re: Capturing output of unix commands in Makefile
Date: Wed, 19 Jun 2002 20:47:03 -0400

%% Vibhu AV <address@hidden> writes:

  va> I am interested in capturing the output of a Unix comand, say
  va> "date", within a makefile. I would like to assign the output to a
  va> variable within the Makefile to use it and manipulate it.

You can't assign to a variable within a makefile, but in the situation
you describe below you don't need to: just use the shell.

  va> timeRun:
  va>   T1 = output of date
  va>   Run a looong job
  va>   T2 = output of date
  va>   timeDiff.pl T1 T2 # To get the diff between times T1 and T2


timeRun:
        t1=`date`; \
        Run a looong job; \
        t2=`date`; \
        timeDiff.pl $$t1 $$t2

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "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]