How to Build the Mako Server

This document explains how to build the Mako Server. Using the Mako Server is explained in a separate document.

Compiling the Mako Server C Code

The make directory contains a generic makefile. You may use the makefile for building the server. The make directory also contains a few ready-to-use build scripts, which calls the makefile. See the README file in the make directory for details.

As an option to using the makefile, you may include the source files directly in your build-process and/or IDE.

Mako Server Source Files:

src/makoMain.cRequired The Mako Server startup code sets up a configurable standalone server using BAS.c.
../../amalgamation/BAS.cRequired The Barracuda App Server library. See ../../amalgamation/README.txt for details.
src/SendError.cOptional Traps errors and optionally reports the errors, including asserts, if enabled. You may use another error handler or remove the call in makoMain.c.
obj/LspZip.cOptional Zip file converted to C array by bin2c and assembled by running BuildInternalZip. Exclude by compiling with macro USE_EMBEDDED_ZIP=0.
../../xrc/sql/ls_sqlite3.cOptional Lua SQLite Lua bindings.
../../xrc/sql/luasql.cOptional Lua SQLite Lua bindings.
../../xrc/sql/sqlite3.cOptional SQLite database.

* When compiled for Windows, include all C files in the src/Windows subdirectory. These files enable the server to be installed as a Windows service.

Resource Files

The Mako Server requires a few resource files. The make directory includes two scripts for assembling and zipping together the resource files.

In general, you should always include the external resource file mako.zip with the Mako Server executable since this resource file includes additional resources that make components such as the TraceLogger and the File Manager work. The internal ZIP file, which may be removed, should only be used as a fallback if mako.zip is not found. The server aborts if the Mako Server is compiled without the internal ZIP file and if the Mako Server fails to mount mako.zip.

SQL Databases

The default is to include SQLite, however, you may compile the Mako Server with no built-in SQL support. You may also include the ITTIA embeddable database.

Command-line Compile Example

The Mako Server can be compiled directly on the command line without using the makefile. The following example compiles the Mako Server for POSIX/Linux without using SQLite and without using the internal ZIP file (obj/LspZip.c).

Start by setting the include path:

export INC="-I ../../inc/ -I../../inc/arch/Posix -I../../inc/arch/bsd/Posix"

Set the required C compiler flags:

export CFLAGS="-pthread -O3 -Os -DNDEBUG -DMAKO -DUSE_EMBEDDED_ZIP=0 -DUSE_SQL=0"

The following must be added to CFLAGS if compiled for a 64 bit processor:

-DBA_64BIT -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast

Compile and link:

gcc -o mako $CFLAGS $INC ../../amalgamation/BAS.c src/MakoMain.c src/SendError.c -lm

Using the Makefile

See the following file for details: make/README.txt