How to use makefiles in Visual Studio?

前端 未结 8 2365
隐瞒了意图╮
隐瞒了意图╮ 2020-12-07 22:35

I heard a lot about makefiles and how they simplify the compilation process. I\'m using VS2008. Can somebody please suggest some online references or books where I can fin

相关标签:
8条回答
  • 2020-12-07 22:56

    If you are asking about actual command line makefiles then you can export a makefile, or you can call MSBuild on a solution file from the command line. What exactly do you want to do with the makefile?

    You can do a search on SO for MSBuild for more details.

    0 讨论(0)
  • 2020-12-07 23:00

    Makefiles and build files are about automating your build. If you use a script like MSBuild or NAnt, you can build your project or solution directly from command line. This in turn makes it possible to automate the build, have it run by a build server.

    Besides building your solution it is typical that a build script includes task to run unit tests, report code coverage and complexity and more.

    0 讨论(0)
  • 2020-12-07 23:02

    I actually use a makefile to build any dependencies needed before invoking devenv to build a particular project as in the following:

    debug: coratools_debug
        devenv coralib.vcproj /build debug
    
    coratools_debug: nothing
        cd ../coratools
        nmake debug
        cd $(MAKEDIR)
    

    You can also use the msbuild tool to do the same thing:

    debug: coratools_debug
        msbuild coralib.vcxproj /p:Configuration=debug
    
    coratools_debug: nothing
        cd ../coratools
        nmake debug
        cd $(MAKEDIR)
    

    In my opinion, this is much easier than trying to figure out the overly complicated visual studio project management scheme.

    0 讨论(0)
  • 2020-12-07 23:07

    A UNIX guy probably told you that. :)

    You can use makefiles in VS, but when you do it bypasses all the built-in functionality in MSVC's IDE. Makefiles are basically the reinterpret_cast of the builder. IMO the simplest thing is just to use Solutions.

    0 讨论(0)
  • 2020-12-07 23:07

    To summarize with a complete solution...

    There are 2 options:

    1. Use NMAKE from the Developer Command Prompt for Visual Studio

    The shortcut exists in your Start Menu. Look inside the makefile to see if there are any 'setup' actions. Actions appear as the first word before a colon. Typically, all good makefiles have an "all" action so you can type: NMAKE all

    1. Create a Solution and Project Files for each binary.

    Most well designed open source solutions provide a makefile with a setup action to generate Visual Studio Project Files for you so look for those first in your Makefile.

    Otherwise you need to drag and drop each file or group of files and folders into each New Project you create within Visual Studio.

    Hope this helps.

    0 讨论(0)
  • 2020-12-07 23:13

    The Microsoft Program Maintenance Utility (NMAKE.EXE) is a tool that builds projects based on commands contained in a description file.

    NMAKE Reference

    0 讨论(0)
提交回复
热议问题