Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual
Product codes
SW006021-1
XC8 Command-line Driver
2012 Microchip Technology Inc.
DS52053B-page 79
4.3.3
Multi-Step Compilation
Make utilities and IDEs, such as MPLAB IDE, allow for an incremental build of projects
that contain multiple source files. When building a project, they take note of which
source files have changed since the last build and use this information to speed up
compilation.
that contain multiple source files. When building a project, they take note of which
source files have changed since the last build and use this information to speed up
compilation.
For example, if compiling two source files, but only one has changed since the last
build, the intermediate file corresponding to the unchanged source file need not be
regenerated.
build, the intermediate file corresponding to the unchanged source file need not be
regenerated.
MPLAB IDE is aware of the different compilation sequence employed by xc8 and takes
care of this for you. From MPLAB IDE you can select an incremental build (Build Project
icon), or fully rebuild a project (Clean and Build Project icon).
care of this for you. From MPLAB IDE you can select an incremental build (Build Project
icon), or fully rebuild a project (Clean and Build Project icon).
If the compiler is being invoked using a make utility, the make file will need to be con-
figured to recognized the different intermediate file format and the options used to gen-
erate the intermediate files. Make utilities typically call the compiler multiple times: once
for each source file to generate an intermediate file, and once to perform the second
stage compilation.
figured to recognized the different intermediate file format and the options used to gen-
erate the intermediate files. Make utilities typically call the compiler multiple times: once
for each source file to generate an intermediate file, and once to perform the second
stage compilation.
You may also wish to generate intermediate files to construct your own library files.
However, xc8 is capable of constructing libraries in a single step, so this is typically not
necessary. See Section 4.8.44 “--OUTPUT= type: Specify Output File Type” for
more information on library creation.
However, xc8 is capable of constructing libraries in a single step, so this is typically not
necessary. See Section 4.8.44 “--OUTPUT= type: Specify Output File Type” for
more information on library creation.
The option --PASS1 (Section 4.8.45 “--PASS1: Compile to P-code”) is used to tell
the compiler that compilation should stop after the parser has executed. This will leave
the p-code intermediate file behind on successful completion.
the compiler that compilation should stop after the parser has executed. This will leave
the p-code intermediate file behind on successful completion.
For example, the files main.c and io.c are to be compiled using a make utility. The
command lines that the make utility should use to compile these files might be
something like:
command lines that the make utility should use to compile these files might be
something like:
xc8 --chip=16F877A --pass1 main.c
xc8 --chip=16F877A --pass1 io.c
xc8 --chip=16F877A main.p1 io.p1
If is important to note that the code generator needs to compile all p-code or p-code
library files associated with the project in the one step. When using the --PASS1 option
the code generator is not being invoked, so the above command lines do not violate
this requirement.
library files associated with the project in the one step. When using the --PASS1 option
the code generator is not being invoked, so the above command lines do not violate
this requirement.
Using object files as the intermediate file format with MPLAB XC8 C Compiler will
defeat many features the compiler uses to optimize code. Always use p-code files as
the intermediate file format if you are using a make system to build projects.
defeat many features the compiler uses to optimize code. Always use p-code files as
the intermediate file format if you are using a make system to build projects.