提供基本的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.

213 lines
6.9 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. CC = g++
  5. #-----------------------------------------------
  6. # Uncomment exactly one of the lines labelled (A), (B), and (C) below
  7. # to switch between compilation modes.
  8. OPT ?= -O2 -DNDEBUG # (A) Production use (optimized mode)
  9. # OPT ?= -g2 # (B) Debug mode, w/ full line-level debugging symbols
  10. # OPT ?= -O2 -g2 -DNDEBUG # (C) Profiling mode: opt, but w/debugging symbols
  11. #-----------------------------------------------
  12. # detect what platform we're building on
  13. $(shell sh ./build_detect_platform)
  14. # this file is generated by build_detect_platform to set build flags
  15. include build_config.mk
  16. # If Snappy is installed, add compilation and linker flags
  17. # (see http://code.google.com/p/snappy/)
  18. ifeq ($(SNAPPY), 1)
  19. SNAPPY_CFLAGS=-DSNAPPY
  20. SNAPPY_LDFLAGS=-lsnappy
  21. else
  22. SNAPPY_CFLAGS=
  23. SNAPPY_LDFLAGS=
  24. endif
  25. # If Google Perf Tools are installed, add compilation and linker flags
  26. # (see http://code.google.com/p/google-perftools/)
  27. ifeq ($(GOOGLE_PERFTOOLS), 1)
  28. GOOGLE_PERFTOOLS_LDFLAGS=-ltcmalloc
  29. else
  30. GOOGLE_PERFTOOLS_LDFLAGS=
  31. endif
  32. CFLAGS = -c -I. -I./include $(PORT_CFLAGS) $(PLATFORM_CFLAGS) $(OPT) $(SNAPPY_CFLAGS)
  33. LDFLAGS += $(PLATFORM_LDFLAGS) $(SNAPPY_LDFLAGS) $(GOOGLE_PERFTOOLS_LDFLAGS)
  34. LIBOBJECTS = \
  35. ./db/builder.o \
  36. ./db/c.o \
  37. ./db/db_impl.o \
  38. ./db/db_iter.o \
  39. ./db/filename.o \
  40. ./db/dbformat.o \
  41. ./db/log_reader.o \
  42. ./db/log_writer.o \
  43. ./db/memtable.o \
  44. ./db/repair.o \
  45. ./db/table_cache.o \
  46. ./db/version_edit.o \
  47. ./db/version_set.o \
  48. ./db/write_batch.o \
  49. ./port/port_posix.o \
  50. ./table/block.o \
  51. ./table/block_builder.o \
  52. ./table/format.o \
  53. ./table/iterator.o \
  54. ./table/merger.o \
  55. ./table/table.o \
  56. ./table/table_builder.o \
  57. ./table/two_level_iterator.o \
  58. ./util/arena.o \
  59. ./util/cache.o \
  60. ./util/coding.o \
  61. ./util/comparator.o \
  62. ./util/crc32c.o \
  63. ./util/env.o \
  64. ./util/env_posix.o \
  65. ./util/hash.o \
  66. ./util/histogram.o \
  67. ./util/logging.o \
  68. ./util/options.o \
  69. ./util/status.o
  70. TESTUTIL = ./util/testutil.o
  71. TESTHARNESS = ./util/testharness.o $(TESTUTIL)
  72. TESTS = \
  73. arena_test \
  74. c_test \
  75. cache_test \
  76. coding_test \
  77. corruption_test \
  78. crc32c_test \
  79. db_test \
  80. dbformat_test \
  81. env_test \
  82. filename_test \
  83. log_test \
  84. memenv_test \
  85. skiplist_test \
  86. table_test \
  87. version_edit_test \
  88. version_set_test \
  89. write_batch_test
  90. PROGRAMS = db_bench $(TESTS)
  91. BENCHMARKS = db_bench_sqlite3 db_bench_tree_db
  92. LIBRARY = libleveldb.a
  93. MEMENVLIBRARY = libmemenv.a
  94. all: $(LIBRARY)
  95. check: $(PROGRAMS) $(TESTS)
  96. for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done
  97. clean:
  98. -rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o
  99. -rm -rf ios-x86/* ios-arm/*
  100. -rm build_config.mk
  101. $(LIBRARY): $(LIBOBJECTS)
  102. rm -f $@
  103. $(AR) -rs $@ $(LIBOBJECTS)
  104. db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
  105. $(CC) $(LDFLAGS) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@
  106. db_bench_sqlite3: doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL)
  107. $(CC) $(LDFLAGS) -lsqlite3 doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL) -o $@
  108. db_bench_tree_db: doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL)
  109. $(CC) $(LDFLAGS) -lkyotocabinet doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL) -o $@
  110. arena_test: util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS)
  111. $(CC) $(LDFLAGS) util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  112. c_test: db/c_test.o $(LIBOBJECTS) $(TESTHARNESS)
  113. $(CC) $(LDFLAGS) db/c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  114. cache_test: util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS)
  115. $(CC) $(LDFLAGS) util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  116. coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS)
  117. $(CC) $(LDFLAGS) util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  118. corruption_test: db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS)
  119. $(CC) $(LDFLAGS) db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  120. crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS)
  121. $(CC) $(LDFLAGS) util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  122. db_test: db/db_test.o $(LIBOBJECTS) $(TESTHARNESS)
  123. $(CC) $(LDFLAGS) db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  124. dbformat_test: db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS)
  125. $(CC) $(LDFLAGS) db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  126. env_test: util/env_test.o $(LIBOBJECTS) $(TESTHARNESS)
  127. $(CC) $(LDFLAGS) util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  128. filename_test: db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS)
  129. $(CC) $(LDFLAGS) db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  130. log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS)
  131. $(CC) $(LDFLAGS) db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  132. table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS)
  133. $(CC) $(LDFLAGS) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  134. skiplist_test: db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS)
  135. $(CC) $(LDFLAGS) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  136. version_edit_test: db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS)
  137. $(CC) $(LDFLAGS) db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  138. version_set_test: db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS)
  139. $(CC) $(LDFLAGS) db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  140. write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS)
  141. $(CC) $(LDFLAGS) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  142. $(MEMENVLIBRARY) : helpers/memenv/memenv.o
  143. rm -f $@
  144. $(AR) -rs $@ helpers/memenv/memenv.o
  145. memenv_test : helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS)
  146. $(CC) $(LDFLAGS) helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS) -o $@
  147. ifeq ($(PLATFORM), IOS)
  148. # For iOS, create universal object files to be used on both the simulator and
  149. # a device.
  150. SIMULATORROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer
  151. DEVICEROOT=/Developer/Platforms/iPhoneOS.platform/Developer
  152. IOSVERSION=$(shell defaults read /Developer/Platforms/iPhoneOS.platform/version CFBundleShortVersionString)
  153. .cc.o:
  154. mkdir -p ios-x86/$(dir $@)
  155. $(SIMULATORROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 $< -o ios-x86/$@
  156. mkdir -p ios-arm/$(dir $@)
  157. $(DEVICEROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 $< -o ios-arm/$@
  158. lipo ios-x86/$@ ios-arm/$@ -create -output $@
  159. .c.o:
  160. mkdir -p ios-x86/$(dir $@)
  161. $(SIMULATORROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 $< -o ios-x86/$@
  162. mkdir -p ios-arm/$(dir $@)
  163. $(DEVICEROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 $< -o ios-arm/$@
  164. lipo ios-x86/$@ ios-arm/$@ -create -output $@
  165. else
  166. .cc.o:
  167. $(CC) $(CFLAGS) $< -o $@
  168. .c.o:
  169. $(CC) $(CFLAGS) $< -o $@
  170. endif