User:Amotsok/sandbox

Build system's features
Main principles

Build system receives main repo directory as a start point and then processes it (and subdirs) recursively. Every directory which is under build system must contain recipe file which is named user.mk. If current directory contains sub directories which also must be processed they must be specified in current recipe file via SUB_DIRS variable. Notice that jumping deeply than one sub directory is not allowed. So each sub directory must contain recipe file. In general using of SUB_DIRS looks like:

SUB_DIRS := sub_dir1 sub_dir2 sub_dir3

From the logical point of view build system operates with the target concept. Target is a some kind of a logical union of data which must be processed by the build system as a one unit and produce some result (executable, rpm, files etc). The mandatory (and optional) data for target are specified using target properties (which are predefined and expected by the build system). To assign a value to some target property user must specify target name hat dot than property name and then assign operator with a text value. For example if we have some target named target1 that will look like

target1.SOME_PROPERTY := some text value

Each recipe file can contain arbitrary number of targets. Each target must be registered via TARGETS variable. TYPE property is absolutely mandatory for each target because it tells build system how to parse it.

TARGETS := target1 target2 target3

Short example

Let's consider a small example. For example we want to integrate a small binary to the build system. How the user.mk will look like.

TARGETS := target1 target1.TYPE    := executable target1.SRCS    := main.cpp target1.CXXFLAGS := -Werror