linaro-swg / optee_examples

OP-TEE Sample Applications
Other
163 stars 140 forks source link

ta: remove CPPFLAGS #75

Closed jforissier closed 4 years ago

jforissier commented 4 years ago

Note: The description text was wrong when I created the PR. I fixed it and force-pushed.

Setting CPPFLAGS in TA makefiles does not work with Buildroot (the value is ignored and replaced with some Buildroot-defined default).

Here are the relevant parts of the Buildroot makefiles:

 build/br-ext/package/optee_examples_ext/optee_examples_ext.mk-11-     @$(foreach f,$(wildcard $(@d)/*/ta/Makefile), \
 build/br-ext/package/optee_examples_ext/optee_examples_ext.mk-12-             echo Building $f && \
 build/br-ext/package/optee_examples_ext/optee_examples_ext.mk-13-                     $(MAKE) CROSS_COMPILE="$(shell echo $(BR2_PACKAGE_OPTEE_EXAMPLES_EXT_CROSS_COMPILE))" \
 build/br-ext/package/optee_examples_ext/optee_examples_ext.mk-14-                     O=out TA_DEV_KIT_DIR=$(OPTEE_EXAMPLES_EXT_SDK) \
 build/br-ext/package/optee_examples_ext/optee_examples_ext.mk:15:                     $(TARGET_CONFIGURE_OPTS) -C $(dir $f) all &&) true

 buildroot/package/Makefile.in:262:TARGET_CONFIGURE_OPTS = \
 buildroot/package/Makefile.in:292: CPPFLAGS="$(TARGET_CPPFLAGS)" \

 buildroot/package/Makefile.in:161:TARGET_CPPFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

Therefore the TAs end up being built with:

 make CPPFLAGS="-D_LARGEFILE_SOURCE ..."

...which is why the values in ta/*/Makefile are ignored.

Since we use CPPFLAGS only to set the value of CFG_TEE_TA_LOG_LEVEL and since this is taken care of elsewhere (by the TA dev kit in ta/ta.mk), there is no reason to keep the CPPFLAGS.

Note: if one needs to set TA flags in the Makefile, one reliable way is to set CPPFLAGS_ta_arm32 and/or CPPFLAGS_ta_arm64.

Signed-off-by: Jerome Forissier jerome@forissier.org