Running Configure

If your project has been designed for configuring, it will have a main.me file that describes the project, what it requires to build, and which configurable components it can utilize.

For configurable products, developers typically provide a configure script to mimic the familiar autoconf configure pattern. This script minimally invokes MakeMe using the configure target:

# configure script
me configure "$@"

MakeMe can also be invoked directly to configure your project:

Note that MakeMe switches can be prefixed with either a double "--" or a single "-" dashes.

Configuration Outputs

When configuring, MakeMe will determine the capabilities of your system and create a several files and directories. These include:

MakeMe will use these files and output directory when performing subsequent builds and compiling sources.

The start.me file is the primary MakeMe file that is invoked when MakeMe is run. For configured projects, this simply loads the platform.me file which in turn loads the main.me file.

Customizing the Build

When running "me configure", you can select or deselect configurable components and enable or disable various features.

To see a list of supported components, run configure --help.

$ configure --help
Usage: me [options] [targets|actions] ...
...
Components (--with NAME, --without NAME):
    est                 # Embedded Security Transport (SSL)
    openssl             # OpenSSL (SSL)
    sqlite              # SQLite Database
    zip                 # Zip Compression Tool

If a discoverable component is installed in a non-standard location, you may need to inform MakeMe of its whereabouts. Do this via:

configure --with NAME=/path/to/component

Some components that are neither required nor discoverable, may still supported by your project. These components but must be explicitly requested via the -with switch for them to be configured. For example, Appweb supports Ejscript but it is not enabled by default. To build with Ejscript, you request it like this:

configure -with ejs

You can explicitly disable a component that has been discovered on your system, via the -without switch

configure -without ssl

Features

Most projects have configurable options that can be tailored via the configure --set switch. This takes the form --set KEY=VALUE. For example:

configure --set mpr.tracing=false

To enable a feature, set it to true or 1. To disable, set to false or 0. The configure --help command will list the features that can be selected.

Installation Prefixes

MakeMe projects typically define a prefixes collection that define where the various pieces of the application will be installed. To override where the project will be installed, use the --prefix configure option. For example:

configure --prefix base=/opt

This will cause the project to be installed under /opt instead of the usual location (/usr/local).

To display the current installation prefixes, type:

$ me --get prefixes
{
    root: "/",
    base: "/usr/local",
    data: "/",
    state: "/var",
    app: "/usr/local/lib/makeme",
    vapp: "/usr/local/lib/makeme/0.5.4",
    bin: "/usr/local/bin",
    inc: "/usr/local/include",
    lib: "/usr/local/lib",
    man: "/usr/local/share/man",
    sbin: "/usr/local/sbin",
    etc: "/etc/makeme",
    web: "/var/www/makeme-default",
    log: "/var/log/makeme",
    spool: "/var/spool/makeme",
    cache: "/var/spool/makeme/cache",
}

Depending on the project and target system, the installation prefixes may vary.

For those familiar with autoconf, the major autoconf prefix switches are supported by MakeMe.

Outside Source Tree Builds

MakeMe supports building from read-only source trees. To do this, use me -config path when configuring. Run this from a writable directory and reference the read-only source tree via the -config switch. MakeMe will create the start.me, platform output directory and the platform.me file. Thereafter run me from the writable directory for all operations.

Configuring for Cross-Compiling

To build a product for platform different to that of the local system is called cross compiling. Sometimes this compiling is just for a different instruction set (say x64 instead of x86). Other times it is for a completely different operating system and/or CPU architecture.

MakeMe supports cross compiling via the configure --platform OS-ARCH-PROFILE option. This adds a platform to the list of platforms to be made when building. Multiple platforms may be specified and the local platform alias may be used for the local development platform.

The ARCH component may be a specific CPU to tune for rather than an CPU family. For example:

me --platform vxworks-arm7tdmi-debug -configure . me --platform vxworks-x86sim

This will create a vxworks-arm/platform.me configuration file and a start.me that references it. The platform switch does not need to be restated after configuration and will be ignored.

Note the configuration options apply to the preceding platform. If no preceding platform, the option applies to the local platform. For example:

configure -with ejscript -platform linux-arm-debug -without ejscript

This will build with the Ejscript package for the local development system, and without Ejscript for the target.

Some products require local building to make the tools that are required to build for a target platform. This necessitates two build passes: one for the local system and one for the target. These products add a platforms: ['local'] property to their settings collection in the main.me file. This automatically adds the local platform to the platforms list and is the same as adding --platform local on the command line when configuring.

Building 32-bit Applications

If your local system can execute binaries for the specified platform, MakeMe will suppress adding an extra pass for the local system. For example: if you want to build a Windows 32-bit application on a Windows 64-bit system, you can specify --platform windows-x86. MakeMe will realize that your system can also execute 32-bit binaries and will suppress also building for 64-bit.

Environment Variables

When compiling, you may need to inform configure about your cross-compilation tool chain and where it is located. MakeMe will do its best to discover the installed SDKs and cross tool chain and will look in well known directories to locate the compiler, linker, libraries and other required tools. If me cannot locate the tool chain, you can supply the tool chain details via environment variables.

MakeMe has default command paths and command flags for the compiler, linker and other tools. These can be overridden by providing environment variables containing alternate flags to use.

Use the variables AR, CC and LD to specify the path to the archiver, compiler and linker tools. Use CFLAGS to provide compiler flags, DFLAGS for pre-processor definitions, IFLAGS for compiler include paths and LDFLAGS for linker flags.

If these flags are provided to MakeMe when building, they apply to that run only. If the flags are provide when configuring, they are saved in the generated platform build file and apply to all subsequent runs. For example:

CC=/path/to/compiler CFLAGS=-w me configure

Specifying Compiler and SDK Versions

By default, MakeMe will use the latest version of a compiler to build an application. However, when building for Windows or VxWorks, you can force MakeMe to use a specific version of Visual Studio or VxWorks by setting the VSINSTALLDIR and WIND_BASE environment variables.

For example: if you have Visual Studio 2013 (12) and Visual Studio 2015 (14) installed, you can force MakeMe to build with Visual Studio 2013 by setting the VSINSTALLDIR environment variable. Note: this variable is defined by the Visual Studio vcvarsall.bat script.

VSINSTALLDIR="c:/Program Files/Microsoft Visual Studio 12.0" ./configure

To build with a specific version of WindRiver VxWorks, use the WIND_BASE environment variable. Note: this variable is defined by the WindRiver wrenv.sh script.

WIND_BASE="Z:/WindRiver/vxworks-x86" ./configure --platform vxworks-x86

Useful Configure Commands

Show commands as they are executed:

me --show

To dump the entire configuration into a single MakeMe file. This is great for debugging.

me dump

To learn more, read about Debugging a Build.

Customize.me

Instead of manually specifying settings to configure, you can create a customize.me file that will be loaded after the main.me and all referenced MakeMe files are fully loaded. The customize.me file can thus override any prior MakeMe setting. Projects should not ship this file and so users need not fear their customize.me file will be overwritten.

{
    customize: [
        'custom.me'
    ]
}

© Embedthis Software, 2003-2015. All rights reserved.