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
Contributor

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.

ilammy added 2 commits Apr 4, 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 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 requested review from Lagovas, shadinua and vixentael as code owners Apr 9, 2019
Copy link
Member

vixentael left a comment

real magic

Copy link
Contributor

shadinua left a comment

Looks very good.

@ilammy ilammy merged commit de3cbb7 into master Apr 10, 2019
8 checks passed
8 checks passed
ci/bitrise/b32b4ea8bffedad7/push Passed - themis
Details
ci/circleci: analyze Your tests passed on CircleCI!
Details
ci/circleci: android Your tests passed on CircleCI!
Details
ci/circleci: integration_tests Your tests passed on CircleCI!
Details
ci/circleci: php5 Your tests passed on CircleCI!
Details
ci/circleci: php70 Your tests passed on CircleCI!
Details
ci/circleci: php71 Your tests passed on CircleCI!
Details
ci/circleci: x86_64 Your tests passed on CircleCI!
Details
@ilammy ilammy deleted the ilammy/common-rules branch Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.