Type in a command to be executed at the very beginning or at the very
end of the build process. These commands are inserted into the
nbproject/Makefile-$CONF.mk
file and allow you to customize the
build process. If you need to refer to some of the project-related items (like the image
name) in the script or program you are calling, use the supplied macros.
You can type the macros yourself or click Insert Macro to copy
the macro name into the current position in the edit box. Commands are run in the make
process with the current directory being set to the MPLAB X IDE project directory. The
project directory is defined as the project that contains the nbproject
folder
Name* | Function |
---|---|
Device | device for the currently-selected project configuration |
ProjectDir | location of the project files on the PC |
ConfName | name of the currently-selected project configuration |
ImagePath | path to the build image |
ImageDir | directory containing the build image |
ImageName | name of the build image |
IsDebug | “true” for Debug mode; “false” otherwise |
* Additional macros may be available, depending on which compiler is used. |
Example: Execute a Process Only During Debug
On the window shown below, click the “IsDebug” macro to select it, then click Insert Macro to insert it into a script.
Check the value of $1
(Linux or Mac OS) or
%1
(Windows OS) in the script being run.
Bash Code Example
#!/bin/bash
echo is $1
if [ "$1" == "true" ]; then
echo We are in debug
else
echo We are in production
fi
Batch Code Example
@echo off
if "%1" == "true" goto debug
:production
@echo We are in production
goto end
:debug
@echo We are in debug
:end