When compiling with both the -O and -g flags using HP's cc compiler you may see an error similar to the following:
+ cc -O -g -t p,/tools/nmake/hppa10/lu3.3/lib/cpp -I-D/tools/nmake/hppa1 0/lu3.3/lib/probe/C/pp/B3A01E21.bincc -I- -D_TRACE_ -c hello.c cc: error 2151: Can't open "/tmp/docBAAa27184". make: *** exit code 1 making hello.o
The HP-UX cc compiler has some proprietary, nonstandard support for using both the -O and -g flags at the same time. As part of this support the compiler expects a temporary file to be created by the preprocessor. Since this is not a standard operation the nmake preprocessor does not know about it and does not create the expected temporary file, which causes this error from the compiler.
Since nmake cpp cannot support this feature we recommend using only one of the -O or -g flags or neither flag, but not both at the same time. This will eliminate the error.
The default Makerules initializes CCFLAGS=-O. If you set CCFLAGS+=-g you are will have this problem since += will add -g to the existing CCFLAGS. To use the -g flag set CCFLAGS=-g (not +=) to replace the default -O with your desired flag.
It is possible to use this feature of the HP compiler with nmake for cases where both flags are really needed, for example to debug problems with the optimizer. There are two basic options.
.PROBEINIT : .myPROBE .myPROBE : .AFTER .MAKE CC.ALTPP.FLAGS = CC.DIALECT := $(CC.DIALECT:N!=DOTI) CCFLAGS = -O -g hello :: hello.c $ nmake + ppcc /tools/nmake/hppa10/lu3.2/lib/cpp cc -O -g -I-D/tools/nmake/hppa1 0/lu3.2/lib/probe/C/pp/B3A01E21.bincc -I- -D_TRACE_ -c hello.c + ppcc /tools/nmake/hppa10/lu3.2/lib/cpp cc -O -g -o hello hello.oRather than resetting these variables in the makefile you can also use the localprobe feature to create a local probe file which can be edited as necessary without impacting other users.