Skip to content
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

Common Makefile rules #451

Merged
merged 2 commits into from
Apr 10, 2019
Merged

Common Makefile rules #451

merged 2 commits into from
Apr 10, 2019

Conversation

ilammy
Copy link
Collaborator

@ilammy ilammy commented Apr 9, 2019

Currently we use a bit different build paths for object files:

  • src → build/obj
  • jni → build/obj/jni
  • tests → build/tests/obj

This is one of the reasons that build rules for C/C++ code are duplicated across Soter, Themis, ThemisPP, Themis-JNI, and tests.

Use a more consistent approach for placing object files: all of them go into $(OBJ_PATH) and get suffixed by .o. This way allows us to have a single common rule for building all C/C++ code:

  • src → build/obj/src
  • jni → build/obj/jni
  • tests → build/obj/tests

Note however that in some cases we have to use different compiler flags, mostly to setup proper header search paths. Use per-target CFLAGS variable settings for that.

Using consistent object file placement allows us to simplify formatting build rules in the same way. All marker files will now be placed in the same place as object files.

This allows us to remove a lot of special cases and use common formatting rules for all C/C++ code.

clang-format and clang-tidy require correct compilation flags. Thankfully, CFLAGS values are already correctly set everywhere so we do not need to do anything special for that. Though, JsThemis is a bit special, because we do not compile it normally.

Currently we use a bit different build paths for object files:

  - src -> build/obj
  - jni -> build/obj/jni
  - tests -> build/tests/obj

This is one of the reasons that build rules for C/C++ code are
duplicated across Soter, Themis, ThemisPP, Themis-JNI, and tests.

Use a more consistent approach for placing object files: all of them
go into $(OBJ_PATH) and get suffixed by ".o". This way allows us
to have a single common rule for building all C/C++ code:

  - src -> build/obj/src
  - jni -> build/obj/jni
  - tests -> build/obj/tests

Note however that in some cases we have to use different compiler
flags, mostly to setup proper header search paths. Use per-target
CFLAGS variable settings for that.
Using consistent object file placement allows us to simplify formatting
build rules in the same way. All marker files will not be placed in the
same place as object files.

This allows us to remove a lot of special cases and use common
formatting rules for all C/C++ code.

clang-format and clang-tidy require correct compilation flags.
Thankfully, CFLAGS values are already correctly set everywhere so we do
not need to do anything special for that. Though, JsThemis is a bit
special, because we do not compile it normally.
@ilammy ilammy added the infrastructure Automated building and packaging label Apr 9, 2019
Copy link
Contributor

@vixentael vixentael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

real magic ✨

@vixentael vixentael added the installation Installation of Themis core and wrapper packages label Apr 9, 2019
Copy link
Contributor

@shadinua shadinua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good.

@ilammy ilammy merged commit de3cbb7 into master Apr 10, 2019
@ilammy ilammy deleted the ilammy/common-rules branch April 10, 2019 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Automated building and packaging installation Installation of Themis core and wrapper packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants