Small build system made for ModularOS project and AVR firmwares.
- Python 3 Dependent on use:
- gcc
pacman -S gcc
orapt-get install gcc
- avr-gcc
pacman -S avr-gcc
orapt-get install avr-gcc
The main configration file is buildz.json
. It must be placed in project root directory.
Structure of the config is:
{
"build": {
"type": "",
"targets": ""
},
"modules": [],
"toolchains": {
"toolchain": {
"type": "",
"output_dir": "build/{build_type}",
"output_pattern": "{module_name}",
"conf": {},
"env": {}
}
},
"targets": {
"target": {
"modules": "all",
"toolchain": "toolchain",
"env": {
}
}
}
}
build
type
: Can be"release"
or"debug"
as for now.targets
modules
: It is a list of project modules. Module name is equivalent to directory in project root. Module directory must containmodule.json
file.toolchains
: Dictionary of toolchains used by project. Dictionary key is used to identify toolchain in config. Toolchain must have:type
: It can be"GccToolchain"
or"AvrGccToolchain"
.output_dir
: It can be project relative or absolute path where outputs should be placed. It can use some of variables.output_pattern
: It is output file name pattern. It can use some of variables.conf
: It is compiler config dictionary. It cannot change for all of targets and is dependent on toolchain type.env
: It is compiler config that can change. Can be placed in target, module or toolchain config. Its content depends on toolchain type. It can use some of variables.- Variables to use in
env
,output_dir
or inoutput_pattern
: build_type
,target_name
,target_toolchain
,module_name
targets
: It is dictionary of targets. Key is name of target. Target is corresponding to procesor, platform etc. but can be whathever you wants.modules
: It can be list of modules that can be compiled for target. Additionaly it can be just string"all"
.toolchain
: It is one of keys from@buildz.toolchains
.env
: It is target dependent part of compiler env. It can use the same variables astoolchain.env
. It is compiler specific.
Must be placed in {project-root}/{module-name}/module.json
{
"files": [],
"envs": {
"toolchain": {
}
},
"packaging": ""
}
files
: It is list of module directory relative files or can be an absolute path.envs
: Module env can change according to used toolchain. The key ofenvs
dict must be one of{buildz.json}.toolchains
keys.packaging
: It is toolchain specific. For GCC and for avr-gcc it can beexecutable
,static
orshared
.
-
Conf must be dict of variables such as:
gcc_path
: On Linux usually it is/usr/bin/gcc
. If you have configured OS env it can be justgcc
.ld_path
: On Linux usually it is/usr/bin/ld
. If you have configured OS env it can be justld
.ar_path
: On Linux usually it is/usr/bin/ar
. If you have configured OS env it can be justar
.
-
Env variables are:
-
optimization
: Default is3
. It can be0
,1
,2
,3
or"s"
. -
compiler_flags
: Default is[]
. It it list of strings, each string per flag. -
includes
: Default is[]
. It is list of strings. Strings can be absolute, root relative (if defined intoolchain.env
ortarget.env
) or module relative (if defined inmodule.envs
) paths. It can useenv
parameters. -
defines
: Default is[]
. It is list of strings. Strings can be absolute, root relative (if defined intoolchain.env
ortarget.env
) or module relative (if defined inmodule.envs
) paths. It can useenv
parameters. -
build_type
: Default isrelease
. It can berelease
ordebug
. -
debug_level
: Default isNone
. It can be0
,1
,None
,3
. -
link_flags
: Default is[]
. It it list of strings, each string per flag. -
link_dirs
: Default is[]
. It is list of strings. Strings can be absolute, root relative (if defined intoolchain.env
ortarget.env
) or module relative (if defined inmodule.envs
) paths. It can useenv
parameters. -
link
: Default is[]
. It is list of strings. Each of string is library name which should be linked.
-
-
Conf must be dict of variables such as:
- The same as for
GccToolchain
.
- The same as for
-
Env variables are:
- The same as for
GccToolchain
.
- The same as for
-
Additionally they are:
mcu
: It is string containing mcu name.fcpu
: Default is[1000000]
. It is list of integers. It is use for target compilation.
-
Additional variables are available for
output_dir
andoutput_pattern
. They are:mcu
: stringfcpu
: integer