help-make
[Top][All Lists]
Advanced

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

RE: GNU Make problem with $(shell ... )


From: Tim . Mason
Subject: RE: GNU Make problem with $(shell ... )
Date: Mon, 3 Dec 2001 18:12:46 +0200

address@hidden wrote:
> 
> All the variables and functions in a rule script are evaluated before
> the first line is run.  For example, in:
> 
>   foo:
>         echo $(FOO)
>         echo $(BAR)
> 
> Make goes:
> 
>   evaluate FOO, evaluate BAR, run echo $(FOO), run echo $(BAR)
> 
> and NOT:
> 
>   evaluate FOO, run echo $(FOO), evaluate BAR, run echo $(BAR)

I was assuming the latter was true, would explain why it's not doing
what I expect

> 
>   tm> Any ideas?
> 
> It's not clear to me what you're _really_ trying to do.

Every time I build an executable I append some information about the
build to a log file. This is done with a perl script called in one of
the makefile rules. The script tags this information with a unique
serial number, and sends this number to stdout.

What I need to do is create a copy of the exe, and rename it with this
unique number so I can keep track of which exes are available.

So what I was hoping to do was basically something like this:

a.exe : a.obj b.obj
        lnk a.obj b.obj $@
        perl build_log.pl $(build_options) > new.number
        cp a.exe $(shell cat new.number).exe


But now I have to do this:


dummy.file: a.exe
        cp $< $(shell cat new.number).exe       
        touch dummy.file

a.exe : a.obj b.obj
        lnk a.obj b.obj $@
        perl build_log.pl $(build_options) > new.number


and instead of "gmake a.exe" I have to do "gmake dummy". A rather
inelegant solution...

Any comments or suggestions would be much appreciated.

BTW, the perl script can't be altered.

Tim

--------------------------------------------------------
address@hidden 



reply via email to

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