Using MakeMe

MakeMe is a modern replacement for the venerable make and not so popular autoconf. MakeMe manages the building of programs and products by simply and efficiently determining which pieces have been updated and thus which components need to be rebuilt. It easily handles the direct compilation and generation of projects and Makefiles.

Simple MakeMe File

A MakeMe file is written in Javascript, though with a .me, and contains a set of build instructions expressed as a Javascript object literal. The primary MakeMe file is called start.me. For example:

MakeMe.load({
    targets: {
        /* Build the rocket executable */
        rocket: {
            type: 'exe',
            headers: [ '*.h', 'slots/*.h' ],
            sources: [
                '*.c',
                'core/src/*.c',
                'vm/*.c',
            ],
            depends: [ 'libhttp' ],
        },
    }, 
})

MakeMe is run via the "me" command. So to build the rocket, enter:

me rocket

Building Targets

MakeMe is invoked with zero or more goals on the command line to build. If invoked with zero goals, MakeMe will build all the out-of-date targets. If a one or more targets are specified, only those targets will be brought up to date.

To build several named targets:

me libengine librocket space-program

To do an all-targets (default) build, type:

me

This is equivalent to:

me build

An all-targets build will make all file, executable, library, and script targets of type build.

The all and compile targets are aliases for the build target for those wedded to make style commands.

Rebuild

To rebuild everything including all built targets and intermediaries, run:

me rebuild

Cleaning

To remove all built targets and intermediaries, run:

me clean

This will clean all executables, libraries, objects and will run all script targets with a type of "clean".

Clobber

To remove all generated files and directories, run:

me clobber

This will first do a me clean and then will remove the platform output directories.

Version

To show the product version number, run:

$ me version
1.2.0

MakeMe Projects

When MakeMe is invoked via the "me" command, it searches for a start.me file in the current directory. If one is not found, it searches up the parent directory chain for one. MakeMe then loads the nearest start.me file and commences processing its build instructions. This means you can typically invoke "me" from anywhere in a project source tree. A start.me file may be complete in itself, or it may in turn load other MakeMe files.

Use cases for MakeMe

There are two kinds of MakeMe projects

Stand-Alone Use

A stand-alone start.me file may be used to express simple build targets that do not requiring any prior configuration. The start.me file contains targets that specify the recipes to build those targets. The full capabilities of MakeMe are available and you can compile sources, build libraries and executables or run scripts.

Configured Projects

Some projects require a configuration phase prior to building with MakeMe. MakeMe configuration of a project discovers the available tools and configurable components, and customizes the project to best run on the local system.

For configured products, MakeMe is first invoked with a configure target. MakeMe then searches for a main.me file that describes the project, before it discovers the local tools and components. Finally, it generates a start.me and a platform.me file that describes the project build and system.

Seeing Errors

By default, MakeMe is fairly terse. It does not spew endless command lines that scroll off the screen. With traditional Make builds, it is too easy to miss critical compiler and linker warnings that are lost in pages of trace. In contrast, MakeMe displays the essential minimum -- only what it is doing to which target. For example:

$ me
   [Compile] src/deps/mpr/mprLib.c
      [Link] libmpr
   [Compile] src/deps/est/estLib.c
      [Link] libest
   [Compile] src/deps/mpr/mprSsl.c
      [Link] libmprssl

Here is an example of what a compiler warning looks like. Much easier to scan:

$ me
   [Compile] src/module.c
   [Compile] src/mpr.c
me.es: ERROR: Building target mpr/macosx-x64-debug/obj/mpr.o
Command failure: src/mpr.c:706:25: error: too many arguments to function call, 
    scaselessmatch(str, "high", "low");
    ~~~~~~~~~~~~~~~~~~~~~~      ^~~~
Command: /usr/bin/clang -c -o macosx-x64-debug/obj/mpr.o -arch x86_64 -Wall 
    -Wno-deprecated-declarations -g -Wno-unused-result -Wshorten-64-to-32 
    -DME_DEBUG -Imacosx-x64-debug/inc src/mpr.c

When there is a compilation error, MakeMe displays the full command that was used for the compile.

Tracing Commands

Sometimes you need to see the all the exact commands that MakeMe is issuing to build targets. To see these, run me the --show switch (this can be abbreviated to -s).

$ me -s
   [Compile] src/deps/mpr/mprSsl.c
       [Run] /usr/bin/clang -c -o macosx-x64-release/obj/mprSsl.o -arch x86_64 \
             -Wall -Wno-deprecated-declarations -O3 -Wno-unused-result \
             -Wshorten-64-to-32 -Imacosx-x64-release/inc \
             src/deps/mpr/mprSsl.c
      [Link] libmprssl

To learn more, read how to Configure Projects with MakeMe.

© Embedthis Software. All rights reserved.