10225501448 李度 10225101546 陈胤遒 10215501422 高宇菲
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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