Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. projectpath = ${CURDIR}
  2. libuv_path = ${projectpath}/lib/libuv
  3. wrk_path = ${projectpath}/lib/wrk
  4. wrk2_path = ${projectpath}/lib/wrk2
  5. sds_path = ${projectpath}/lib/sds
  6. rapidjson_path = ${projectpath}/lib/rapidjson
  7. lockless_path = ${projectpath}/lib/lockless_allocator
  8. tcmalloc_path = ${projectpath}/lib/tcmalloc
  9. ifeq ($(OS),Windows_NT)
  10. OPERATING_SYSTEM = WINDOWS
  11. CCFLAGS += -D WIN32
  12. ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
  13. CCFLAGS += -D AMD64
  14. else
  15. ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
  16. CCFLAGS += -D AMD64
  17. endif
  18. ifeq ($(PROCESSOR_ARCHITECTURE),x86)
  19. CCFLAGS += -D IA32
  20. endif
  21. endif
  22. else
  23. UNAME_S := $(shell uname -s)
  24. ifeq ($(UNAME_S),Linux)
  25. OPERATING_SYSTEM = LINUX
  26. PLATFORM_TARGET = linux
  27. CCFLAGS += -D LINUX
  28. endif
  29. ifeq ($(UNAME_S),Darwin)
  30. OPERATING_SYSTEM = OSX
  31. PLATFORM_TARGET = osx
  32. CCFLAGS += -D OSX
  33. endif
  34. UNAME_P := $(shell uname -p)
  35. ifeq ($(UNAME_P),x86_64)
  36. CCFLAGS += -D AMD64
  37. endif
  38. ifneq ($(filter %86,$(UNAME_P)),)
  39. CCFLAGS += -D IA32
  40. endif
  41. ifneq ($(filter arm%,$(UNAME_P)),)
  42. CCFLAGS += -D ARM
  43. endif
  44. endif
  45. all: deps $(PLATFORM_TARGET)
  46. target: all
  47. osx: deps
  48. if [ ! -d "build" ]; then mkdir -p build; fi
  49. if [ ! -d "build/Makefile" ]; then cd build;cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 ..; fi
  50. cmake --build ./build --target all --config Debug -- -j 10
  51. xcode: deps
  52. if [ ! -d "build" ]; then mkdir -p build; fi
  53. if [ ! -d "build/octane.xcodeproj" ]; then cd build;cmake -DCMAKE_OSX_ARCHITECTURES=x86_64 -G Xcode ..; fi
  54. cd build;xcodebuild -project octane.xcodeproj/
  55. linux: deps $(lockless_path)
  56. rm -rf build
  57. mkdir -p build
  58. cd build;cmake ..
  59. cd build;make VERBOSE=1
  60. $(libuv_path)/.libs/libuv.a:
  61. if [ ! -d "$(libuv_path)" ]; then git clone https://github.com/libuv/libuv.git $(libuv_path); fi
  62. cd $(libuv_path);sh autogen.sh
  63. cd $(libuv_path);./configure
  64. cd $(libuv_path);make
  65. $(wrk_path)/wrk:
  66. if [ ! -d "$(wrk_path)" ]; then git clone https://github.com/wg/wrk.git $(wrk_path); fi
  67. cd $(wrk_path);make
  68. $(wrk2_path)/wrk:
  69. if [ ! -d "$(wrk2_path)" ]; then git clone https://github.com/giltene/wrk2.git $(wrk2_path); fi
  70. cd $(wrk2_path);make
  71. $(sds_path):
  72. if [ ! -d "$(sds_path)" ]; then git clone https://github.com/antirez/sds $(sds_path); fi
  73. $(rapidjson_path):
  74. if [ ! -d "$(rapidjson_path)" ]; then git clone https://github.com/miloyip/rapidjson.git $(rapidjson_path); fi
  75. $(tcmalloc_path):
  76. if [ ! -d "$(tcmalloc_path)" ]; then git clone https://github.com/gperftools/gperftools.git $(tcmalloc_path); fi
  77. cd $(tcmalloc_path);./autogen.sh
  78. cd $(tcmalloc_path);./configure
  79. cd $(tcmalloc_path);make
  80. $(lockless_path):
  81. if [ ! -d "$(lockless_path)" ]; then wget -q https://locklessinc.com/downloads/lockless_allocator_src.tgz -P lib; fi
  82. cd lib;tar xvzf lockless_allocator_src.tgz
  83. cd lib/lockless_allocator;make
  84. tools: $(wrk_path)/wrk $(wrk2_path)/wrk
  85. deps: $(libuv_path)/.libs/libuv.a $(sds_path) $(rapidjson_path) $(tcmalloc_path)