Skip to content

mv make makeover

Matthew Von-Maszewski edited this page Jan 5, 2016 · 9 revisions

Status

  • merged to master -
  • code complete - January 5, 2016
  • development started - January 4, 2016

History / Context

Basho initially intended to use leveldb purely as a third-party storage library. There was no desire to invest for long term maintenance or development. Therefore there was no need to invest time in adapting Google's "build once" Makefile into something more appropriate to an active development usage model. Yet ongoing development kept creeping into various Riak release plans. This branch is an acknowledgement that Basho is going to continue to invest development time into Google's leveldb. This branch makes the following enhancements to the existing make process:

  • Create full dependency files to simplify rebuilds during development
  • Add explicit "debug" and "prof" targets to eliminate need to edit the Makefile (and accidentally check the modifications into git)
  • Produce the shared and static libraries from same object files to reduce make execution time
  • Build the test and tool executables build from libraries to reduce make execution time
  • Use static linking of snappy on Linux platforms for tools executables to simplify distribution of the tools with Riak

Branch Description

.gitignore

Have git ignore .d dependency files that this branch now generates on all platforms. Also have git ignore the .dSYM directories now generated on Mac IOS platforms.

Makefile

The Makefile automatically generates new .d dependency files for any source file or any of a source file's include files change. The build_detect_platform script contains a recent change that creates an ldb_config.h file. The ldb_config.h is a dependency of almost every source file. The Makefile previously executed the build_detect_platform script upon every execution. build_detect_platform would therefore create a new db_config.h upon every execution. The new db_config.h would cause every file in the system to rebuild upon every execution. The "ifeq ($(wildcard build_config.mk),)" line makes the execution of build_detect_platform conditional. The script only executes if its prime output, build_config.mk, does not exists. This ends the continual rebuild loop.

The "if ($PLATFORM),OS_LINUX)" line adjusts the linker flags to use static libraries when building on Linux. The syntax used is not supported on OS X and no other non-Linux platforms received testing. So the static library usage is therefore limited to Linux builds which comprise the majority of Riak distributions. This change is only to facilitate easier use of Basho provided leveldb tools. It is not essential to the use of leveldb itself.

The "$(SHARED3)" recipe (construction rule)

Clone this wiki locally