make 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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_chkdint.c \
  32. pcre2_convert.c \
  33. pcre2_extuni.c \
  34. pcre2_find_bracket.c \
  35. pcre2_script_run.c \
  36. pcre2_serialize.c"
  37. for ngx_src in $ngx_pcre_test
  38. do
  39. if [ -f $PCRE/src/$ngx_src ]; then
  40. ngx_pcre_srcs="$ngx_pcre_srcs $ngx_src"
  41. fi
  42. done
  43. ngx_pcre_objs=`echo $ngx_pcre_srcs \
  44. | sed -e "s#\([^ ]*\.\)c#\1$ngx_objext#g"`
  45. ngx_pcre_srcs=`echo $ngx_pcre_srcs \
  46. | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g"`
  47. ngx_pcre_objs=`echo $ngx_pcre_objs \
  48. | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g"`
  49. cat << END >> $NGX_MAKEFILE
  50. PCRE_CFLAGS = -O2 -Ob1 -Oi -Gs $LIBC $CPU_OPT
  51. PCRE_FLAGS = -DHAVE_CONFIG_H -DPCRE2_STATIC -DPCRE2_CODE_UNIT_WIDTH=8 \\
  52. -DHAVE_MEMMOVE
  53. PCRE_SRCS = $ngx_pcre_srcs
  54. PCRE_OBJS = $ngx_pcre_objs
  55. $PCRE/src/pcre2.h:
  56. cd $PCRE/src \\
  57. && copy /y config.h.generic config.h \\
  58. && copy /y pcre2.h.generic pcre2.h \\
  59. && copy /y pcre2_chartables.c.dist pcre2_chartables.c
  60. $PCRE/src/pcre2-8.lib: $PCRE/src/pcre2.h $NGX_MAKEFILE
  61. cd $PCRE/src \\
  62. && cl -nologo -c \$(PCRE_CFLAGS) -I . \$(PCRE_FLAGS) \$(PCRE_SRCS) \\
  63. && link -lib -out:pcre2-8.lib -verbose:lib \$(PCRE_OBJS)
  64. END
  65. else
  66. cat << END >> $NGX_MAKEFILE
  67. $PCRE/src/pcre2.h: $PCRE/Makefile
  68. $PCRE/Makefile: $NGX_MAKEFILE
  69. cd $PCRE \\
  70. && if [ -f Makefile ]; then \$(MAKE) distclean; fi \\
  71. && CC="\$(CC)" CFLAGS="$PCRE_OPT" \\
  72. ./configure --disable-shared $PCRE_CONF_OPT
  73. $PCRE/.libs/libpcre2-8.a: $PCRE/Makefile
  74. cd $PCRE \\
  75. && \$(MAKE) libpcre2-8.la
  76. END
  77. fi
  78. else
  79. # PCRE
  80. case "$NGX_CC_NAME" in
  81. msvc)
  82. ngx_makefile=makefile.msvc
  83. ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC"
  84. ngx_pcre="PCRE=\"$PCRE\""
  85. ;;
  86. owc)
  87. ngx_makefile=makefile.owc
  88. ngx_opt="CPU_OPT=\"$CPU_OPT\""
  89. ngx_pcre=`echo PCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"`
  90. ;;
  91. bcc)
  92. ngx_makefile=makefile.bcc
  93. ngx_opt="-DCPU_OPT=\"$CPU_OPT\""
  94. ngx_pcre=`echo \-DPCRE=\"$PCRE\" \
  95. | sed -e "s/\//$ngx_regex_dirsep/g"`
  96. ;;
  97. *)
  98. ngx_makefile=
  99. ;;
  100. esac
  101. if [ -n "$ngx_makefile" ]; then
  102. cat << END >> $NGX_MAKEFILE
  103. `echo "$PCRE/pcre.lib: $PCRE/pcre.h $NGX_MAKEFILE" \
  104. | sed -e "s/\//$ngx_regex_dirsep/g"`
  105. \$(MAKE) -f auto/lib/pcre/$ngx_makefile $ngx_pcre $ngx_opt
  106. `echo "$PCRE/pcre.h:" | sed -e "s/\//$ngx_regex_dirsep/g"`
  107. \$(MAKE) -f auto/lib/pcre/$ngx_makefile $ngx_pcre pcre.h
  108. END
  109. else
  110. cat << END >> $NGX_MAKEFILE
  111. $PCRE/pcre.h: $PCRE/Makefile
  112. $PCRE/Makefile: $NGX_MAKEFILE
  113. cd $PCRE \\
  114. && if [ -f Makefile ]; then \$(MAKE) distclean; fi \\
  115. && CC="\$(CC)" CFLAGS="$PCRE_OPT" \\
  116. ./configure --disable-shared $PCRE_CONF_OPT
  117. $PCRE/.libs/libpcre.a: $PCRE/Makefile
  118. cd $PCRE \\
  119. && \$(MAKE) libpcre.la
  120. END
  121. fi
  122. fi