6.3.6.3 Example of a Makefile Project

This example shows how to create a user makefile project in MPLAB X IDE that will run either a batch file or make on user code that was created outside of the IDE. The user code consists of a single file t.c. The simple code contained in this file is listed below.

Example: t.c Code

#include <xc.h>
int main(void) {
while(1) {
}
return 0;
}

For production the code is linked into t_production.hex and for debug the code is linked into t_debug.elf.

For this example, t.c, the batch file makeme.bat and the user makefile Makefile are assumed to be in the (Windows OS) directory:

C:\Users\User\MPLABXProjects\makestuff\myOwnCodeWithItsOwnMakefile

Substitute your user name for User to recreate the example on your PC.