Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual

Product codes
SW006021-1
Page of 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053B-page 78
 2012 Microchip Technology Inc.
FIGURE 4-3:
THE TRADITIONAL COMPILATION SEQUENCE
When compiling files of mixed types, this can still be achieved with just one invocation 
of the compiler driver. As discussed in Section 4.3 “The Compilation Sequence”, the 
driver will pass each input file to the appropriate compiler application.
For example, the files, main.c, io.c, mdef.as and c_sb.lpp are to be compiled. 
To perform this in a single step, the following command line could be used.
xc8 --chip=16F877A  main.c  io.c  mdef.as  c_sb.lpp
As shown in Figure 4-1 and Figure 4-2, the two C files (main.c and io.c) will be com-
piled to intermediate p-code files; these, along with the p-code library file (c_sb.lpp) 
will be passed to the code generator. The output of the code generator, as well as the 
assembly source file (mdef.as), will be passed to the assembler.
The driver will recompile all source files, regardless of whether they have changed 
since the last build. IDEs (such as MPLAB
®
 IDE) and make utilities must be employed 
to achieve incremental builds. See also Section 4.3.3 “Multi-Step Compilation”.
Unless otherwise specified, a HEX file and Microchip COFF file are produced as the 
final output. All intermediate files remain after compilation has completed, but most 
other temporary files are deleted, unless you use the --NODEL option (see 
Section 4.8.40 “--NODEL: Do Not Remove Temporary Files”) which preserves all 
generated files except the run-time start-up file. Note that some generated files may be 
in a different directory to your project source files. See Section 4.8.43 “--OUTDIR: 
Specify a Directory For Output Files”
 anSection 4.8.41 “--OBJDIR: Specify a 
Directory For Intermediate Files”
 whi
ch can both control the destination for some 
output files.
C file
C file
library 
files
preprocess 
&
parse
.obj
files
preprocess 
&
parse
.obj
files
link
assemble
First stage of compilation
Second stage
of compilation
Intermediate files
code
generation
code
generation
assemble