Record the version of the source repository that was used to build the leveldb library.

Summary: Record the version of the source that we are compiling. We keep a record of the git revision in util/version.cc. This source file is then built as a regular source file as part of the compilation process. One can run "strings executable_filename | grep _build_" to find the version of the source that we used to build the executable file.

Test Plan: none

Differential Revision: https://reviews.facebook.net/D4785
main
Dhruba Borthakur 12 years ago committed by heyongqiang
parent d41316bc0f
commit 5d96f290b3
  1. 4
      Makefile
  2. 1
      build_detect_version

@ -87,7 +87,6 @@ $(SHARED1): $(SHARED3)
ln -fs $(SHARED3) $(SHARED1) ln -fs $(SHARED3) $(SHARED1)
endif endif
all: $(VERSIONFILE) $(SHARED) $(LIBRARY) $(THRIFTSERVER) $(TOOLS) all: $(VERSIONFILE) $(SHARED) $(LIBRARY) $(THRIFTSERVER) $(TOOLS)
check: all $(PROGRAMS) $(TESTS) $(TOOLS) check: all $(PROGRAMS) $(TESTS) $(TOOLS)
@ -200,6 +199,9 @@ $(VERSIONFILE): build_detect_version
filelock_test: util/filelock_test.o $(LIBOBJECTS) $(TESTHARNESS) filelock_test: util/filelock_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(CXX) util/filelock_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS) $(CXX) util/filelock_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
# recreate the version file with the latest git revision
$(VERSIONFILE): build_detect_version
$(shell ./build_detect_platform build_config.mk)
ifeq ($(PLATFORM), IOS) ifeq ($(PLATFORM), IOS)
# For iOS, create universal object files to be used on both the simulator and # For iOS, create universal object files to be used on both the simulator and

@ -22,4 +22,3 @@ fi
date | awk 'BEGIN {} {print "const char * leveldb_build_git_datetime = \"leveldb_build_git_datetime:"$0"\";"} END {} ' >> ${VFILE} date | awk 'BEGIN {} {print "const char * leveldb_build_git_datetime = \"leveldb_build_git_datetime:"$0"\";"} END {} ' >> ${VFILE}
echo "const char * leveldb_build_compile_date = __DATE__;" >> ${VFILE} echo "const char * leveldb_build_compile_date = __DATE__;" >> ${VFILE}
echo "const char * leveldb_build_compile_time = __TIME__;" >> ${VFILE} echo "const char * leveldb_build_compile_time = __TIME__;" >> ${VFILE}

Loading…
Cancel
Save