Mbed-TLS / TF-PSA-Crypto

Reference implementation of the PSA Cryptography API
Apache License 2.0
7 stars 7 forks source link

Introduce a makefile generator #86

Open gilles-peskine-arm opened 8 months ago

gilles-peskine-arm commented 8 months ago

First step towards #85.

Introduce a Python script that generates a makefile.

The design is heavily based on mbedtls-prepare-build. Most of the code is copied from there, but I took the opportunity to clean it up.

This is incomplete and not yet usable for daily work. I don't want to put further time into it until the design and current code is approved.

Current features:

Features to be added in follow-ups:

gilles-peskine-arm commented 8 months ago

we already have a makefile generator system, in CMake.

Yes, but it's not good at its job.

I would prefer to ship a very simple hand-written Makefile. We can be conservative about dependencies if that's a concern, i.e. rebuild everything if a .h file changes, etc.

That might be ok for users, but it's no good for maintainers. Part of the reason I wrote mbedtls-prepare-build is to save time for myself. Even as the sole user, it's been well worth the time.

ronald-cron-arm commented 8 months ago

I am not sure about what you mean by "First step towards https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/65."? The test components referenced by issue 65 use specific C compiler flags but having played a bit with it it seems possible to do that with cmake using something like cmake -DCMAKE_C_FLAGS=String:"-Werror -Wall -Wextra -mpclmul -msse2 -maes" .. for example.

gilles-peskine-arm commented 8 months ago

I am not sure about what you mean by "First step towards #65."?

Typo: I meant #85.

ronald-cron-arm commented 8 months ago

I am not sure about what you mean by "First step towards #65."?

Typo: I meant #85.

Ah, I could have guessed that, thanks.

gilles-peskine-arm commented 8 months ago

Another thing that doesn't work with cmake (both in mbedtls and in tf-psa-crypto):

$ rm programs/psa/psa_constant_names
$ make programs/psa/psa_constant_names
make: *** No rule to make target 'programs/psa/psa_constant_names'.  Stop.

Running make builds everything, but I have no idea how to build a specific program.

ronald-cron-arm commented 3 months ago

Another thing that doesn't work with cmake (both in mbedtls and in tf-psa-crypto):

$ rm programs/psa/psa_constant_names
$ make programs/psa/psa_constant_names
make: *** No rule to make target 'programs/psa/psa_constant_names'.  Stop.

Running make builds everything, but I have no idea how to build a specific program.

In CMake files we define the psa_constant_names target, thus make psa_constant_names just builds the psa_const_names program.