Building with MakeMe
This document describes the process to build the software from source using MakeMe. First make sure you have read the Building Overview to prepare your build environment.
The procedure for building with MakeMe is the same for all supported platforms.
Download MakeMe
You can download MakeMe from the Embedthis MakeMe Download download site. Packaged installations are provided for Windows and Mac. For Linux, use the source distribution. Read Installing MakeMe for details.
Configuring
Before building with MakeMe, you need to do a one-time configuration step. This customizes the software to select features, options and third-party packages available on your system. The configure shell script simply invokes me configure and passes all command line options to me.
me configure
Running Configure
You may run the configure script with no options to accept the defaults — this is a good starting point:
configure
You may also supply options to tailor the build:
configure --release --without all
The --release switch instructs MakeMe to build an optimized production release. The --without all switch will disable non-essential features and components to create a minimal build.
During configuration, MakeMe will create:
- A MakeMe file that specifies the platforms to build named: start.me
- An output products directory for each platform named: build/OS-ARCH-PROFILE
- A MakeMe file for each platform named: build/OS-ARCH-PROFILE/platform.me
- A source header with for the build configuration named: build/OS-ARCH-PROFILE/inc/me.h
OS is the name of the operating system, ARCH is the name of the cpu architecture and PROFILE is the build profile name, typically "debug" or "release". For example: linux-x86-debug.
The generated MakeMe files are readable Javascript files that contain the settings to control the build when MakeMe is run. When compiling, source code may include the me.h header to read the MakeMe configuration.
Configure Options
The tables below describe the key configuration options.
Basic Configure Options
Option | Description |
---|---|
--debug | Build a debug build. This builds a development, non-optimized build with debug symbols. |
--help | Display the me program usage help. |
--set KEY=VALUE | Set the value of a property in the MakeMe settings collection. For example: "--set mpr.tracing=false". |
--quiet, -q | Run quietly without progress trace. |
--release | Build a release build. This builds an optimized, production-ready build of the software. |
--verbose, -v | Run verbosely and emit more detailed progress trace. |
Cross Compiling
Option | Description |
---|---|
--platform OS-ARCH-PROFILE |
Specify the target platform for which to build. For example "-platform linux-arm-debug". Supported operating systems are: freebsd, linux, macosx, vxworks and windows. Supported architectures are: arm, mips, ppc, x64 or x86. If the -platform option is omitted, the local system is added as the target platform. You may use the 'local' alias to indicate the local platform. Multiple platforms may be specified. The ARCH component may specify a CPU instance to tune for. The CPU setting is used in a -DCPU=VALUE compiler define. For example: "-platform linux-arm:arm7tdmi-debug". NOTE: the platform switch is not a typical configure --host argument. i.e. The second component is a system architecture and not a distribution name. |
Feature Options
Option | Description |
---|---|
--without all | Disable all non-essential possible packages. |
--set tune=MODE | Tune the build to optimize for "size", "speed". You can also select "balanced" for a balance between speed and size. (Default is size). |
Optional Packages
Option | Description |
---|---|
--with PACKAGE[=dir] | Specify if a PACKAGE should be included in the build. The optional directory is the path to the source distribution of the package. If the directory is omitted, me will search the local system for the package in well known places. |
--without PACKAGE | Do not include the PACKAGE in the build. |
Example Use
configure --with openssl=/usr/src/openssl
Building with MakeMe
After configuring, you may proceed to build the source code by typing:
me
Packages
For a list of the available packages on your system that can be selected via configure, run
configure --help
This will display the MakeMe command options followed by a list of configurable features and components.
You may also find additional packages for download from the Pak Catalog. These are packages that can be installed via the Pak program. Once installed, configure can be run to enable the package.
Environment Variables
When cross compiling, certain environment variables may be passed to the configure script and on to me to configure the compiler and linker paths and flags. See more details below in the Cross Compiling section.
Variable | Description |
---|---|
AR | Path to the archiver program to use to archive libraries for the target system. |
CC | Path to the C/C++ compiler to use to compile for the target system. |
CFLAGS | Compiler control flags. |
DFLAGS | Compiler preprocessor defines. |
IFLAGS | Include directory options. |
LD | Path to the linker program to link objects for the target system. |
LDFLAGS | Linker flags. E.g. -Ldir to specify a non-standard directory for libraries. |
VSINSTALLDIR | Directory to the version of Visual Studio to use. By default, MakeMe will use the most recent installed version. |
WIND_BASE | Directory to the version of WindRiver VxWorks. By default, MakeMe will use the most recent installed version of the same architecture as specified platform architecture. |
Examples
Here are some useful configure command options.
To configure to build with the ccarm compiler.
CC=/opt/bin/ccarm ./configure
To configure for building outside a source tree. This supports building from source from a read-only file system.
configure --configure /path/to/source
To configure for a debug build with debug symbols:
configure --debug
To configure without TLS/SSL:
configure --without ssl
To configure using OpenSSL from a specific source location:
configure --with openssl=/path/to/openssl-source
To configure to build for 32-bit X86 (when on a 64-bit system):
configure --platform linux-x86-debug
To display all configure options, use configure --help. This is the example output for the Appweb product.
configure --help Usage: me [options] [targets|goals] ... Options: --benchmark # Measure elapsed time --configure /path/to/source/tree # Configure product --configuration # Display current configuration --continue # Continue on errors --debug # Same as --profile debug --deploy directory # Install to deploy directory --depth level # Set test depth level --diagnose # Emit diagnostic trace --dump # Dump the full project --endian [big|little] # Define the CPU endianness --file file.me # Use the specified me file --force # Override warnings --gen [make|nmake|sh|vs|xcode|main|start]# Generate project file --get field # Get and display a me field value --help # Print help message --import # Import standard me environment --keep # Keep intermediate files --log logSpec # Save errors to a log file --more # Run output through more --nocross # Build natively --overwrite # Overwrite existing files --out path # Save output to a file --platform os-arch-profile # Build for specified platform --pre # Pre-process a source file to stdout --prefix dir=path # Define installation path prefixes --prefixes [debian|opt|embedthis] # Use a given prefix set --profile [debug|release|...] # Use the build profile --quiet # Quiet operation. Suppress trace --rebuild # Rebuild all specified targets --reconfigure # Reconfigure with existing settings --release # Same as --profile release --rom # Build for ROM without a file system --set [feature=value] # Enable and a feature --sets [set,set,..] # File set to install/deploy --show # Show commands executed --static # Make static libraries --unicode # Set char size to wide (unicode) --unset feature # Unset a feature --version # Display the me version --verbose # Trace operations --watch [sleep time] # Watch for changes and rebuild --why # Why a target was or was not built --with NAME[=PATH] # Build with package at PATH --without NAME # Build without a package Feature Selection: --set ejs.db=value # Enable database support, ejs.db (true|false) --set ejs.mail=value # Enable mail support, ejs.mail (true|false) --set ejs.mapper=value # Enable database mapper support, ejs.mapper (true|false) --set ejs.tar=value # Enable tar support, ejs.tar (true|false) --set ejs.template=value # Enable template support, ejs.template (true|false) --set ejs.web=value # Enable web support, ejs.web (true|false) --set ejs.zlib=value # Enable zlib support, ejs.zlib (true|false) --set http.pam=value # Enable Unix Pluggable Auth Module (true|false) --set http.webSockets=value # Enable WebSockets (true|false) --set mpr.logging=value # Enable application logging (true|false) --set configFile=value # Path of the appweb.conf file --set serverRoot=value # Home directory for the server Components (--with NAME, --without NAME): cgi # Common Gateway Interface Module dir # Directory Listing Module ejs # Embedthis Ejscript Javascript Language esp # Embedthis ESP, the amazingly fast C-Language web framework mdb # Embedthis MDB Database openssl # OpenSSL php # PHP Web Framework sqlite # SQLite Library ssl # Secure Socket Layer Interface (OpenSSL) vxworks # VxWorks SDK winsdk # Windows SDK zlib # Zlib Library
Useful MakeMe options and targets
Here are some useful MakeMe examples:
me --show # Show actual commands while building me --why # Show why each target is or is not being built me dump # Dump the combined MakeMe configuration in one file me rebuild # Rebuild all targets me clean # Clean all built targets me rebuild # Rebuild all targets me install # Install the built software locally me help # Show MakeMe usage
Static Linking
On some platforms, it may be necessary to statically link the software. The default MakeMe configuration will build using shared libraries. This is so that software can dynamically load modules at run-time. It is generally recommended that you use dynamic linking, however, if you must statically link, run configure with the --static option and then rebuild.
configure --static me
Installing
You can install the newly built software via me:
sudo me install
You can remove by:
sudo me uninstall
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 PLATFORM option. This adds a platform to the list of platforms to be made. Multiple platforms may be specified and the 'local' platform alias may be used for the local development platform.
Specifying the Target Platform
A platform specification is of the form OS-ARCH-PROFILE, where the supported operating systems are: freebsd, linux, macosx, vxworks and windows. The ARCH field is one of arm, mips, ppc, x64 or x86. X64 is the AMD/Intel 64-bit instruction set and x86 is the Intel X86 Pentium instruction set. You may also use i386 or i686 for specific Intel X86 instruction sets.
The ARCH componenty may contain a specific CPU to tune for. This is specified as a :CPU suffix to the ARCH field. Some operating systems such as VxWorks, require a CPU specifier. For example:
me --platform vxworks-arm:arm7tdmi-debug -configure .
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.
Building 32-bit Applications
Some products require local building to make the tools that are required to build for a target platform. 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.
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 MakeMe cannot locate the tool chain, you can supply the tool chain details via environment variables.
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 configure
Note that on Unix systems, the compiler is used for linking.
Here is a cross-compilation configure command line to create a debug build for Linux on ARM7 using a specific compiler version.
CC=/opt/bin/cc.exe \ CFLAGS=-I/opt/include \ ./configure --debug --platform linux-arm:arm7tdi-debug
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. This is most easily done by running the Visual Studio vcvarsall.bat script supplied with Visual Studio.
"c:\Program Files (x86)\Microsoft Visual Studio 12.0 VC\vcvarsall.bat" x86
configure make
If building Windows using Cygwin, you can pass the VSINSTALLDIR variable directly into configure.
VSINSTALLDIR="c:/Program Files/Microsoft Visual Studio 12.0"
./configure
VxWorks
Before building for VxWorks, you must define the WIND environment variables via the WindRiver wrenv.sh script provided with VxWorks. This defines the WIND_BASE, WIND_HOST_TYPE and other required environment variables.
The command below runs wrenv.sh and defines the WIND variables in the current shell's environment.
eval `/path/to/WindRiver/wrenv.sh -p vxworks-6.8 -o print_env -f sh`
Once defined, you can invoke configure.
configure --platform vxworks-x86
Create an Installable Release
After building, MakeMe can create installable packages of the software:
me package
The release packages are placed under the build/*/img directory.
Deploying
If you are embedding into another application or installing to a target device, you can deploy the required software files to a staging directory.
me --sets core,lib deploy /tmp/deployed
This will copy the core and library files to the deploy directory under the platform output directory.