ivila commented on PR #244: URL: https://github.com/apache/teaclave-trustzone-sdk/pull/244#issuecomment-3430830423
Instead of struggling with Makefiles, I suggest replacing them entirely with something integrated into the Cargo ecosystem — something that feels more “Rust-like.” Currently, the Makefile helps us accomplish the following: 1. Build the binary with a specific linker (ARM or AArch64, for both CA and TA). 2. Build the binary with a specific builder (cargo or xargo, for TA only). 3. Occasionally build the binary with extra flags. 4. Strip the output binary (for both CA and TA — though I think it’s unnecessary for CA since it runs in the REE, where code size doesn’t really matter). 5. Sign the TA (for TA only). I’ve considered replacing it with tools like [cargo-make](https://github.com/sagiegurari/cargo-make) or [cargo-xtask](https://github.com/matklad/cargo-xtask), but neither feels elegant enough: * `cargo-make` requires writing a [Makefile.toml](https://github.com/sagiegurari/cargo-make?tab=readme-ov-file#simple-example), which is essentially the same as what we’re already doing, but worse. * `cargo-xtask` needs a [config.toml](https://github.com/matklad/cargo-xtask/blob/master/examples/hello-world/.cargo/config.toml) under each project, which also feels cumbersome. So I started thinking: maybe we could introduce a new binary that handles the entire workflow seamlessly. For example, we could create a `cargo-teaclave-trustzone` crate that provides a `cargo teaclave-trustzone` command. Then, developers could use it like this: 1. **When building the CA** Developers simply run `cargo teaclave-trustzone ca build`. This would automatically build the CA with the appropriate linker. If they want to strip the binary, they can use an option like `cargo teaclave-trustzone ca build --strip`. 2. **When building the TA** Developers run `cargo teaclave-trustzone ta build`. For STD builds, they could add a flag such as `cargo teaclave-trustzone ta build --std`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
