aboutsummaryrefslogtreecommitdiff
path: root/mk/compile.mk
AgeCommit message (Collapse)Author
2019-04-04build: remove pedantic from build directivesEtienne Carriere
This change removes -pedantic from the build directive from all warning build level. The rational is that OP-TEE OS package no longer supports being built in pedantic mode allowing now use of implementation sequence that are rejected in pedantic mode, for example using = { } for initializing structured local variables in a structure agnostic way which OP-TEE OS community as agreed to use. Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-11-27mk/compile.mk: define __FILE_ID__ for all filesJens Wiklander
Defines __FILE_ID__ with a unique name of the file being compiled. Useful to create globally unique variables. Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-11-23core: helper for device tree compilationEtienne Carriere
Add helper function gen-dtb-file in the build sequence. It generates a DTB file from input DTS file. The DTS file is preprocessed with CPP before being compiled using the device tree compiler (DTC). Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-09-27Allow mixed declaration and codeJens Wiklander
Removes the -Wdeclaration-after-statement compiler flag to allow mixed declaration and code Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-08-10Add dependency on ta-dev-kit when building in-tree TAJerome Forissier
Fixes the following errors which may reportedly be triggered by plain "make" too [1]: $ make -s clean && make -s out/arm-plat-vexpress/ta/avb/entry.o cc1: warning: out/arm-plat-vexpress/export-ta_arm32/include: No such file or directory [-Wmissing-include-dirs] ta/avb/entry.c:5:30: fatal error: tee_internal_api.h: No such file or directory compilation terminated. mk/compile.mk:146: recipe for target 'out/arm-plat-vexpress/ta/avb/entry.o' failed make: *** [out/arm-plat-vexpress/ta/avb/entry.o] Error 1 $ make -s clean && make -s out/arm-plat-vexpress/ta/avb/user_ta_header.o cc1: warning: out/arm-plat-vexpress/export-ta_arm32/include: No such file or directory [-Wmissing-include-dirs] out/arm-plat-vexpress/export-ta_arm32/src/user_ta_header.c:5:22: fatal error: compiler.h: No such file or directory compilation terminated. mk/compile.mk:154: recipe for target 'out/arm-plat-vexpress/ta/avb/user_ta_header.o' failed make: *** [out/arm-plat-vexpress/ta/avb/user_ta_header.o] Error 1 Link: [1] https://github.com/OP-TEE/build/issues/285 Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-07-18Add support for compiling in-tree TAsJens Wiklander
Adds support for compiling in-tree TAs. Unless specified via CFG_USER_TA_TARGET_<ta-name> the TA will be built with the first TA target (aka TA dev kit, when delivered) specified in the variable ta-targets which is initialized in core/arch/arm/plat-*/conf.mk. Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-07-18Use per $(sm) unique FORCE-GENSRCJens Wiklander
Uses per $(sm) unique FORCE-GENSRC to allow one submodule (sm) depend on files produced by another submodule. CFG_IN_TREE_EARLY_TAS needs this for the core submodule to depend on a submodule representing an in-tree TA. Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2018-06-26Do not set -Werror by defaultJerome Forissier
Having -Werror turned on by default can be annoying, because not everyone uses the same compiler, and different compiler versions have different warnings. Therefore, provide CFG_WERROR to turn it on instead. Enable CFG_WERROR in the CI scripts because we still don't want warnings with the officially supported compilers. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
2018-03-14build: introduce asm-defines-yJerome Forissier
The Makefile rules that are used to generate a C header file containing constants for struct offsets etc. are currently in mk/compile.mk. They are used by core.mk which sets a variable (asm-defines-file) before it includes compile.mk. This works well for this purpose, but does not scale to several files. There is a use case for platform code to be able to use the asm-defines mechanism, too. Therefore, introduce a variable that can be used in any sub.mk: asm-defines-y. In addition, to avoid duplication, the DEFINE and DEFINES macros are moved to their own header (core/include/gen-asm-defines.h), with the added benefit that it can be explicitly excluded from the checkpatch list and thus not generate any warning on the 'DEFINE' macro needing parentheses. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
2016-10-14build: include submodule in name of per-library variablesJerome Forissier
Because a library may be built several times for different submodules (for example, libutils.a is built differently for kernel and user mode), the names of the variables that hold library-specific flags have to uniquely identify the instance of the library that's being built. Example use case: to build libutils with flag FOO for the core and flag BAR for the user mode, add this to lib/libutils/sub.mk: ifeq ($(sm),core) cppflags-lib-y += -DFOO else cppflags-lib-y += -DBAR endif Without this fix, the above would fail because all the flags would be added to all the builds of libutils. Fixes: 3d34e125a253 ("Add support for $(cflags-lib-y)") Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
2016-06-03build: remove old gensrc facilityJens Wiklander
Removes the build facility for auto generated source files now that it's replaced by a new and more advanced. Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2016-06-03mk: add new gensrc build facilityJens Wiklander
Adds a new build facility for auto generated source files. Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2016-02-29mk/compile.mk: add 'remove' flags variable for submoduleJerome Forissier
With this commit it is possible to remove a CPP/C/AS flag for the submodule being built. For instance suppose one adds the following to core/core.mk: cflags-remove-core += -pedantic ...then the '-pedantic' flag will be stripped off from the command line when building any C file of the TEE core. Previously, one could remove flags only on a global basis or for a single file. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2016-02-29Introduce CFLAGS32 and CFLAGS64Jerome Forissier
Previously, compile.mk and gcc.mk were using $(CFLAGS) which cannot properly handle 32-bit and 64-bit compiles. This commit introduces CFLAGS32 and CFLAGS64 instead, which are set to $(CFLAGS) by defaut for convenience. For each submodule (core, ta_arm32, ta_arm64) a new internal variable is defined in the architecture makefile (core/arch/arm/arm.mk): arch-bits-$(sm). Its value is either 32 or 64. This can later be used to reference the proper CFLAGS. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2016-02-18arm: add auto generated asm-defines.hJens Wiklander
Adds defines for assembly access to: * struct thread_ctx * struct thread_user_mode_rec * struct thread_core_local * struct thread_smc_args * struct thread_abort_regs * struct thread_user_mode_rec as needed from assembly code replacing previous definitions in kernel/thread.h and thread_private.h. Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey) Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU, FVP) Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2016-02-18core: add auto generated asm-defines.hJens Wiklander
The temporary files are all stored alongside asm-defines.h, and are named: .asm-defines.s, .asm-defines.s.d, .asm-defines.s.cmd. Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2015-09-09TA as ELF + signatureJens Wiklander
Changes format of TA to use the ELF format instead. This patch also adds signature checking of the TA. The format of the TA is: <Signed header> <ELF header> <Program header> (part of ELF spec, pointing out segments to load) <Sections> A struct ta_head is placed in the first section of the first segment to carry flags and other properties of the TA. elf32.h, elf64.h and elf_common.h are imported from FreeBSD. In addition to the R_ARM_RELATIVE relocation type, adds support for R_ARM_ABS32 relocations. Since a symbol table is needed to process this relocation type a separate program header is added in the TA ELF containing the sections .dynamic, .dynsym, .dynstr and .hash. These sections are only needed during relocation and could be released once the TA is relocated. A default signing key has been generated with openssl genrsa -out key.pem and added as keys/default_ta.pem Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU, FVP) Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Tested-by: Pascal Brand <pascal.brand@linaro.org> (STM platform) Tested-by: Pascal Brand <pascal.brand@linaro.org> (QEMU platform) Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (HiKey)
2015-05-21Add sparse support [C=1]Jens Wiklander
Adds support to check source files with sparse when C=1 on the command line. Only files that are recompiled are checked. Note that sparse isn't very useful at this stage since the source code need changes to be more sparse friendly. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
2015-04-30build: add support for make -sJens Wiklander
Adds support for make -s to get a really silent build. This is useful to get a shorter travis build log. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
2015-03-17Separate compiler for core and user TAJens Wiklander
Enables compilation with different compilers for core and user TA. Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU, FVP) Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
2015-01-23mk/compile.mk: GNU make 4.0 compatibilityJerome Forissier
Fixes issue https://github.com/OP-TEE/optee_os/issues/179 (GNU make 4.0 rebuilds everything each time it is run). GNU make 4.0 includes a fix for bug http://savannah.gnu.org/bugs/?16051 which breaks the C compilation rule in mk/compile.mk. Previous versions of make would not add the FORCE target to $?, whereas version 4.0 does. Therefore, one must explicitly exclude FORCE from $? to properly detect if dependencies have changed. Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
2014-12-12separate .rodata sectionsJens Wiklander
Puts each .rodata in a file specific .rodata section Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
2014-12-09Cosmetics fixesPascal Brand
Signed-off-by: Pascal Brand <pascal.brand@st.com> Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
2014-11-07core: create conf.h from CFG_* Makefile variablesJerome Forissier
Simplify the use of makefile configuration variables from C code. With this patch, one can #include <generated/conf.h> instead of adding CPP flags definitions to the .mk files. - CFG_* variables that are set to 'y' are converted to: #define CFG_FOO 1 - Undefined variables, or variables set to 'n' remain undefined in conf.h - CFG_* variables with any other value are output unchanged Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
2014-11-05build: print 'AS' instead of 'CC' when input file is assemblyJerome Forissier
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org>
2014-11-04Add support for $(cflags-lib-y)Jerome Forissier
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Tested-by: Pascal Brand <pascal.brand@linaro.org> (STM platform)
2014-10-23Add support for per-directory/per-library/per-file includes, and per-library ↵Jerome Forissier
CPP flags The new variables that can be used in sub.mk are: 1) For includes: incdirs-y, incdirs-lib-y, incdirs-<filename>-y For example, suppose core/lib/libfoo/sub.mk contains the following: # All source files declared in $(srcs-y) in this sub.mk will # have -Icore/lib/libfoo/include incdirs-y := include # All source files for the current library $(libname) will be built # with -Icore/lib/libfoo/include/baz (even files that are in other # directories) incdirs-lib-y := include/baz # In addition to the above, bar.c will be compiled with # -Icore/lib/libfoo/include/bar incdirs-bar.c-y := include/bar 2) For CPP flags: cppflags-lib-y For example, to add -DLIBFOO to all the source files that belong to the same library, add this to any of the sub.mk files: cppflags-lib-y := -DLIBFOO Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Tested-by: Jens Wiklander <jens.wiklander@linaro.org> (QEMU virt platform)
2014-10-09Fix strict-aliasing for DEBUG=0Jens Wiklander
2014-09-09Makefile variables $(*-dir) should not have a trailing slashJerome Forissier
As a general rule, Makefile variables that are directories should not have a trailing slash, and should be used as: $(some-dir)/some-file rather than $(some-dir)some-file. This is more readable.
2014-09-02Cosmetic fixes for build outputJerome Forissier
By default, the OP-TEE build shows abbreviated output similar to the Linux kernel. This commit fixes a number of deviations/inconsistencies. - Always print a command in uppercase, followed by the target file. - Make sure commands and file paths are nicely aligned, with two leading spaces to make command output/errors better stand out. - Remove some duplicate slashes in file paths. We use the following rule: variables that hold directory names such as $(arch-dir) or $(platform-dir) always have a trailing slash. The 'subdirs' and 'incdirs' variables used in sub-makefiles are an exception because doing otherwise would needlessly clutter the sub-makefiles.
2014-08-18mk/compile.mk: simplify dependency generation; better support ccacheJerome Forissier
This commit modifies the compilation flags that are used to generate dependency files (*.o.d). Rather than using the preprocessor's -MD flag (-Wp,-MD,<depfile>), we now use the frontend's equivalent (-MD -MF <depfile> -MT <target>). There are three reasons for doing so: 1. The GCC man page recommends against using -Wp, because "the preprocessor's direct interface is undocumented and subject to change". 2. The new flags generate the correct rule directly, including the subdirectory in front of the object name, so scripts/fixdep is not needed anymore. 3. ccache (3.1.9) would not handle -Wp,-MD as expected. It would preserve the directory prefix, so that we would end up with an invalid path after the fixdep phase, making the rules useless. With this patch, OP-TEE builds fine with ccache: make -j3 CROSS_COMPILE="ccache arm-linux-gnueabihf-"
2014-06-12Open-source the TEE CorePascal Brand
Signed-off-by: Pascal Brand <pascal.brand@st.com>