-
Notifications
You must be signed in to change notification settings - Fork 74
examples: reorganize Makefile #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
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:
I’ve considered replacing it with tools like cargo-make or cargo-xtask, but neither feels elegant enough:
So I started thinking: maybe we could introduce a new binary that handles the entire workflow seamlessly. Then, developers could use it like this:
|
This might be helpful. Please take a look and take into comparison. |
|
Thanks for all the input! I think it makes sense to replace the current make setup with a Cargo-based tool (e.g. named as cargo-optee). Let's start experimenting with this approach. We can introduce a few subcommands, for example:
We can start by experimenting with one example and try to implement the build command at the first stage. |
|
I've opened a draft PR: #245 about this, please feel free to share the feedback, thanks! |
This PR reorganizes the Makefiles under
examples/.Currently, we have 26 examples (and more in the future). Updating each example's Makefile individually makes maintenance and review difficult. Since most Makefile logic is shared, this PR centralizes common definitions under
examples/mk/:examples-root.mkhost.mk— for CAs and pluginscommon-ta.mkstd-ta.mkno-std-ta.mkThe Makefiles design is suitable for this directory layout of each example:
Our all examples are fit for this structure: Most of examples have one host and one TA;
Some examples (e.g.,
supp_plugin-rs,mnist-rs) override certain variables (such as location ofuuid.txt) to fit specific needs. The Makefile variables are designed to be easily overridden for such cases.Please pay special attention when reviewing the
examples/mk/*,supp_plugin-rsandmnist-rs.Future Work
This is the first step in cleaning up and unifying our Makefile structure.
With this reorganization, future Makefile updates can be made more consistently and reviewed more easily.
In the dev docker environment, the
examples/mkpath can be written as a constant include path used by each separate examples.