makefile project never up-to-date  
Author Message
voyce





PostPosted: Visual C++ General, makefile project never up-to-date Top

Hi,

When creating a makefile project using VS2005 that wraps a call to nmake, it seems that Visual Studio always thinks that it's out-of-date and attempts to build it. I've tried explicitly setting the output filename (in project settings, NMake, Output) but this doesn't have any effect.

I have a test case that simply contains a project with a makefile that does a file copy, and you can see that VS always invokes nmake, even if the file is up-to-date. Let me know if you want it.

It's not clear to me how VS infers what the output file should be compared against Am I missing something

Btw, the behaviour is the same in VS2005 and SP1.

Ian



Visual C++9  
 
 
Mike Danes





PostPosted: Visual C++ General, makefile project never up-to-date Top

"I've tried explicitly setting the output filename (in project settings, NMake, Output) but this doesn't have any effect."

This is only used for running/debugging purposes. It is used by Start Debug/Start Without Debugging commands.

"It's not clear to me how VS infers what the output file should be compared against "

That's exactly the problem. VS cannot infer nothing about what a makefile can do. A makefile can build 2 executables, 1 dll, copy some header files to a distribution directory and erase your harddrive at the same time. VS has not way to guess that so all it can do is to run the nmake command every time. It's the job of nmake/makefile to know if the project is up to date and run the needed commands to make it up to date.


 
 
voyce





PostPosted: Visual C++ General, makefile project never up-to-date Top

Thanks for the clarification, Mike.

Unfortunately that means that other solutions which include this project always report that they need to be built (at least until the user disables the dialog). It's a shame it's not possible to explicitly specify the dependencies so at least in simple cases the information could be consistent between external tools and Visual Studio.

Ian


 
 
Mike Danes





PostPosted: Visual C++ General, makefile project never up-to-date Top

Well, I suppose that if you have other projects that depend on a makefile project then the output of the makefile project is either a static lib or a dll. In the case of a dll the output that is interesting from a dependency point of view is still a lib file. So as long as this lib file does not change the projects that depend on it should not be rebuilt (in fact relinked) even if the makefile project runs every time.

Practically I tried a makefile project that outputs a dll and I set the lib file as the output of this project. I created another Win32 exe project and set it to depend on the makefile project. The result:

  • first time everything gets build
  • second time the nmake command is run but since there is no change the lib file does not get rebuild. the win32 project is not build either
  • I modify something in the source of the makefile project. nmake runs and the lib file is updated. the win32 project is relinked


 
 
voyce





PostPosted: Visual C++ General, makefile project never up-to-date Top

Yep, this is exactly what I see, too, with a static library output.

So it seems this is really just a usability issue - the need to supress the "target out-of-date" dialog box - and the dependencies are working as expected. Excellent.

Thanks for your timely assistance!