Debugging a Build

MakeMe provides several switches that help you to see what MakeMe is doing and why. While MakeMe will automatically calculate many of the complex dependencies in a project, you may find situations when a target is not being build when you expected it to. Conversely a target may be built when you did not expect it to be. Why?

Why Targets are Building

With Make and other build tools, it is often difficult to determine why a target is or is not being built. MakeMe provides a --why command line switch to diagnose problematic build sequences. This switch displays the reason why each target was or was not built. For example:

$ me --why libmpr
    [Target] macosx-x64-release/inc/mpr.h is up to date
    [Target] macosx-x64-release/inc/me.h is up to date
    [Target] macosx-x64-release/inc/bitos.h is up to date
   [Rebuild] macosx-x64-release/obj/mprLib.o because input src/deps/mpr/mprLib.c has been modified.
   [Compile] src/deps/mpr/mprLib.c
   [Rebuild] macosx-x64-release/bin/libmpr.dylib because input \
             macosx-x64-release/obj/mprLib.o has been modified.
      [Link] libmpr

Showing Executed Commands

MakeMe shows as little output as possible while building so you can easily see build errors such as compiler warnings and errors. With other build systems, these are often lost in a swamp of trace.

However, sometimes youneed to see the exact command that MakeMe is issuing to build a target. To see the actual commands MakeMe is executing to compile sources and link libraries, run "me" with 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 \
      [Link] libmprssl

Dumping the Project

In a complex project containing many MakeMe files, it can be helpful to see the entire aggregated MakeMe configuration in one file. Use the --dump switch to save a copy of the entire configuration. In the dump, build defaults are fully expanded to each target contains the expanded configuration that will be used to build the target. The dump will be saved to an OS-ARCH-PROFILE.dmp.

$ me --dump

Other Useful Bits

To build totally quietly, use the --quiet switch. To continue building despite build errors, use the --continue switch.

To learn more, read about Using Generated Makefiles.

© Embedthis Software. All rights reserved.