10225501448 李度 10225101546 陈胤遒 10215501422 高宇菲
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

172 行
5.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. 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. UNAME := $(shell uname)
  13. ifeq ($(UNAME), Darwin)
  14. # To build for iOS, set PLATFORM=IOS.
  15. ifndef PLATFORM
  16. PLATFORM=OSX
  17. endif # PLATFORM
  18. PLATFORM_CFLAGS = -DLEVELDB_PLATFORM_OSX
  19. PORT_MODULE = port_osx.o
  20. else # UNAME
  21. PLATFORM_CFLAGS = -DLEVELDB_PLATFORM_POSIX -std=c++0x
  22. PORT_MODULE = port_posix.o
  23. endif # UNAME
  24. CFLAGS = -c -I. -I./include $(PLATFORM_CFLAGS) $(OPT)
  25. LDFLAGS=-lpthread
  26. LIBOBJECTS = \
  27. ./db/builder.o \
  28. ./db/db_impl.o \
  29. ./db/db_iter.o \
  30. ./db/filename.o \
  31. ./db/dbformat.o \
  32. ./db/log_reader.o \
  33. ./db/log_writer.o \
  34. ./db/memtable.o \
  35. ./db/repair.o \
  36. ./db/table_cache.o \
  37. ./db/version_edit.o \
  38. ./db/version_set.o \
  39. ./db/write_batch.o \
  40. ./port/$(PORT_MODULE) \
  41. ./table/block.o \
  42. ./table/block_builder.o \
  43. ./table/format.o \
  44. ./table/iterator.o \
  45. ./table/merger.o \
  46. ./table/table.o \
  47. ./table/table_builder.o \
  48. ./table/two_level_iterator.o \
  49. ./util/arena.o \
  50. ./util/cache.o \
  51. ./util/coding.o \
  52. ./util/comparator.o \
  53. ./util/crc32c.o \
  54. ./util/env.o \
  55. ./util/env_posix.o \
  56. ./util/hash.o \
  57. ./util/histogram.o \
  58. ./util/logging.o \
  59. ./util/options.o \
  60. ./util/status.o
  61. TESTUTIL = ./util/testutil.o
  62. TESTHARNESS = ./util/testharness.o $(TESTUTIL)
  63. TESTS = \
  64. arena_test \
  65. cache_test \
  66. coding_test \
  67. corruption_test \
  68. crc32c_test \
  69. db_test \
  70. dbformat_test \
  71. env_test \
  72. filename_test \
  73. log_test \
  74. skiplist_test \
  75. table_test \
  76. version_edit_test \
  77. write_batch_test
  78. PROGRAMS = db_bench $(TESTS)
  79. LIBRARY = libleveldb.a
  80. ifeq ($(PLATFORM), IOS)
  81. # Only XCode can build executable applications for iOS.
  82. all: $(LIBRARY)
  83. else
  84. all: $(PROGRAMS) $(LIBRARY)
  85. endif
  86. check: $(TESTS)
  87. for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done
  88. clean:
  89. -rm -f $(PROGRAMS) $(LIBRARY) */*.o ios-x86/*/*.o ios-arm/*/*.o
  90. -rmdir -p ios-x86/* ios-arm/*
  91. $(LIBRARY): $(LIBOBJECTS)
  92. rm -f $@
  93. $(AR) -rs $@ $(LIBOBJECTS)
  94. db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
  95. $(CC) $(LDFLAGS) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@
  96. arena_test: util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS)
  97. $(CC) $(LDFLAGS) util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  98. cache_test: util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS)
  99. $(CC) $(LDFLAGS) util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  100. coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS)
  101. $(CC) $(LDFLAGS) util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  102. corruption_test: db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS)
  103. $(CC) $(LDFLAGS) db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  104. crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS)
  105. $(CC) $(LDFLAGS) util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  106. db_test: db/db_test.o $(LIBOBJECTS) $(TESTHARNESS)
  107. $(CC) $(LDFLAGS) db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  108. dbformat_test: db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS)
  109. $(CC) $(LDFLAGS) db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  110. env_test: util/env_test.o $(LIBOBJECTS) $(TESTHARNESS)
  111. $(CC) $(LDFLAGS) util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  112. filename_test: db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS)
  113. $(CC) $(LDFLAGS) db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  114. log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS)
  115. $(CC) $(LDFLAGS) db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  116. table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS)
  117. $(CC) $(LDFLAGS) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  118. skiplist_test: db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS)
  119. $(CC) $(LDFLAGS) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  120. version_edit_test: db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS)
  121. $(CC) $(LDFLAGS) db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  122. write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS)
  123. $(CC) $(LDFLAGS) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@
  124. ifeq ($(PLATFORM), IOS)
  125. # For iOS, create universal object files to be used on both the simulator and
  126. # a device.
  127. .cc.o:
  128. mkdir -p ios-x86/$(dir $@)
  129. $(CC) $(CFLAGS) -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -arch i686 $< -o ios-x86/$@
  130. mkdir -p ios-arm/$(dir $@)
  131. $(CC) $(CFLAGS) -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk -arch armv6 -arch armv7 $< -o ios-arm/$@
  132. lipo ios-x86/$@ ios-arm/$@ -create -output $@
  133. else
  134. .cc.o:
  135. $(CC) $(CFLAGS) $< -o $@
  136. endif
  137. # TODO(gabor): dependencies for .o files
  138. # TODO(gabor): Build library