If I build TF-M and immediately build it again, some parts are rebuilt for no reason:
$ make [ 17%] Built target tfm_s_obj_lib [ 18%] Built target libtfmsprt [ 19%] Built target tfm_s_pp_tfm_common_s_1 [ 23%] Built target mbedcrypto_lib [ 23%] Installing Mbed Crypto to /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install [100%] Built target mbedcrypto Install the project... -- Install configuration: "MinSizeRel" -- Up-to-date: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install/include/mbedtls/aes.h [ lots of Up-to-date messages ] -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install/include/psa/crypto.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install/include/psa/crypto_accel_driver.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install/include/psa/crypto_compat.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install/include/psa/crypto_driver_common.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/ services/crypto/mbed-crypto/build/../install/include/psa/crypto_entropy_driver.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install/include/psa/crypto_extra.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install/include/psa/crypto_platform.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install/include/psa/crypto_se_driver.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install/include/psa/crypto_sizes.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install/include/psa/crypto_struct.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install/include/psa/crypto_types.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install/include/psa/crypto_values.h -- Up-to-date: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/secure_fw/services/crypto/mbed-crypto/build/../install/lib/mbedcrypto.a [ 23%] Built target mbedcrypto_lib_install Scanning dependencies of target tfm_crypto [ 23%] Building C object secure_fw/services/crypto/CMakeFiles/tfm_crypto.dir/crypto_init.o [ 24%] Building C object secure_fw/services/crypto/CMakeFiles/tfm_crypto.dir/crypto_alloc.o [ 24%] Building C object secure_fw/services/crypto/CMakeFiles/tfm_crypto.dir/crypto_cipher.o [ 25%] Building C object secure_fw/services/crypto/CMakeFiles/tfm_crypto.dir/crypto_hash.o [ 25%] Building C object secure_fw/services/crypto/CMakeFiles/tfm_crypto.dir/crypto_mac.o [ 25%] Building C object secure_fw/services/crypto/CMakeFiles/tfm_crypto.dir/crypto_key.o [ 26%] Building C object secure_fw/services/crypto/CMakeFiles/tfm_crypto.dir/crypto_aead.o [ 26%] Building C object secure_fw/services/crypto/CMakeFiles/tfm_crypto.dir/crypto_asymmetric.o [ 27%] Building C object secure_fw/services/crypto/CMakeFiles/tfm_crypto.dir/crypto_key_derivation.o [ 27%] Linking C static library tfm_crypto.a merging objects from mbedcrypto.a [ 27%] Built target tfm_crypto [ 31%] Built target tfm_storage [ 37%] Built target tfm_internal_trusted_storage [ 38%] Built target tfm_platform [ 39%] Built target tfm_qcbor_encode [ 41%] Built target tfm_t_cose_sign [ 44%] Built target tfm_attest [ 45%] Built target tfm_audit [ 45%] Linking C executable tfm_s.axf Memory region Used Size Region Size %age Used FLASH: 182132 B 390336 B 46.66% RAM: 49676 B 256 KB 18.95% CODE_RAM: 2432 B 512 KB 0.46% VENEERS: 704 B 832 B 84.62% [ 45%] Built target tfm_s [ 46%] Built target tfm_s_1_pp_tfm_common_s_1 [ 46%] Linking C executable tfm_s_1.axf Memory region Used Size Region Size %age Used FLASH: 182132 B 390336 B 46.66% RAM: 49676 B 256 KB 18.95% CODE_RAM: 2432 B 512 KB 0.46% VENEERS: 704 B 832 B 84.62% [ 46%] Built target tfm_s_1 [ 47%] Built target tfm_qcbor_decode [ 49%] Built target tfm_t_cose_verify [ 56%] Built target tfm_secure_tests [ 58%] Built target tfm_t_cose_test [ 61%] Built target tfm_qcbor_test [ 72%] Built target tfm_ns_obj_lib [ 81%] Built target tfm_non_secure_tests [ 82%] Built target tfm_ns_pp_musca_ns_1 [ 82%] Built target tfm_ns_pp_image_macros_to_preprocess_1 [ 82%] Linking C executable tfm_ns.axf Memory region Used Size Region Size %age Used FLASH: 12500 B 510 KB 2.39% RAM: 13504 B 256 KB 5.15% **[INFO]** Image version number set to 0.0.0+7 [ 82%] Built target tfm_ns [ 83%] Built target tfm_ns_1_pp_image_macros_to_preprocess_1 [ 83%] Built target tfm_ns_1_pp_musca_ns_1 [ 83%] Linking C executable tfm_ns_1.axf Memory region Used Size Region Size %age Used FLASH: 12500 B 510 KB 2.39% RAM: 13504 B 256 KB 5.15% **[INFO]** Image version number set to 0.0.0+8 [ 83%] Built target tfm_ns_1 [ 86%] Built target mbedcrypto_mcuboot_lib [ 86%] Built target mcuboot_pp_musca_bl2_1 [ 87%] Installing Mbed Crypto to /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install [100%] Built target mbedcrypto Install the project... -- Install configuration: "MinSizeRel" -- Up-to-date: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/mbedtls/aes.h [ lots of Up-to-date messages ] -- Up-to-date: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/mbedtls/xtea.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/psa/crypto.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/psa/crypto_accel_driver.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/psa/crypto_compat.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/psa/crypto_driver_common.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/psa/crypto_entropy_driver.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/psa/crypto_extra.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/psa/crypto_platform.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/psa/crypto_se_driver.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/psa/crypto_sizes.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/psa/crypto_struct.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/psa/crypto_types.h -- Installing: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/include/psa/crypto_values.h -- Up-to-date: /home/ross/Yocto/build/tmp/work/armv8m-poky-linux-gnueabi/trusted-firmware-m/1.0-r0/build/bl2/ext/mcuboot/mbed-crypto/build/../install/lib/mbedcrypto.a [ 87%] Built target mbedcrypto_mcuboot_lib_install [100%] Built target mcuboot
I imagine its where the makefiles do an in-tree install that causes the rebuild.