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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 = $(NGX_PATH)/auto/configure
  7. ## NginX change configure path, so handle this {{{
  8. ifeq ($(shell [ -e "$(NGX_PATH)/configure" ] && echo 1 || echo 0 ),1)
  9. NGX_CONFIGURE=$(NGX_PATH)/configure
  10. endif
  11. ## }}}
  12. MODULE_PATH = $(CUR_PATH)
  13. PREFIX_PATH = $(CUR_PATH)/test-root
  14. INC_FLAGS = -I$(CUR_PATH)/third_party
  15. INC_FLAGS += -I$(YAJL_PATH)/build/yajl-2.1.0/include
  16. INC_FLAGS += -I$(CUR_PATH)/third_party/msgpuck
  17. INC_FLAGS += -I$(CUR_PATH)/src
  18. YAJL_LIB = $(YAJL_PATH)/build/yajl-2.1.0/lib/libyajl_s.a
  19. LDFLAGS = -L$(YAJL_PATH)/build/yajl-2.1.0/lib
  20. DEV_CFLAGS += -ggdb3 -O0 -Wall -Werror
  21. .PHONY: all build
  22. all: build
  23. yajl-dynamic:
  24. ln -sf src third_party/yajl/yajl
  25. cd $(YAJL_PATH); CFLAGS=" $(CFLAGS) -fPIC" ./configure; make distro
  26. yajl:
  27. ln -sf src third_party/yajl/yajl
  28. cd $(YAJL_PATH); ./configure; make distro
  29. gen_version:
  30. $(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)
  31. build: gen_version utils
  32. $(MAKE) -C $(NGX_PATH)
  33. configure:
  34. cd $(NGX_PATH) && \
  35. $(NGX_CONFIGURE) \
  36. --with-cc-opt='$(INC_FLAGS)'\
  37. --add-module='$(MODULE_PATH)'
  38. configure-as-dynamic:
  39. cd $(NGX_PATH) && \
  40. $(NGX_CONFIGURE) --add-dynamic-module='$(MODULE_PATH)'
  41. configure-debug:
  42. cd $(NGX_PATH) && \
  43. CFLAGS=" -DMY_DEBUG $(DEV_CFLAGS)" $(NGX_CONFIGURE) \
  44. --prefix=$(PREFIX_PATH) \
  45. --add-module=$(MODULE_PATH) \
  46. --with-debug
  47. mkdir -p $(PREFIX_PATH)/conf $(PREFIX_PATH)/logs
  48. cp -Rf $(NGX_PATH)/conf/* $(PREFIX_PATH)/conf
  49. cp -f $(CUR_PATH)/test/ngx_confs/tnt_server_test.conf $(PREFIX_PATH)/conf/tnt_server_test.conf
  50. cp -f $(CUR_PATH)/test/ngx_confs/nginx.dev.conf $(PREFIX_PATH)/conf/nginx.conf
  51. configure-as-dynamic-debug:
  52. cd $(NGX_PATH) && \
  53. CFLAGS=" -DMY_DEBUG $(DEV_CFLAGS)" $(NGX_CONFIGURE) \
  54. --prefix=$(PREFIX_PATH) \
  55. --add-dynamic-module=$(MODULE_PATH) \
  56. --with-debug
  57. mkdir -p $(PREFIX_PATH)/conf $(PREFIX_PATH)/logs $(PREFIX_PATH)/modules
  58. # cp -f $(CUR_PATH)/nginx/objs/ngx_http_tnt_module.so $(PREFIX_PATH)/modules/ngx_http_tnt_module.so
  59. # cp -f $(CUR_PATH)/nginx/objs/ngx_http_tnt_module.so /usr/local/nginx/modules/ngx_http_tnt_module.so
  60. cp -Rf $(NGX_PATH)/conf/* $(PREFIX_PATH)/conf
  61. cp -f $(CUR_PATH)/test/ngx_confs/nginx.dev.dyn.conf $(PREFIX_PATH)/conf/nginx.conf
  62. cp -f $(CUR_PATH)/test/ngx_confs/tnt_server_test.conf $(PREFIX_PATH)/conf/tnt_server_test.conf
  63. json2tp:
  64. $(CC) $(CFLAGS) $(DEV_CFLAGS) $(INC_FLAGS) $(LDFLAGS)\
  65. $(CUR_PATH)/misc/json2tp.c \
  66. src/tp_transcode.c \
  67. -o misc/json2tp \
  68. -lyajl_s
  69. tp_dump:
  70. $(CC) $(CFLAGS) $(DEV_CFLAGS) $(INC_FLAGS) $(LDFLAGS)\
  71. $(CUR_PATH)/misc/tp_dump.c \
  72. src/tp_transcode.c \
  73. -o misc/tp_dump \
  74. -lyajl_s
  75. tp_allowed:
  76. $(CC) $(CFLAGS) $(DEV_CFLAGS) $(INC_FLAGS) $(LDFLAGS)\
  77. $(CUR_PATH)/test/tp_allowed.c\
  78. $(CUR_PATH)/src/tp_allowed_methods.c\
  79. -o test/tp_allowed
  80. $(CUR_PATH)/test/tp_allowed
  81. test-dev-man: utils build
  82. $(CUR_PATH)/test/transcode.sh
  83. $(CUR_PATH)/test/run_all.sh
  84. test-man: utils build
  85. $(CUR_PATH)/test/transcode.sh
  86. $(CUR_PATH)/test/basic_features.py
  87. $(CUR_PATH)/test/v20_features.py
  88. $(CUR_PATH)/test/v23_features.py
  89. #test-auto: utils build
  90. # $(shell $(MODULE_PATH)/test/auto.sh)
  91. #test: test-auto
  92. #check: test
  93. clean:
  94. $(MAKE) -C $(NGX_PATH) clean 2>1 || echo "pass"
  95. rm -f misc/tp_{send,dump} misc/json2tp
  96. utils: json2tp tp_dump
  97. build-all: yajl configure build utils
  98. build-all-dynamic: yajl-dynamic configure-as-dynamic build utils
  99. build-all-debug: yajl configure-debug build utils
  100. build-all-dynamic-debug: yajl-dynamic configure-as-dynamic-debug build utils