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

SAFE_MEMFUNCS​

SAFE_MEMFUNCS is by default set to ON and ensures that memmove, memcpy and memset functions propagate correctly the distributional information when their arguments point to addresses with distributional data. When SAFE_MEMFUNCS=ON it appends the -fno-buitlin-memset, -fno-builtin-memmove, -fno-buitlin-memcpy flags to the CFLAGS and CXXFLAGS so that the Signaloid UxHw SDK compilation infrastructure guarantees that the corresponding operations on distributional data are performed.

By setting this value to OFF no -fno-builtin flags will be used but it is possible that compiler optimizations might lead to these functions not propagating distributions correctly if the number of bytes copied/set is small.

By default SAFE_MEMFUNCS is enabled and you do not need to modify config.mk, unless you want to disable it.

SAFE_MEMFUNCS=OFF

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.