18.3.1 Makefile Creation
Makefiles are created by the MPLAB® X IDE as needed when compiler options change or when files are added or removed. In addition, the Makefiles can be created outside of the IDE using the utility prjMakefilesGenerator. This utility is a batch file (for Windows® OS) or a shell script (for Linux® OS and Mac® OS X®). This utility allows you to recreate the Makefiles using the same information the IDE uses which is stored in the $PROJECT_DIR/nbproject/configurations.xml file for a given MPLAB X IDE project. The first topic explains how to create the Makefiles outside of the IDE. Then the rest of the topics describe how to modify the behavior of the Makefiles without having to regenerate them for further customization. The latter applies to the Makefiles created by the IDE or by prjMakefilesGenerator (which should be identical).
The main Makefile file is called $PROJECT_DIR/Makefile. It is
created when the IDE creates the project and can be modified by the user. There are some
targets such as .build-pre
, that can be implemented by the user. This
file is never regenerated. The rest of the Makefiles are all regenerated by the IDE or
prjMakefilesGenerator. They are of the format:
$PROJECT_DIR/nbproject/Makefile*.mk
We recommend that you do not commit these nbproject/Makefile* files into revision control. Instead use the IDE or prjMakefilesGenerator to reproduce them as needed. For more information, see Saving Project Files.