10225501448 李度 10225101546 陈胤遒 10215501422 高宇菲
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

163 satır
5.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. CXX ?= g++
  5. CC ?= gcc
  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 sh ./build_detect_platform)
  15. # this file is generated by build_detect_platform to set build flags and sources
  16. include build_config.mk
  17. CFLAGS += -c -I. -I./include $(PLATFORM_CCFLAGS) $(OPT)
  18. CXXFLAGS += -c -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. c_test \
  27. cache_test \
  28. coding_test \
  29. corruption_test \
  30. crc32c_test \
  31. db_test \
  32. dbformat_test \
  33. env_test \
  34. filename_test \
  35. log_test \
  36. memenv_test \
  37. skiplist_test \
  38. table_test \
  39. version_edit_test \
  40. version_set_test \
  41. write_batch_test
  42. PROGRAMS = db_bench $(TESTS)
  43. BENCHMARKS = db_bench_sqlite3 db_bench_tree_db
  44. LIBRARY = libleveldb.a
  45. MEMENVLIBRARY = libmemenv.a
  46. all: $(LIBRARY)
  47. check: $(PROGRAMS) $(TESTS)
  48. for t in $(TESTS); do echo "***** Running $$t"; ./$$t || exit 1; done
  49. clean:
  50. -rm -f $(PROGRAMS) $(BENCHMARKS) $(LIBRARY) $(MEMENVLIBRARY) */*.o */*/*.o ios-x86/*/*.o ios-arm/*/*.o
  51. -rm -rf ios-x86/* ios-arm/*
  52. -rm build_config.mk
  53. $(LIBRARY): $(LIBOBJECTS)
  54. rm -f $@
  55. $(AR) -rs $@ $(LIBOBJECTS)
  56. db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
  57. $(CXX) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LDFLAGS)
  58. db_bench_sqlite3: doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL)
  59. $(CXX) doc/bench/db_bench_sqlite3.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LDFLAGS) -lsqlite3
  60. db_bench_tree_db: doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL)
  61. $(CXX) doc/bench/db_bench_tree_db.o $(LIBOBJECTS) $(TESTUTIL) -o $@ $(LDFLAGS) -lkyotocabinet
  62. arena_test: util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS)
  63. $(CXX) util/arena_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  64. c_test: db/c_test.o $(LIBOBJECTS) $(TESTHARNESS)
  65. $(CXX) db/c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  66. cache_test: util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS)
  67. $(CXX) util/cache_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  68. coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS)
  69. $(CXX) util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  70. corruption_test: db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS)
  71. $(CXX) db/corruption_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  72. crc32c_test: util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS)
  73. $(CXX) util/crc32c_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  74. db_test: db/db_test.o $(LIBOBJECTS) $(TESTHARNESS)
  75. $(CXX) db/db_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  76. dbformat_test: db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS)
  77. $(CXX) db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  78. env_test: util/env_test.o $(LIBOBJECTS) $(TESTHARNESS)
  79. $(CXX) util/env_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  80. filename_test: db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS)
  81. $(CXX) db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  82. log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS)
  83. $(CXX) db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  84. table_test: table/table_test.o $(LIBOBJECTS) $(TESTHARNESS)
  85. $(CXX) table/table_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  86. skiplist_test: db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS)
  87. $(CXX) db/skiplist_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  88. version_edit_test: db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS)
  89. $(CXX) db/version_edit_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  90. version_set_test: db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS)
  91. $(CXX) db/version_set_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  92. write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS)
  93. $(CXX) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) -o $@ $(LDFLAGS)
  94. $(MEMENVLIBRARY) : $(MEMENVOBJECTS)
  95. rm -f $@
  96. $(AR) -rs $@ $(MEMENVOBJECTS)
  97. memenv_test : helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS)
  98. $(CXX) helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHARNESS) -o $@ $(LDFLAGS)
  99. ifeq ($(PLATFORM), IOS)
  100. # For iOS, create universal object files to be used on both the simulator and
  101. # a device.
  102. SIMULATORROOT=/Developer/Platforms/iPhoneSimulator.platform/Developer
  103. DEVICEROOT=/Developer/Platforms/iPhoneOS.platform/Developer
  104. IOSVERSION=$(shell defaults read /Developer/Platforms/iPhoneOS.platform/version CFBundleShortVersionString)
  105. .cc.o:
  106. mkdir -p ios-x86/$(dir $@)
  107. $(SIMULATORROOT)/usr/bin/$(CXX) $(CXXFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 $< -o ios-x86/$@
  108. mkdir -p ios-arm/$(dir $@)
  109. $(DEVICEROOT)/usr/bin/$(CXX) $(CXXFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 $< -o ios-arm/$@
  110. lipo ios-x86/$@ ios-arm/$@ -create -output $@
  111. .c.o:
  112. mkdir -p ios-x86/$(dir $@)
  113. $(SIMULATORROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 $< -o ios-x86/$@
  114. mkdir -p ios-arm/$(dir $@)
  115. $(DEVICEROOT)/usr/bin/$(CC) $(CFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk -arch armv6 -arch armv7 $< -o ios-arm/$@
  116. lipo ios-x86/$@ ios-arm/$@ -create -output $@
  117. else
  118. .cc.o:
  119. $(CXX) $(CXXFLAGS) $< -o $@
  120. .c.o:
  121. $(CC) $(CFLAGS) $< -o $@
  122. endif