18.2 Building a Project Outside of MPLAB® X IDE

MPLAB® X IDE uses GNU Make as its build tool. The installation of MPLAB X IDE provides this program. The locations are:

  • Windows® 64-Bit OS – C:\Program Files\Microchip\MPLABX\vx.xx\gnuBins\GnuWin32\bin
  • Linux® 32/64 OS – /opt/microchip/mplabx/vx.xx/mplab_ide/bin
  • Mac® OS X® – /Applications/microchip/mplabx/vx.xx/mplab_ide.app/Contents/Resources/mplab_ide/bin

where vx.xx represents the version.

MPLAB X IDE automatically adds the directory containing the make to its own path variable. If you want to build outside of the IDE, you must add the directory to the PATH environmental variable.

The Makefile in the MPLAB X IDE project directory can be called directly to build the default configuration:

Command – Type on a single line Description
$ make clean To remove all intermediate objects and final images
$ make To create the production image (HEX file)
$ make TYPE_IMAGE=DEBUG_RUN To create the debug image (ELF file)

If the project has more than one configuration, then:

Command – Type on a single line Description
$ make -f MakefileCONF=Configuration clean To remove all intermediate objects and final images for configuration Configuration
$ make -f MakefileCONF=Configuration To create the production image (HEX file) for configuration Configuration
$ make -f MakefileCONF=Configuration TYPE_IMAGE=DEBUG_RUN To create the debug image (ELF file) for configuration Configuration

The names of the images by default are (with respect to the MPLAB X IDE directory):

dist/$CONF_NAME/production/$PROJ_NAME.production.hex
dist/$CONF_NAME/debug/$PROJ_NAME.debug.elf