CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2003
    Posts
    53

    Export Makefile or Command Line?

    What is the best way to build 50 projects (DLLs)?

    These projects have many inter-dependencies.

    I know how to build them in the Visual Studio WorkSpace, but I want to create a BATCH file so that I can run overnight builds.

    Visual Studio HELP says you can EITHER build from the Command Line OR export a MAKEFILE and use NMAKE.

    Which is the better method for my setup?

    Any sample batch files would be greatly appreciated.

    (P.S. An additional question if I may...My DOS is rusty - I cannot remember the line continuation character for splitting up large commands onto new lines. I have tried backslash, underscore, $_, etc, but I cannot get anything to work. Does anyone know the answer?)

  2. #2
    Join Date
    Mar 2001
    Posts
    2,529

    Re: Export Makefile or Command Line?

    Well I suggest that you use a batch file and including nmake with a make file.

    example batch file:

    Code:
    rem B2DLL.BAT:   BUILD 2 DLLS
    cd c:\projects\dll1\
    nmake dll1.mak /d
    cd c:\projects\dll2\
    nmake dll2.mak /d
    note you will need to select your targets accordingly.

    this method may take some tweaking because you may not want to build all the dlls all the time. You can use choice.exe (deprecated) or actually make a command line exe that asks a series of questions and builds only the targets you choose or selectively leaves out the targets you choose.

    Code:
    //rem B2DLL.BAT:   BUILD 2 DLLS
    cout >> "do you want to build dll1?" <<endl; 
    cin << cans;
    if (cans=='Y')
    {
      _chdir ("c:\projects\dll1\");
      system("nmake dll1.mak /d");
    }
    
    cout >> "do you want to build dll2?" <<endl; 
    cin << cans;
    if (cans=='Y')
    {
      _chdir ("c:\projects\dll2\");
      system("nmake dll2.mak /d");
    }
    does this give you any ideas?

    ahoodin

    PS if this helps rate me. It is what keeps me going.
    Last edited by ahoodin; December 7th, 2004 at 09:43 AM. Reason: wanted to add second bit of code.

  3. #3
    Join Date
    Jun 2003
    Posts
    53

    Re: Export Makefile or Command Line?

    ahoodin,

    Thanks for your prompt reply, I appreciate you taking the time.

    You suggest using the NMAKE solution, and I can see that I could easily go down that route.

    I suspect that NMAKE is the more common method used.

    However, I was wondering if you or anybody else has tried using the "Building a Project from the Command Line" method described in MSDN Help (http://msdn.microsoft.com/library/de...mmand_line.asp)? Is this a "new, improved" method, or is it just an alternative? I might as well use the "best" method since I am starting from scratch.

    So I still have 2 questions:-

    (1) NMAKE or Command Line ?

    Has anyone tried using the Command Line method for large projects?

    (2) DOS command line continuation character?

  4. #4
    Join Date
    Mar 2001
    Posts
    2,529

    Arrow Re: Export Makefile or Command Line?

    NMAKE.exe is executed from the command line.

    before you run it (each time) you will need to run VCVARS32.BAT to setup environment vars to compile MFC or Win32 projects. If you selected the option that you would like to install environment vars for command prompt from the MSVC installation program, you will not have to do this.

    Under the project menu in VC, there is a menu item called Export MakeFile.

    1. Export MakeFile for each project.
    2. Write BatchFile or scripted routine.
    3. Consider the alternative of including all projects in one workspace!

    Does that Help?

    ahoodin

    PS if this helps rate me. It is what keeps me going.
    Last edited by ahoodin; December 7th, 2004 at 11:29 AM. Reason: added in comment about vcvars

  5. #5
    Join Date
    Jun 2003
    Posts
    53

    Re: Export Makefile or Command Line?

    ahoodin,

    Sorry about this, but we are still talking a bit at cross-purposes here (or maybe my question is not sensible, that is perfectly possible).

    What I'm trying to understand is the DIFFERENCE between the method you are describing and the ALTERNATIVE method described in MSDN HELP (http://msdn.microsoft.com/library/de...mmand_line.asp).

    Here is the statement which suggests to me that there is an alternative method, which I would like to find out about :-

    --------------------------------------------------------------------------------------
    "You can build a Visual C++ project from the command line without first exporting a makefile (MAKEFILE, or filename.mak) and using the NMAKE utility.

    The basic command syntax is

    msdev FileName [/MAKE "ProjectName ConfigName | ALL"] [/REBUILD /CLEAN /NORECURSE /OUT LogFile /USEENV]"
    --------------------------------------------------------------------------------------

    So, has anyone tried this "without first exporting a makefile" method?

  6. #6
    Join Date
    Mar 2001
    Posts
    2,529

    Talking Re: Export Makefile or Command Line?

    You dont need a .mak file with that method.

    That can be scripted too.

    Code:
    msdev dll1.dsp /MAKE "dll1  UNICODE"
    It works out rather well actually having tried it.

    *You don't have to register environment variables either with this method.*
    Most likely this is the preferable method if you choose to never port your application
    to another OS for example to convert them to static libs/device driver for Linux/FreeBSD. If you do, then the make file is the better way to go.

    I notice that you have already run a thread on this matter. Apparently you weren't satisfied with the outcome of that thread?

    HTH,

    ahoodin
    Last edited by ahoodin; December 7th, 2004 at 01:29 PM. Reason: added in last comment

  7. #7
    Join Date
    Jun 2003
    Posts
    53

    Re: Export Makefile or Command Line?

    ahoodin,

    Thanks, that's exactly the advice I was looking for.

    About the other thread... yes, you have rumbled me.

    In my defence, I thought there was a distinct difference of emphasis in the questions. The old thread asked about build order for multiple projects in a single workspace, while this new thread is about the difference between the NMAKE method and the MSDEV method.

    I'm not sure I've even convinced myself with this flimsy argument, so I accept the slap on the wrist.

    P.S. One last attempt :-

    DOS command line continuation character? DOES ANYONE KNOW ?

  8. #8
    Join Date
    Mar 2001
    Posts
    2,529

    Re: Export Makefile or Command Line?

    Thanks, that's exactly the advice I was looking for.
    NP. DOS is off topic though. You can parse the DOS batch file together using a C Program and the System commands. Give me a break, MS-DOS line continuation character. Don't you have your DOS book from the eighties? I still have mine and it says nothing about a line continuation character. I also asked the most senior DOS weenie I know and he doesn't even know.

    About the other thread... yes, you have rumbled me.
    There is no rumbling involved.
    In my defence, I thought there was a distinct difference of emphasis in the questions.
    Quite defending yourself. No need. You are not being attacked.

    Big Rock by the Little Lake. Little Boulder by the Big Puddle.
    Tomato tomato. Still same thread.

    The old thread asked about build order for multiple projects in a single workspace, while this new thread is about the difference between the NMAKE method and the MSDEV method.
    You were trying to solve the same problem.

    I guess not everything that can be counted counts Martin c, such as giving
    you a helping hand. <RANT>Do some research and quit harping on other programmers
    to teach you DOS! I am being fair with this statement. This is a C++ board not
    a DOS board. That should be a seperate post on the TEK-TIPS fORUM IT board.
    </RANT>


    ahoodin
    Last edited by ahoodin; December 8th, 2004 at 08:13 AM.

  9. #9
    Join Date
    Jun 2003
    Posts
    53

    Re: Export Makefile or Command Line?

    OK, thanks for all your help, consider this thread closed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured