4.1.1.1 Long Command Lines

The xc8-cc driver can be passed a command-line file containing driver options and arguments to circumvent any operating-system-imposed limitation on command line length.

A command file is specified by the @ symbol, which should be immediately followed (i.e., no intermediate space character) by the name of the file containing the arguments. This same system of argument passing can be used by most of the internal applications called by the compiler driver.

Inside the file, each argument must be separated by one or more spaces and can extend over several lines when using a backslash-return sequence. The file can contain blank lines, which will be ignored.

The following is the content of a command file, xyz.xc8 for example, that was constructed in a text editor and that contains the options and the file names required to compile a project.

-mcpu=16F877A -Wl,-Map=proj.map -Wa,-a \

-O2 main.c isr.c

After this file is saved, the compiler can be invoked with the following command:

xc8-cc @xyz.xc8

Command files can be used as a simple alternative to a make file and utility, and can conveniently store compiler options and source file names. The MPLAB X IDE also allows such files to be used. The file name is specified in the XC8 Linker > Additional options > Use response file to link field of the Project Properties.