Using nmake directly

Hi,

Can anyone point me to a tutorial for importing a makefile into VC++ 2005 Express

I want to compile some samples in the Platform SDK (there don't seem to be compiled versions available anymore).  There are no .sln,.dsw, .prj files in the folders, just files called "makefile"...

Thanks,

Philip



Answer this question

Using nmake directly

  • Chris Sorsby

    Thanks for your post, however the video was of very little help. :(

    Ran into all sorts of problems with nmake.  As for simply importing the files into my own project, that seems to me to be quite a laborious process just to obtain the executable for several dozen example files.  I suppose there's no "three-click solution" to this.

    I think it's quite ridiculous that MS removed the compiled executables from their SDK, and has further made it difficult (esp. for newbies) to compile example files, by providing only a makefile with no extension that cannot easily be imported in their "starter" c++ package.  Oh well.  I will now download an old Platform SDK version with the compiled executables instead.  Summer 2004 I believe that means.

    Merry Xmas! :)


  • Janeli8

    I'm disappointed for you.  I don't have the PSDK installed on anything at the moment so I can't try my hand at any of the sample (I am working on a repaired system that came back with the OEM software restored).  The following observations might be helpful to others who want to build PSDK samples.

     - Dennis

    I notice from the CD-ROM that the April 2005 Platform SDK is 395MB, and that's all CAB files and setup.  (I recommend that students and beginners get the CD-ROM, because it arrives quickly and it is inexpensive.  Because you may want to reinstall it and modify the installation as experience is gained, having the CD is important.  It is also valuable, for professional purposes, to have old PSDKs on hand if it is necessary to troubleshoot an old build.)

    My initial explorations of VC++ 2005 Express indicate that Microsoft is going through a major transition.  There are breakages between 2005 and earlier versions of VS and the build and library model is changing.  My take is that we are seeing a major move toward the CLI and that it is pretty much all about .NET languages and .NET APIs, libraries, etc.  So with changes in the toolcraft for Windows, there is a problem about providing builds of the samples, and I wouldn't be surprised if some of the sample bits are pretty rusty.

    For beginners on Windows who want to be building GUI-level applications quickly I suspect that Visual C# 2005 Express is a better choice.  For one thing, it cuts down on the confusion around compiling a VC++ program and discovering that it requires a .NET Framework to run.  (I'm not sure about J# for non-Java-skilled beginners, but if it means the great Java Tutorials can be used, that's not bad either.  There is a Petzold book that uses C# and that might be just right, although the one I have is already dated.)

    One last thing.  The use of "makefile" and "MAKEFILE" with no extension is legacy from the original make system on Unix.  Given no /f parameter, nmake should use the MAKEFILE that it finds in the current working directory.  You'll need to know what targets to name (try "ALL").  There must be useful information about nmake on MSDN on-line or one of the other developer sites on the web.

    I agree that there is a lot of tacit understanding and toolcraft around the MS development stack, and it is hard to figure out how to guide beginners into it (and experienced developers don't notice to explain it).  Maybe if enough of us buddy up on exploring the Express versions, we can smooth the road for each other.



  • byang

    Here is a great little tutorial on nmake (in this case, a simple abstracted makefile) and a demonstration of the kind of transition that the PSDK and the development tools are in the middle of:

    http://pluralsight.com/blogs/dbox/archive/2005/07/18/13377.aspx

    If you are going to use nmake directly as a way to build samples, remember to run from within a console session like "Visual Studio 2005 Command Prompt" and with a vcvars *.bat file that sets up to search and use the PSDK /bin, /include and /lib directories that are needed.  (See the video on how to install the PSDK with VC++ 2005 Express at http://msdn.microsoft.com/visualc/learning/vcexpvids/).  Notice that it is the April 2005 PSDK (or later, real-soon-now) that works with VC++ 2005 Express. 

    Also, run nmake in the directory where you have moved a copy of the sample code (and makefile)  that you want to build from. 

    For a deeper view of nmake, try http://msdn.microsoft.com/library/en-us/vcug98/html/_asug_overview.3a_.nmake_reference.asp

    In the PSDK, look for the contents.htm file (in the root of the PSDK directory or on the root of the CD-ROM).  Also, the PSDK /include directory has a Win32.mak file that is referred to by other make files and that is annotated.  It looks like this file is fine the way it is for compiling on and for Windows XP (or any other configuration that VC++ 2005 Express runs on).

    Lots of tacit-toolcraft geekiness, huh  



  • NikonC

    nmake 8.00 and some other useful tools are included in the VC++ 2005 Express VC/bin folder (where the "Visual Studio 2005 Command Prompt" puts you).

    I suggest watching the video on "Editing and Compiling Existing C++ Files in VC++ Express" near the bottom of the page at

    http://msdn.microsoft.com/vstudio/express/visualc/learning/

    This describes how the VS File | New | Project From Existing Code ... operation provides the option to specify an external build system.  You'll have to figure out what the right commands are to have nmake use the makefile correctly for the different build functions.  You'll also have to deal with differences in compiler options and libraries.  If these are the kinds of make files that VS once used (it will have comments saying not to edit it), it will be particularly cryptic (IMHO).

    It might be better to see if you can get Visual Studio to figure out the build after importing the sample application from its SDK directory into a VS project as an existing set of files.  Actually, I would start there on a simple SDK sample and see how far you can get.

    Have fun.

     



  • Using nmake directly