08-04-05 11:00 PM
skyfaye@gmail.com wrote:
> Hi,
>
> Is it possible to pass the value of a shell var in one target to
> another target? The code below does not work because each target uses
> a different subshell to execute it's command. Of course I can set
> NAME=John when I invoke this Makefile but I want my Makefile to handle
> all this.
>
Unfortunately, the answer to your question is simply no, however, you can
often accomplish something similar using Makefile macros, i.e.
macronumberone = `ls -al somefile.in | awk '{print $$5}'`
macronumbertwo = `echo $(macronumberone) | wc -c`
somefile: somefile.in
sed -e 's/filesize=.*/filesize='$(macronumbertwo)'/g' somefile.in \
> somefile
Unfortunately this is somewhat limited; which means that if you really need
to do some scripting, it's better done in a script that the Makefile calls
to build a rule.
Hope it helps.
[ Post a follow-up to this message ]
|