Executables

MakeMe creates executables by specifying the required source files and libraries in an exe target. For example:

bingo: {
    type: 'exe',
    sources: [ 'bingo.c' ],
    depends: [ 'libgame'],
},

This will compile and link the bingo.c source and save an executable called bingo or bingo.exe for windows in the current directory.

You can modify the output filename by defining a path property. For example:

bingo: {
    type: 'exe',
    path: 'output/bingo',
    sources: [ 'bingo.c' ],
    depends: [ 'libgame'],
},

Without a path property, MakeMe computes one from the name of the property target.

Dependencies

Dependent libraries are specified via the depends property. This property takes a list of other targets that must be built before the current target can complete. Note: that these are the target names (target.name property) and not the library name. To specify external libraries that are not built with MakeMe, use the libraries property collection.

rocket: {
    type: 'exe',
    sources: [ '*.c' ],
    headers: [ '*.h' ],
    depends: [ 'fuel' ],
    libraries: [ 'pam' ],
},

Configurable Components

Products are sometimes configured with components that provide libraries to augment the product. For example: the PHP component adds the libphp library. To cause a target to be built only if the component is available, use the ifdef property. For example:

rocket: {
    type: 'exe',
    sources: [ '*.c' ],
    headers: [ '*.h' ],
    depends: [ 'fuel', 'booster' ],
    ifdef: [ 'booster' ],

Note that ifdef does not import add any component defined libraries, library paths, include paths or compiler definitions to this target. To do that, use the depends property or the uses property for optional components.

To do a static link of the executable, set the static property to true. This will link the executable directly with all the required objects. MakeMe will expand the list of dependant libraries and explicitly link with all their constituent objects.

bingo: {
    type: 'exe',
    sources: [ 'bingo.c' ],
    depends: [ 'libgame' ],
    static: true,
},

To learn more, read about Running Scripts.

© Embedthis Software. All rights reserved.