What is ppcc?
You might have noticed on some systems nmake runs ppcc
instead of running the compiler directly. ppcc is a
shell script which allows us to compile code using the nmake
preprocessor with compilers that don't provide a means to access
an external preprocessor. ppcc first calls nmake cpp
to generate a preprocessed .i file. The .i file is then
passed to the compiler for compilation. Since the source code is already
preprocessed we do not have to rely on the native preprocessor.
Why is ppcc used?
nmake has its own C preprocessor (cpp) which is used to faciliate
viewpathing. It treats the -I arguments a bit differently
than standard cpp implementations to guarantee correct include files are
picked up when viewpathing. (For more information see the
cpp FAQ page.)
There are three cases concerning nmake cpp and the compiler:
- A compiler will have some option to reference an external
cpp instead
of the native one. In this case the compiler is run directly with
the appropriate command line argument to pick up nmake cpp.
- The compiler does not have any way
to use an external preprocessor.
In this case ppcc is used. ppcc runs nmake cpp to do the
preprocessing, and then passes the preprocessed file
(a
.i file)
to the compiler. The compiler doesn't have to do any preprocessing since
it is already done.
- In some cases the native preprocessor can treat the
-I list the
same as nmake cpp. In these cases the native cpp will pick
up the correct include files, so nmake cpp is not used. This
is indicated by the native preprocessor accepting the -I-
argument.
Examples are the Gnu C compiler, EDG based C++ 4.x compilers,
HP aCC, and later release of
Sun Forte C++.
When is ppcc used?
When nmake is first run with a given compiler it "probes" the
compiler to learn the compiler's capibilities and what kind of arguments
are supported. At this time "probe" files are created, and from then on
these probe files are referenced by nmake rather than re-probing every time.
The make probe file (located in (nmake_root)/lib/probe/C/make/
indicates which of the above three cases is relevant for the compiler,
and determines if and how the nmake cpp is used. You can see the
make probe file by running: 'probe -l C make /path/to/cc'.
- If
CC.DIALECT contains -I- then use
the native cpp, it supports -I- (case number 3 above).
- If if both
CC.ALTPP.FLAGS and
CC.ALTPP.ENV are empty, and there is no -I- in
CC.DIALECT, then use ppcc (case number 2 above).
- Otherwise, either
CC.ALTPP.FLAGS or
CC.ALTPP.ENV
tells how the compiler can use an external cpp (case number 1 above).
Last Update: Wednesday,20-Dec-06 13:21:59 CST
|