help-make
[Top][All Lists]
Advanced

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

environment variables in command part of rule


From: José Romildo Malaquias
Subject: environment variables in command part of rule
Date: Sat, 22 Oct 2011 06:50:59 -0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hello.

I want to define and use environemtn variables in the command part of a
rule in a makefile. The variables will capture the output of some
commands.

For instance, I would like to have something like the following:

%.a : %.txt
        p=$$(cat $< | wc -l)
        q=$$((p+10))
        echo $$q > $@

That is, I want to:
* set $p to the number of lines in the prerequisite file $<, s
* set $q to that value plus 10
* create the target file using $q

How to correctly writhe this rule?

Romildo



reply via email to

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