-
Notifications
You must be signed in to change notification settings - Fork 35
Mbed TLS makefile generator #7
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
Merged
tom-daubney-arm
merged 44 commits into
Mbed-TLS:main
from
gilles-peskine-arm:tools-create-prepare-build
Apr 7, 2021
Merged
Mbed TLS makefile generator #7
tom-daubney-arm
merged 44 commits into
Mbed-TLS:main
from
gilles-peskine-arm:tools-create-prepare-build
Apr 7, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create a build directory with subdirectories and symlinks. Generate a makefile. Collect dependencies by running `cpp -MM`. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Create a build directory with subdirectories and symlinks. Generate a makefile. Collect dependencies by looking for #include directives without consideration for the current configuration, so that the resulting makefile doesn't need to be regenerated when the configuration changes. Work in progress. Test dependencies are wrong for submodules. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Create a build directory with subdirectories and symlinks. Generate a makefile to build the library, sample programs and unit tests. Support both in-tree and out-of-tree builds. Collect dependencies by looking for #include directives without consideration for the current configuration, so that the resulting makefile doesn't need to be regenerated when the configuration changes. Support changing the configuration when creating the build directory. This can be done either by copying the configuration file and modifying it, or by including the original configuratiom and modifying it through additional #define and #undef. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Add support for presets, which set default values for certain options. This allows creating a build directory for a commonly-used target by passing a single command line option. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Document variables that can be set on the command line (make help-variables). Document targets tests/test_suite_%.run and tests/test_suite_%.valgrind. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
The generated makefile compiles the unit tests from the root directory. This has the advantage of not requiring different paths (-I, -L). For the unit tests, unfortunately, this results in incorrect debugging information for the common .function files that get pulled in via the test generator rather than an #include directive. For these files, the .c file to compile contains #line directives with a path that's relative to the tests directory, and therefore the debugging data lists them as e.g. `.../build/suites/main_test.function` rather than `.../source/tests/suites/main_test.function`. As a workaround, create a symbolic link .../build/suites that points to the correct directory. In fact, this is only the correct directory if the test doesn't come from a submodule, so this is only a partial workaround. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Simpler interface that lists the libraries for each program. Fixes at least cert_app. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
When running tests, pass $(RUN) before the executable and $(RUNS) afterwards. This allows executing tests via a runtime analysis tool and passing extra arguments to the tool. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
These programs need to be linked with onefile.o. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Don't try to recover: this can mask errors. We're doing this correctly in CMakeLists.txt but I hadn't copied that option. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Work around a double definition of a type due to the double includion of check_config.h in config-mode=incude. This allows the build to pass in strict c99 compliant mode (it worked before in gcc and clang). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Fix a bug in dependency analysis whereby if file A was first noticed as a dependency of B, it could end up being considered a dependency of itself. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This is work in progress. You need to manually pass -fPIC when compiling the object files, otherwise the ld step will fail. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
It's only used in this class, and it will soon need to have access to other methods in that class. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Support building tests with include files in tests/include and common code in tests/src/*.c, as added in Mbed TLS 2.23. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Fix out-of-tree builds when there's an incompatible version of the generated file in the source tree. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Run the program (assumed to be compiled with profiling support) and save its profiling data. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This is very preliminary, like the work on driver wrapper generation. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This was referenced Mar 10, 2021
Merged
tom-daubney-arm
approved these changes
Apr 7, 2021
Contributor
tom-daubney-arm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice script! Thanks for this. LGTM.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a script to generate a
Makefilefor Mbed TLS or Mbed Crypto.Salient features:
config.hor as options to (un)set from whatever the sourceconfig.his at build time.developmentas well as the LTS branches.mbedtls-prepare-build -p xxxcreates a directorybuild-xxxwith a commonly used configuration/build-flags/platform combination (runmbedtls-prepare-build --helpfor a list).make V=1to see what commands get executed.make helpto see the main available targets (in addition to all individual files).Sample usage:
Known limitations: