make 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. # Copyright (C) Igor Sysoev
  2. # Copyright (C) Nginx, Inc.
  3. if [ $PCRE_LIBRARY = PCRE2 ]; then
  4. # PCRE2
  5. if [ $NGX_CC_NAME = msvc ]; then
  6. # With PCRE2, it is not possible to compile all sources.
  7. # Since list of source files changes between versions, we
  8. # test files which might not be present.
  9. ngx_pcre_srcs="pcre2_auto_possess.c \
  10. pcre2_chartables.c \
  11. pcre2_compile.c \
  12. pcre2_config.c \
  13. pcre2_context.c \
  14. pcre2_dfa_match.c \
  15. pcre2_error.c \
  16. pcre2_jit_compile.c \
  17. pcre2_maketables.c \
  18. pcre2_match.c \
  19. pcre2_match_data.c \
  20. pcre2_newline.c \
  21. pcre2_ord2utf.c \
  22. pcre2_pattern_info.c \
  23. pcre2_string_utils.c \
  24. pcre2_study.c \
  25. pcre2_substitute.c \
  26. pcre2_substring.c \
  27. pcre2_tables.c \
  28. pcre2_ucd.c \
  29. pcre2_valid_utf.c \
  30. pcre2_xclass.c"
  31. ngx_pcre_test="pcre2_convert.c \
  32. pcre2_extuni.c \
  33. pcre2_find_bracket.c \
  34. pcre2_script_run.c \
  35. pcre2_serialize.c"
  36. for ngx_src in $ngx_pcre_test
  37. do
  38. if [ -f $PCRE/src/$ngx_src ]; then
  39. ngx_pcre_srcs="$ngx_pcre_srcs $ngx_src"
  40. fi
  41. done
  42. ngx_pcre_objs=`echo $ngx_pcre_srcs \
  43. | sed -e "s#\([^ ]*\.\)c#\1$ngx_objext#g"`
  44. ngx_pcre_srcs=`echo $ngx_pcre_srcs \
  45. | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g"`
  46. ngx_pcre_objs=`echo $ngx_pcre_objs \
  47. | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g"`
  48. cat << END >> $NGX_MAKEFILE
  49. PCRE_CFLAGS = -O2 -Ob1 -Oi -Gs $LIBC $CPU_OPT
  50. PCRE_FLAGS = -DHAVE_CONFIG_H -DPCRE2_STATIC -DPCRE2_CODE_UNIT_WIDTH=8 \\
  51. -DHAVE_MEMMOVE
  52. PCRE_SRCS = $ngx_pcre_srcs
  53. PCRE_OBJS = $ngx_pcre_objs
  54. $PCRE/src/pcre2.h:
  55. cd $PCRE/src \\
  56. && copy /y config.h.generic config.h \\
  57. && copy /y pcre2.h.generic pcre2.h \\
  58. && copy /y pcre2_chartables.c.dist pcre2_chartables.c
  59. $PCRE/src/pcre2-8.lib: $PCRE/src/pcre2.h $NGX_MAKEFILE
  60. cd $PCRE/src \\
  61. && cl -nologo -c \$(PCRE_CFLAGS) -I . \$(PCRE_FLAGS) \$(PCRE_SRCS) \\
  62. && link -lib -out:pcre2-8.lib -verbose:lib \$(PCRE_OBJS)
  63. END
  64. else
  65. cat << END >> $NGX_MAKEFILE
  66. $PCRE/src/pcre2.h: $PCRE/Makefile
  67. $PCRE/Makefile: $NGX_MAKEFILE
  68. cd $PCRE \\
  69. && if [ -f Makefile ]; then \$(MAKE) distclean; fi \\
  70. && CC="\$(CC)" CFLAGS="$PCRE_OPT" \\
  71. ./configure --disable-shared $PCRE_CONF_OPT
  72. $PCRE/.libs/libpcre2-8.a: $PCRE/Makefile
  73. cd $PCRE \\
  74. && \$(MAKE) libpcre2-8.la
  75. END
  76. fi
  77. else
  78. # PCRE
  79. case "$NGX_CC_NAME" in
  80. msvc)
  81. ngx_makefile=makefile.msvc
  82. ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC"
  83. ngx_pcre="PCRE=\"$PCRE\""
  84. ;;
  85. owc)
  86. ngx_makefile=makefile.owc
  87. ngx_opt="CPU_OPT=\"$CPU_OPT\""
  88. ngx_pcre=`echo PCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"`
  89. ;;
  90. bcc)
  91. ngx_makefile=makefile.bcc
  92. ngx_opt="-DCPU_OPT=\"$CPU_OPT\""
  93. ngx_pcre=`echo \-DPCRE=\"$PCRE\" \
  94. | sed -e "s/\//$ngx_regex_dirsep/g"`
  95. ;;
  96. *)
  97. ngx_makefile=
  98. ;;
  99. esac
  100. if [ -n "$ngx_makefile" ]; then
  101. cat << END >> $NGX_MAKEFILE
  102. `echo "$PCRE/pcre.lib: $PCRE/pcre.h $NGX_MAKEFILE" \
  103. | sed -e "s/\//$ngx_regex_dirsep/g"`
  104. \$(MAKE) -f auto/lib/pcre/$ngx_makefile $ngx_pcre $ngx_opt
  105. `echo "$PCRE/pcre.h:" | sed -e "s/\//$ngx_regex_dirsep/g"`
  106. \$(MAKE) -f auto/lib/pcre/$ngx_makefile $ngx_pcre pcre.h
  107. END
  108. else
  109. cat << END >> $NGX_MAKEFILE
  110. $PCRE/pcre.h: $PCRE/Makefile
  111. $PCRE/Makefile: $NGX_MAKEFILE
  112. cd $PCRE \\
  113. && if [ -f Makefile ]; then \$(MAKE) distclean; fi \\
  114. && CC="\$(CC)" CFLAGS="$PCRE_OPT" \\
  115. ./configure --disable-shared $PCRE_CONF_OPT
  116. $PCRE/.libs/libpcre.a: $PCRE/Makefile
  117. cd $PCRE \\
  118. && \$(MAKE) libpcre.la
  119. END
  120. fi
  121. fi