提供基本的ttl测试用例
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

214 lines
7.8 KiB

  1. # Copyright (c) 2011 The LevelDB Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file. See the AUTHORS file for names of contributors.
  4. #-----------------------------------------------
  5. # Uncomment exactly one of the lines labelled (A), (B), and (C) below
  6. # to switch between compilation modes.
  7. OPT ?= -O2 -DNDEBUG # (A) Production use (optimized mode)
  8. # OPT ?= -g2 # (B) Debug mode, w/ full line-level debugging symbols
  9. # OPT ?= -O2 -g2 -DNDEBUG # (C) Profiling mode: opt, but w/debugging symbols
  10. #-----------------------------------------------
  11. # detect what platform we're building on
  12. $(shell CC="$(CC)" CXX="$(CXX)" TARGET_OS="$(TARGET_OS)" \
  13. ./build_detect_platform build_config.mk ./)
  14. # this file is generated by the previous line to set build flags and sources
  15. include build_config.mk
  16. CFLAGS += -I. -I./include $(PLATFORM_CCFLAGS) $(OPT)
  17. CXXFLAGS += -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT)
  18. LDFLAGS += $(PLATFORM_LDFLAGS)
  19. LIBS += $(PLATFORM_LIBS)
  20. LIBOBJECTS = $(SOURCES:.cc=.o)
  21. MEMENVOBJECTS = $(MEMENV_SOURCES:.cc=.o)
  22. TESTUTIL = ./util/testutil.o
  23. TESTHARNESS = ./util/testharness.o $(TESTUTIL)
  24. TESTS = \
  25. arena_test \
  26. autocompact_test \
  27. bloom_test \
  28. c_test \
  29. cache_test \
  30. coding_test \
  31. corruption_test \
  32. crc32c_test \
  33. db_test \
  34. dbformat_test \
  35. env_test \
  36. filename_test \
  37. filter_block_test \
  38. issue178_test \
  39. issue200_test \
  40. log_test \
  41. memenv_test \
  42. skiplist_test \
  43. table_test \
  44. version_edit_test \
  45. version_set_test \
  46. write_batch_test
  47. PROGRAMS = db_bench leveldbutil $(TESTS)
  48. BENCHMARKS = db_bench_sqlite3 db_bench_tree_db
  49. LIBRARY = libleveldb.a
  50. MEMENVLIBRARY = libmemenv.a
  51. default: all
  52. # Should we build shared libraries?
  53. ifneq ($(PLATFORM_SHARED_EXT),)
  54. ifneq ($(PLATFORM_SHARED_VERSIONED),true)
  55. SHARED1 = libleveldb.$(PLATFORM_SHARED_EXT)
  56. SHARED2 = $(SHARED1)
  57. SHARED3 = $(SHARED1)
  58. SHARED = $(SHARED1)
  59. else
  60. # Update db.h if you change these.
  61. SHARED_MAJOR = 1
  62. SHARED_MINOR = 16
  63. SHARED1 = libleveldb.$(PLATFORM_SHARED_EXT)
  64. SHARED2 = $(SHARED1).$(SHARED_MAJOR)
  65. SHARED3 = $(SHARED1).$(SHARED_MAJOR).$(SHARED_MINOR)
  66. SHARED = $(SHARED1) $(SHARED2) $(SHARED3)
  67. $(SHARED1): $(SHARED3)
  68. ln -fs $(SHARED3) $(SHARED1)
  69. $(SHARED2): $(SHARED3)
  70. ln -fs $(SHARED3) $(SHARED2)
  71. endif
  72. $(SHARED3):
  73. $(CXX) $(LDFLAGS) $(PLATFORM_SHARED_LDFLAGS)$(SHARED2) $(CXXFLAGS) $(PLATFORM_SHARED_CFLAGS) $(SOURCES) -o $(SHARED3) $(LIBS)
  74. endif # PLATFORM_SHARED_EXT
  75. all: $(SHARED) $(LIBRARY)
  76. check: all $(PROGRAMS) $(TESTS)
  77. for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done
  78. clean:
  79. -rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(SHARED) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o build_config.mk
  80. -rm -rf ios-x86/* ios-arm/*
  81. $(LIBRARY): $(LIBOBJECTS)
  82. rm -f $@
  83. $(AR) -rs $@ $(LIBOBJECTS)
  84. db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
  85. $(CXX) $(LDFLAGS) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LIBS)
  86. db_bench_sqlite3: doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL)
  87. $(CXX) $(LDFLAGS) doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL) -o $@ -lsqlite3 $(LIBS)
  88. db_bench_tree_db: doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL)
  89. $(CXX) $(LDFLAGS) doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL) -o $@ -lkyotocabinet $(LIBS)
  90. leveldbutil: db/leveldb_main.o $(LIBOBJECTS)
  91. $(CXX) $(LDFLAGS) db/leveldb_main.o $(LIBOBJECTS) -o $@ $(LIBS)
  92. arena_test: util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS)
  93. $(CXX) $(LDFLAGS) util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  94. autocompact_test: db/autocompact_test.o $(LIBOBJECTS) $(TESTHARNESS)
  95. $(CXX) $(LDFLAGS) db/autocompact_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  96. bloom_test: util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS)
  97. $(CXX) $(LDFLAGS) util/bloom_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  98. c_test: db/c_test.o $(LIBOBJECTS) $(TESTHARNESS)
  99. $(CXX) $(LDFLAGS) db/c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  100. cache_test: util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS)
  101. $(CXX) $(LDFLAGS) util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  102. coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS)
  103. $(CXX) $(LDFLAGS) util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  104. corruption_test: db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS)
  105. $(CXX) $(LDFLAGS) db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  106. crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS)
  107. $(CXX) $(LDFLAGS) util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  108. db_test: db/db_test.o $(LIBOBJECTS) $(TESTHARNESS)
  109. $(CXX) $(LDFLAGS) db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  110. dbformat_test: db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS)
  111. $(CXX) $(LDFLAGS) db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  112. env_test: util/env_test.o $(LIBOBJECTS) $(TESTHARNESS)
  113. $(CXX) $(LDFLAGS) util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  114. filename_test: db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS)
  115. $(CXX) $(LDFLAGS) db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  116. filter_block_test: table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS)
  117. $(CXX) $(LDFLAGS) table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  118. issue178_test: issues/issue178_test.o $(LIBOBJECTS) $(TESTHARNESS)
  119. $(CXX) $(LDFLAGS) issues/issue178_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  120. issue200_test: issues/issue200_test.o $(LIBOBJECTS) $(TESTHARNESS)
  121. $(CXX) $(LDFLAGS) issues/issue200_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  122. log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS)
  123. $(CXX) $(LDFLAGS) db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  124. table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS)
  125. $(CXX) $(LDFLAGS) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  126. skiplist_test: db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS)
  127. $(CXX) $(LDFLAGS) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  128. version_edit_test: db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS)
  129. $(CXX) $(LDFLAGS) db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  130. version_set_test: db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS)
  131. $(CXX) $(LDFLAGS) db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  132. write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS)
  133. $(CXX) $(LDFLAGS) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LIBS)
  134. $(MEMENVLIBRARY) : $(MEMENVOBJECTS)
  135. rm -f $@
  136. $(AR) -rs $@ $(MEMENVOBJECTS)
  137. memenv_test : helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS)
  138. $(CXX) $(LDFLAGS) helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS) -o $@ $(LIBS)
  139. ifeq ($(PLATFORM), IOS)
  140. # For iOS, create universal object files to be used on both the simulator and
  141. # a device.
  142. PLATFORMSROOT=/Applications/Xcode.app/Contents/Developer/Platforms
  143. SIMULATORROOT=$(PLATFORMSROOT)/iPhoneSimulator.platform/Developer
  144. DEVICEROOT=$(PLATFORMSROOT)/iPhoneOS.platform/Developer
  145. IOSVERSION=$(shell defaults read $(PLATFORMSROOT)/iPhoneOS.platform/version CFBundleShortVersionString)
  146. .cc.o:
  147. mkdir -p ios-x86/$(dir $@)
  148. $(CXX) $(CXXFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 -c $< -o ios-x86/$@
  149. mkdir -p ios-arm/$(dir $@)
  150. xcrun -sdk iphoneos $(CXX) $(CXXFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 -c $< -o ios-arm/$@
  151. lipo ios-x86/$@ ios-arm/$@ -create -output $@
  152. .c.o:
  153. mkdir -p ios-x86/$(dir $@)
  154. $(CC) $(CFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 -c $< -o ios-x86/$@
  155. mkdir -p ios-arm/$(dir $@)
  156. xcrun -sdk iphoneos $(CC) $(CFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 -c $< -o ios-arm/$@
  157. lipo ios-x86/$@ ios-arm/$@ -create -output $@
  158. else
  159. .cc.o:
  160. $(CXX) $(CXXFLAGS) -c $< -o $@
  161. .c.o:
  162. $(CC) $(CFLAGS) -c $< -o $@
  163. endif