List Info

Thread: using output of perl script in make file




using output of perl script in make file
user name
2007-10-25 01:39:57
Hi All,
I have a perl script "version.pl"; whose output i want to use in makefile. I tried to use shell function. but nothing is done..

"Makefile" and perl script "version.pl"; are in same directory..
what i am trying to do is.....


RELEASE_TAG_VALUE=$(shell perl ./version.pl -v)
BUILD_DATE_VALUE=$(shell date -u +"%A-%b-%d-%Y-%H:%M:%S";)

and then i am using above variables in following line.

$(CPP) -DRELEASE_TAG="$(RELEASE_TAG_VALUE)&quot; -DBUILD_DATE=&quot;$(BUILD_DATE_VALUE)&quot;  -P $(DB_XSD_CPP_DEFINES) $<&nbsp;  $.tmp

for your information...
--&gt; variable BUILD_DATE_VALUE got assigned by right value and is working fine

your help will be greatly appreciated.

Thanks and Regards
Ashish Raikwar

Re: using output of perl script in make file
country flaguser name
United States
2007-10-25 02:09:19
Ashish Raikwar wrote:

> RELEASE_TAG_VALUE=$(shell perl ./version.pl -v)
> BUILD_DATE_VALUE=$(shell date -u
+"%A-%b-%d-%Y-%H:%M:%S")

I don't know that it's relevant to your problem, but you
should
seriously consider using the simply expanded (immediate)
type of
variable and not recursive (deferred) expansion.  This means
using ":="
and not "=" to assign values.  With deferred
expansion the shell
commands will be (re-)run every single time those variables
are
referenced in a rule or expanded in another variable, which
could
potentially be very costly (and not what you intended.)

<http://www.gnu.org/software/make/manual/html_n
ode/Flavors.html>

Brian


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make

Re: using output of perl script in make file
user name
2007-10-25 12:40:57
On 10/25/07, Brian Dessent <briandessent.net> wrote:
> Ashish Raikwar wrote:
>
> > RELEASE_TAG_VALUE=$(shell perl ./version.pl -v)
> > BUILD_DATE_VALUE=$(shell date -u
+"%A-%b-%d-%Y-%H:%M:%S")

if RELEASE_TAG_VALUE isn't getting the value you expect,
then the
problem is that version.pl is not writing the text to
standard output.
 If version.pl is writing the text to stderr, you could
redirect.

RELEASE_TAG_VALUE=$(shell perl ./version.pl -v 2>&1)

But, there is nothing wrong with your make fragment per se
though I
totally agree with Brian's suggestion to use simply
expanded
variables.  I wish you the best in your debugging of
version.pl.

   Ken


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make

RE: using output of perl script in make file
country flaguser name
United Kingdom
2007-10-25 13:54:34
On 25 October 2007 18:41, Ken Smith wrote:

> On 10/25/07, Brian Dessent <briandessent.net> wrote:
>> Ashish Raikwar wrote:
>> 
>>> RELEASE_TAG_VALUE=$(shell perl ./version.pl
-v)
>>> BUILD_DATE_VALUE=$(shell date -u
+"%A-%b-%d-%Y-%H:%M:%S")
> 
> if RELEASE_TAG_VALUE isn't getting the value you
expect, then the
> problem is that version.pl is not writing the text to
standard output.

  Well, either that, or perhaps make is not currently in the
same CWD as the version.pl script; might be worth trying a
full path to it instead of just the './' prefix.  Or adding
something like 

$(info dir $(CURDIR) contains $(wildcard ./*.pl))

at a convenient point.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....



_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )