Skip to content

Rewrite the plain Makefile, add GoogleTest support#1276

Merged
johnbartholomew merged 4 commits intogoogle:masterfrom
johnbartholomew:gtest-all
Feb 8, 2026
Merged

Rewrite the plain Makefile, add GoogleTest support#1276
johnbartholomew merged 4 commits intogoogle:masterfrom
johnbartholomew:gtest-all

Conversation

@johnbartholomew
Copy link
Collaborator

In particular:

  • The (system) GoogleTest library is found using pkg-config. If it's not found, those tests will be skipped (as they are already).
  • Test binaries are built, and have RPATH set to $ORIGIN so they can find the locally built libjsonnet.so without LD_LIBRARY_PATH= shenanigans.
  • Object files are moved in a .makebuild/ directory to keep them separate from the code tree (for cleanliness).
  • Dependencies are discovered during normal compilation instead of using a separate depends step.
  • Makefile variables are cleaned up a bit.
  • The use of the od command from the environment is dropped, instead the Makefile builds and uses the to_c_array program (which is how the CMakeLists and Bazel builds already work)
  • Instead of grep|cut|sed to extract the version number, a single sed command is used.
  • tests.sh now executes the GoogleTest tests as well (if those test binaries exist).

In particular:

* The (system) GoogleTest library is found using pkg-config.
* Test binaries are built.
* Object files are put in a .makebuild/ directory to keep them
  separate from the code tree (for cleanliness)
* Dependencies are discovered during normal compilation instead of
  using a separate depends step.
* Variables are cleaned up a bit.
* The use of the `od` command from the environment is dropped, instead
  the Makefile builds and uses the to_c_array program (which is how
	the CMakeLists and Bazel builds already work)
* Instead of grep|cut|sed to extract the version number, a single
  `sed` command is used.
* The test binaries have their rpath set to $ORIGIN so that they
  can find the local libjsonnet.so where they are without
	LD_LIBRARY_PATH shenanigans.
* tests.sh now executes the GoogleTest tests as well
Not everyone will have it installed; if it's missing then just skip those tests.
Unless the user tells us to use it, in which case abort.
Also, warn if it's missing, unless the user tells us _not_ to use it.
@johnbartholomew johnbartholomew marked this pull request as ready for review February 8, 2026 22:31
@johnbartholomew johnbartholomew merged commit eee9ff6 into google:master Feb 8, 2026
23 checks passed
@johnbartholomew johnbartholomew deleted the gtest-all branch February 8, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant