Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] MSVC (was Build Again) (OT)

Am Donnerstag, 29. April 2010 10:25:20 schrieb Jesper Eskilson:
> On 2010-04-28 15:25, Doug Schaefer wrote:
> > It wouldn't be that complicated. You'd probably do it the same way you
> > pass the list of object files to the linker.
> 
> No, because the linker ALWAYS receives ALL the objects files. The rule
> typically looks like this
> 
> foo.exe: $(OBJS)
>           $(LINK) $^ -o $@
> 
> If you would do the same with the compiler, you would *always* compile
> *all* source files. Instead, compiler rules typically look something
> like this:
> 
> .c.h:
> 	$(CC) -c $< -o $@
> 
> This will invoke "cl -c foo.c -o foo.o", once for each source file which
> is out of date. I cannot see how the /MP option allows cl to
> parallellize over all the source files it should compile.
> 
> This is getting too off-topic for CDT, so I'll stop here. Sorry if I'm
> not able to make myself clear.
> 
I just had a look at our Makefiles. The structure is indeed like you said. 
 .c.h:
 	$(CC) -c $< -o $@
The compiler is invoked for every source file. When I add /MP3 to the compiler 
flags three cl instances will run. I think one instance acts like a kind of 
manager and two instances do actually compile. The compile time benefit is 
measurable.
More info here:
http://msdn.microsoft.com/en-us/library/bb385193.aspx

   Axel


Back to the top