Using HP Code Advisor in Application Builds: [HP Code Advisor] White Paper

5
You can build your application using cadvise by overriding the cadvise corresponding variables from
the command line, as shown below:
$ CADVISE=”cadvise” CADVISE_OPTS="-pdb YourApplication.pdb" make
cadvise -pdb YourApplication.pdb aCC -c -Ae -O -I. source1.c
source2.c
source1.c:
source2.c:
cadvise -pdb YourApplication.pdb aCC -o YourApplication
source1.o source2.o
$
Alternatively, you can choose not make any changes to the sample makefile (figure 1) and instead
override the CC and LD variables on the command line as follows:
$ CC=”cadvise -pdb YourApplication.pdb aCC" LD=$CC make
cadvise -pdb YourApplication.pdb aCC -c -Ae -O -I. source1.c
source2.c
source1.c:
source2.c:
cadvise -pdb YourApplication.pdb aCC -o YourApplication
source1.o source2.o
If you are using a version of make, which supports the use of conditionals in makefiles, you can
modify your makefile to create a switch for cadvise usage. This option can be toggled in the
command line to build the application with or without cadvise. Figure 3 shows the makefile using a
conditional.