18.3.2 prjMakefilesGenerator

The prjMakefilesGenerator utility is found at:

  • Windows® OS: $inst_mplabx\mplab_platform\bin\prjMakefilesGenerator.bat
  • Linux® OS: $inst_mplabx/mplab_platform/bin/prjMakefilesGenerator.sh
  • macOS®: $inst_mplabx/mplab_platform/bin/prjMakefilesGenerator.sh

The utility regenerates the nbproject/Makefile* files. If you run with the -help argument, you will see:

prjMakefilesGenerator [-help] [-v] [-f] [-mplabx-userdir=<path>] [-create] [-delete] [-setoptions=@<argfile>] [project_path[@config_name]*]+
        <project_path>             - path to the MPLAB-X project in the file system
        [config_name]              - (optional) name of a build configuration to generate the makefile for.
                                     If missing, the makefiles are generated for all the build configurations.

        -help                      - displays this help screen.
        -v                         - verbose processing.
        -create=@argfile           - creates the project specified by <project_path> after looking at the key=value argument file
        -compilers=<path>;<path>   - ";" separated list of user specified compiler install directories. When used with -create option, first path will be considered only.
        -setoptions=@argfile       - set project options in a key=value pair file
        -setitems                  - overwrite project items. Works with -copy, -relative, -itemtype=, -files if non default settings are needed. Defaults to overwriting source and header files, storing new ones with relative paths without copying them to project base folder.
        -copy                      - specify that provided file paths should be copied to the project base folder. Defaults to false if not specified.
        -pathmode=                 - specify that provided file paths should be treated as reative or absolute paths. Defaults to automatic detection if not specified.
        -itemtype=                 - specify the project item type: sources or headers. Defaults to sources and headers if not specified.
        -files="<path>"          - provide a file or folder path to consider when overwriting project items.
        -files=@"argfile"        - provide and argument file with one file or folder path per line.
        -mplabx-userdir=<path>     - the MPLAB-X user directory (useful if you run MPLAB-X with --userdir).

        Makefile generation example: prjMakefilesGenerator /home/usr/prj1@default@custom /home/usr/prj2 /home/usr/prj3@xc16
        The tool will generate the makefiles for:
          1.    The configurations named 'default' and 'custom' of the project named 'prj1'
          2.    All the configurations of the project named 'prj2' (all because none in particular is specified)
          3.    The configuration named 'xc16' of the project named 'prj3'

To run the utility, pass as an argument the MPLAB® X IDE project directories where you want to regenerate the Makefiles. You can also specify which configurations to regenerate. If no configurations are passed (no @confName), then all Makefiles for all configurations will be recreated.

We recommend that you pass -mplabx-userdir=<path> as a parameter. The <path> value is the value shown in the IDE in the Help>About dialog (see figure). This will ensure that prjMakefilesGenerator will have access to the same list of compilers as the IDE.

Figure 18-2. User Directory Path