Generating Browser Information with an External Makefile

Last reviewed: October 10, 1997
Article ID: Q102326
1.01 1.11 1.12 1.13 1.20 1.30 1.40 | 1.40 1.50
MS-DOS                             | WINDOWS NT
kbtool

The information in this article applies to:

  • Microsoft NMAKE for MS-DOS, versions 1.01, 1.11, 1.12, 1.13, 1.2, 1.3, 1.36, and 1.4
  • Microsoft NMAKE for Windows NT, versions 1.4 and 1.5

SUMMARY

You can modify an external project makefile to generate source browser database information. However, to use the browser database, you must have either Programmer's WorkBench, Visual C++ for Windows or Visual C++ 32-bit edition. You must also have the BSCMAKE utility installed in one of the directories listed in your PATH environment variable.

MORE INFORMATION

The text below assumes that you are creating a new makefile for a specified project. The process of porting a .MAK file generated by Programmer's WorkBench or by Visual Workbench involves other considerations that this article does not discuss.

Source browser database information can be very helpful during the development process as well as in the debugging process. Typically, an external makefile does not call the BSCMAKE utility to generate a browser database. The five steps required to add the dependencies to generate browser information are quite simple and are as follows:

  1. Add the "/FR" compiler option switch to each C/C++ compiler command line or to the variable that lists the compiler option switches. For example:

          CFLAGS = /Od /Zi /FR
    

    This variable is typically used to specify the command line for each object module as follows:

          CL /c $(CFLAGS) $(PROJ).C
    

  2. Generate a .SBR file for each source file by adding a <name>.SBR target for each source file in the project, as follows:

          source1.sbr: source1.c
    
             cl /c $(CFLAGS) source.c
    
       If you delete the .SBR files but the project is otherwise up-to-
       date, BSCMAKE may fail to update the .SBR files.
    
    

  3. Add a substitution variable that contains the list of .SBR files that compiler generates in response to the specified /FR compiler option switch:

          SBRS = source1.sbr source2.sbr source3.sbr     # and so on
    
    

  4. Create an "ALL" pseudotarget and include the .BSC dependency using the project name as the base filename. Most makefiles define a variable to hold the project name for this purpose. For example,

          PROJ = proj1
          ALL: $(PROJ).exe $(PROJ).bsc
    

  5. Finally, create the dependency that calls BSCMAKE to build the browser database file as follows:

          $(PROJ).bsc : $(SBRS)
    
             BSCMAKE /o$@ $(SBRS)
    
    
For more information about BSCMAKE or NMAKE options or commands, please refer to the following resources provided with Visual C++ version 1.0 for Windows: BSCMAKE.WRI or NMAKE.WRI installed in the Visual C++ help directory (by default, C:\MSVC\HELP). You can also view these files through the "Tech Notes" icon in the Visual C++ program group in Microsoft Windows Program Manager.

For more information about the BSCMAKE utility provided with Visual C++ 32-bit edition, please refer to the Build Tools online help listed on the development environment Help menu. For more information about NMAKE, please refer to the NMAKE.WRI file in the HELP subdirectory.

Sample External makefile for Visual C++ for Windows

PROJ=hello SBRS=hello.sbr CFLAGS = /Od /Zi /FR

all: $(PROJ).exe $(PROJ).bsc

hello.sbr: hello.c

   cl /c $(CFLAGS) hello.c

hello.obj: hello.c
   cl /c $(CFLAGS) hello.c

hello.exe: hello.obj
   link /co hello.obj;

hello.bsc: $(SBRS)
   bscmake /o$@ $(SBRS)


Sample External makefile for Visual C++ 32-bit Edition

PROJ=hello SBRS=hello.sbr CFLAGS = /Od /Zi /FR

all: $(PROJ).exe $(PROJ).bsc

hello.sbr: hello.c

   cl /c $(CFLAGS) hello.c

hello.obj: hello.c
   cl /c $(CFLAGS) hello.c

hello.exe: hello.obj
   link /debug /debugtype:both hello.obj

hello.bsc: $(SBRS)
   bscmake /o$@ $(SBRS)


Additional reference words: kbinf kbinf 1.20 1.30 1.40 1.50 .bsc .sbr
KBCategory: kbtool
KBSubcategory: NmakeIss


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 10, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.