MakeMe Events
During processing, MakeMe will fire events that may trigger scripts to run. There are two groups of events:
- Global Events
- Target Events
- Pack Events
The global events are triggered for general MakeMe processing and do not apply to a specific target. Target events apply to the current target being built. The current target is defined in the me.target property or the global TARGET property.
Global Events
Name | Description |
---|---|
loaded | Fired after all the required MakeMe files are loaded. |
postconfig | Fired during configuration just prior to creating the platform MakeMe file. |
preheader | Fired during configuration after creating the platform MakeMe file and just prior to creating the me.h file. |
pregen | Fired during project generation after creating the output project file but before emitting any content to the project. |
gencustom | Fired during project generation after emitting top level definitions but before emitting the targets. This event is the opportunity to write custom variables and targets to the project. |
Target Events
Here are the target events in order of firing
Name | Description |
---|---|
postblend | Fired after blending defaults into a target. |
preresolve | Fired before resolving dependencies for a target |
postresolve | Fired after resolving dependencies for a target |
presource | Fired before expanding source wildcards and creating object targets |
postsource | Fired after expanding source wildcards and creating object targets |
precompile | Fired before compiling a source file used by a target |
postcompile | Fired after compiling a source file used by a target |
prebuild | Fired before building a target |
build | Fired to build the target |
postbuild | Fired after building a target |
Pack Events
Here are the pack events in order of firing.
Name | Description |
---|---|
without | Fired when configuring and a pack is explicitly deselected via --without. |
config | Fired when configuring a pack. |
generate | Fired when generating during pack discovery. |
Defining Scripts
Scripts can be defined to run when the required event is triggered.
This can also be abbreviated by just supplying a string as script value. Be sure to use the + event aggregator to add to existing scripts for that event.
rocket: { type: 'exe', sources: [ '*.c' ], prebuild: "print('before building')", postbuild: "print('after building')", },
These scripts are actually translated into a lower-level form when the MakeMe file is loaded. Scripts are translated into the scripts collection using a property name of the desired event.
rocket: { scripts: { prebuild: [{ script: "print('before building')", home: '.', interpreter: 'ejs', }], }, goals: ['rocket'], },
For more details on how to set the home directory for the script or to specify a different script interpreter, see Scripts in the MakeMe User Guide.