help-make
[Top][All Lists]
Advanced

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

Re: multiple targets for a single command


From: Jonathan Baccash
Subject: Re: multiple targets for a single command
Date: Wed, 5 Oct 2005 10:16:29 -0700

> > Some commands create more than one result, and make (3.81beta3)
> > behaves funny when I try to account for this.  For example:
> >
> > #-------------
> > a: b
> >       touch a
> >
> > b: c
> >
> > c: d
> >       touch c
> >       touch b
> > #-------------
>
> There is nothing funny about this. The only way make can know what
> you are updating in your command script is if you explicitly told
> it so, e.g.:
>
> c b: d
>        touch $@
>
> If you really need to update several targets at once (i.e., they cannot
> be rewritten as separate rules) then you will need to use implicit rules
> for this.
>

Ok, in my attempt to dumb down the example, I guess I dumbed it down a
bit too much.... In reality, the command I'm running is lib.exe, which
comes with the visual studio compiler.  When I run lib /DEF:my.def,
the outputs created are my.exp and my.lib.  Some commands depend on
my.exp, and others on my.lib.

So the actual makefile would be more like
my.dll: my.exp my.obj
      link /DLL $^

my.exp: my.lib

my.lib: my.def
      lib /DEF:my.def

So I run it once and it's fine.  I then touch my.def and run it a
second time and I only get the lib command to run, and not the link
command as I expected.  Note that your solution does not work in this
case.  If i did:

my.exp my.lib: my.def
      lib /DEf:my.def

then the lib command might be run once for targets that depend on
my.exp and once for targets that depend on my.lib.  And parallel make
would no longer work.

I don't think I'm really hiding anything from make here.  I told make
that to update my.exp, it needs to update my.lib.  Ok, it did that,
and then it thought my.exp was not newer than my.dll.  I think the
problem is that the timestamp for my.exp has been cached, and it is
not updated because I don't give a command to make my.exp.  So adding
a touch command will fix the problem.  Is this expected?




reply via email to

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