make 4.4 KB

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