Skip to main content

The "config.mk" File

Control how the Signaloid Cloud Compute Engine compiles a connected repository with a config.mk file in the build directory.

By default the build process compiles every C and C++ source file it finds in the build directory, searching every sub-directory beneath it. A config.mk file at the build directory of your repository, whether the default src or an overridden one, overrides that default and passes options to the compiler and linker.

config.mk is a Makefile fragment. The Signaloid Cloud Compute Engine reads the following variables.

SOURCES

Points the build process at the exact source files to compile. Setting SOURCES stops the engine from scanning the build directory for other files. Paths are relative to the build directory.

SOURCES = \
main.c \
dir1/oneCFile.c

SOURCES += dir2/oneCPPFile.cpp

CFLAGS

Adds compilation flags for the C compiler. Use flags that do not change the compilation output, such as optimization levels or include paths.

CFLAGS = -I../include/ -DDEBUG

CXXFLAGS

Adds compilation flags for the C++ compiler. The same guidance applies. Set the C++ standard here.

CXXFLAGS = -I../include/ -DDEBUG

LDFLAGS

Adds flags for the linker. Use it to point at directories of your repository that hold pre-compiled static libraries.

LDFLAGS = -L../libs/

LIBS

Links against pre-compiled static libraries you committed to your repository. For a library libmylib.a:

LIBS = -lmylib

Providing config.mk through the API

Single-file source-code builds have no repository to hold a config.mk file. The Compute Engine API accepts the file contents directly instead, through the ConfigMk field on the Create Build From Single-file Source Code operation. See the Compute Engine API reference for that operation's request schema.