Tarantool nginx upstream module
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.

Makefile 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. CUR_PATH = $(shell pwd)
  2. YAJL_PATH = $(CUR_PATH)/third_party/yajl
  3. NGX_PATH = $(CUR_PATH)/nginx
  4. MODULE_PATH = $(CUR_PATH)
  5. PREFIX_PATH = $(CUR_PATH)/test-root
  6. NGX_CONFIGURE = ./auto/configure
  7. ## Some versions of nginx have different path of the configure,
  8. ## following lines are handle it {{
  9. ifeq ($(shell [ -e "$(NGX_PATH)/configure" ] && echo 1 || echo 0 ), 1)
  10. NGX_CONFIGURE=./configure
  11. endif
  12. ## }}
  13. MODULE_PATH = $(CUR_PATH)
  14. PREFIX_PATH = $(CUR_PATH)/test-root
  15. INC_FLAGS = -I$(CUR_PATH)/third_party
  16. INC_FLAGS += -I$(YAJL_PATH)/build/yajl-2.1.0/include
  17. INC_FLAGS += -I$(CUR_PATH)/third_party/msgpuck
  18. INC_FLAGS += -I$(CUR_PATH)/src
  19. YAJL_LIB = $(YAJL_PATH)/build/yajl-2.1.0/lib/libyajl_s.a
  20. LDFLAGS = -L$(YAJL_PATH)/build/yajl-2.1.0/lib
  21. LDFLAGS += -L$(MODULE_PATH)/third_party/msgpuck
  22. PREFIX = /usr/local/nginx
  23. DEV_CFLAGS += -ggdb3 -O0 -Wall -Werror
  24. .PHONY: all build
  25. all: build
  26. yajl:
  27. ln -sf src third_party/yajl/yajl
  28. cd $(YAJL_PATH); ./configure; make distro
  29. msgpack:
  30. cd $(MODULE_PATH)/third_party/msgpuck && \
  31. cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo . && \
  32. make && \
  33. cd -
  34. gen_version:
  35. $(shell cat $(MODULE_PATH)/src/ngx_http_tnt_version.h.in | sed 's/@VERSION_STRING@/"$(shell git describe --tags --dirty)"/g' > $(MODULE_PATH)/src/ngx_http_tnt_version.h)
  36. build: gen_version utils
  37. $(MAKE) -C $(NGX_PATH)
  38. __install:
  39. cd $(NGX_PATH) && $(NGX_CONFIGURE) \
  40. --with-cc-opt='$(INC_FLAGS)' \
  41. --add-module='$(MODULE_PATH)' \
  42. --prefix=$(PREFIX)
  43. make -j2
  44. sudo mkdir -p $(PREFIX)/conf $(PREFIX)/logs $(PREFIX)/sbin
  45. sudo cp -Rf $(NGX_PATH)/conf/* $(PREFIX)/conf
  46. sudo cp $(NGX_PATH)/objs/nginx $(PREFIX)/sbin/nginx
  47. configure-as-dynamic:
  48. cd $(NGX_PATH) && $(NGX_CONFIGURE) --add-dynamic-module='$(MODULE_PATH)'
  49. configure-debug:
  50. cd $(NGX_PATH) && \
  51. CFLAGS="$(DEV_CFLAGS)" $(NGX_CONFIGURE) \
  52. --prefix=$(PREFIX_PATH) \
  53. --with-http_addition_module \
  54. --add-module=$(MODULE_PATH) \
  55. --with-debug
  56. configure-for-testing: configure-debug
  57. mkdir -p $(PREFIX_PATH)/conf $(PREFIX_PATH)/logs
  58. cp -Rf $(NGX_PATH)/conf/* $(PREFIX_PATH)/conf
  59. cp -f $(CUR_PATH)/test/ngx_confs/tnt_server_test.conf $(PREFIX_PATH)/conf/tnt_server_test.conf
  60. cp -f $(CUR_PATH)/test/ngx_confs/nginx.dev.conf $(PREFIX_PATH)/conf/nginx.conf
  61. configure-as-dynamic-debug:
  62. cd $(NGX_PATH) && \
  63. CFLAGS="$(DEV_CFLAGS)" $(NGX_CONFIGURE) \
  64. --prefix=$(PREFIX_PATH) \
  65. --add-dynamic-module=$(MODULE_PATH) \
  66. --with-debug
  67. mkdir -p $(PREFIX_PATH)/conf $(PREFIX_PATH)/logs $(PREFIX_PATH)/modules
  68. cp -Rf $(NGX_PATH)/conf/* $(PREFIX_PATH)/conf
  69. cp -f $(CUR_PATH)/test/ngx_confs/nginx.dev.dyn.conf $(PREFIX_PATH)/conf/nginx.conf
  70. cp -f $(CUR_PATH)/test/ngx_confs/tnt_server_test.conf $(PREFIX_PATH)/conf/tnt_server_test.conf
  71. json2tp:
  72. $(CC) $(CFLAGS) $(DEV_CFLAGS) $(INC_FLAGS) $(LDFLAGS)\
  73. $(CUR_PATH)/misc/json2tp.c \
  74. src/json_encoders.c \
  75. src/tp_transcode.c \
  76. -o misc/json2tp \
  77. -lyajl_s \
  78. -lmsgpuck
  79. tp_dump:
  80. $(CC) $(CFLAGS) $(DEV_CFLAGS) $(INC_FLAGS) $(LDFLAGS)\
  81. $(CUR_PATH)/misc/tp_dump.c \
  82. src/json_encoders.c \
  83. src/tp_transcode.c \
  84. -o misc/tp_dump \
  85. -lyajl_s \
  86. -lmsgpuck
  87. test-dev-man: utils build
  88. $(CUR_PATH)/test/transcode.sh
  89. $(CUR_PATH)/test/run_all.sh
  90. test-man: utils build
  91. $(CUR_PATH)/test/transcode.sh
  92. $(CUR_PATH)/test/basic_features.py
  93. $(CUR_PATH)/test/v20_features.py
  94. $(CUR_PATH)/test/v23_features.py
  95. #test-auto: utils build
  96. # $(shell $(MODULE_PATH)/test/auto.sh)
  97. #test: test-auto
  98. #check: test
  99. clean:
  100. $(MAKE) -C $(NGX_PATH) clean 2>1 || echo "pass"
  101. rm -f misc/tp_{send,dump} misc/json2tp
  102. utils: json2tp tp_dump
  103. build-all: msgpack yajl configure-debug build utils
  104. build-all-dynamic: msgpack yajl configure-as-dynamic build utils