Microsoft KB Archive/102326

From BetaArchive Wiki

Article ID: 102326

Article Last Modified on 10/23/2003



APPLIES TO

  • Microsoft Program Maintenance Utility 1.2
  • Microsoft Program Maintenance Utility 1.2
  • Microsoft Program Maintenance Utility 1.2
  • Microsoft Program Maintenance Utility 1.2
  • Microsoft Program Maintenance Utility 1.3
  • Microsoft Program Maintenance Utility 1.4
  • Microsoft Program Maintenance Utility 1.4
  • Microsoft Program Maintenance Utility 1.4



This article was previously published under Q102326




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 query words: kbinf 1.20 1.30 1.40 1.50 .bsc .sbr

Keywords: KB102326