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.
Related pages
- Build Directory for choosing which directory the build runs from.
- The "signaloid.yaml" File for the other file in your repository that configures a build.
- How to Run Code from a GitHub Repository for the end-to-end workflow.