Back to home page

Nginx displayed by LXR

Source navigation ]
Diff markup ]
Identifier search ]
general search ]
 
 
Version: nginx-1.13.12 ]​[ nginx-1.12.2 ]​

0001 
0002 # Copyright (C) Igor Sysoev
0003 # Copyright (C) Nginx, Inc.
0004 
0005 
0006 echo "creating $NGX_MAKEFILE"
0007 
0008 mkdir -p $NGX_OBJS/src/core $NGX_OBJS/src/event $NGX_OBJS/src/event/modules \
0009          $NGX_OBJS/src/os/unix $NGX_OBJS/src/os/win32 \
0010          $NGX_OBJS/src/http $NGX_OBJS/src/http/v2 $NGX_OBJS/src/http/modules \
0011          $NGX_OBJS/src/http/modules/perl \
0012          $NGX_OBJS/src/mail \
0013          $NGX_OBJS/src/stream \
0014          $NGX_OBJS/src/misc
0015 
0016 
0017 ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep
0018 ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"`
0019 
0020 
0021 cat << END                                                     > $NGX_MAKEFILE
0022 
0023 CC =    $CC
0024 CFLAGS = $CFLAGS
0025 CPP =   $CPP
0026 LINK =  $LINK
0027 
0028 END
0029 
0030 
0031 if test -n "$NGX_PERL_CFLAGS"; then
0032     echo NGX_PERL_CFLAGS = $NGX_PERL_CFLAGS                   >> $NGX_MAKEFILE
0033     echo NGX_PM_CFLAGS = $NGX_PM_CFLAGS                       >> $NGX_MAKEFILE
0034     echo NGX_PM_LDFLAGS = $NGX_PM_LDFLAGS                     >> $NGX_MAKEFILE
0035 fi
0036 
0037 
0038 # ALL_INCS, required by the addons and by OpenWatcom C precompiled headers
0039 
0040 ngx_incs=`echo $CORE_INCS $NGX_OBJS $HTTP_INCS $MAIL_INCS $STREAM_INCS\
0041     | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
0042           -e "s/\//$ngx_regex_dirsep/g"`
0043 
0044 cat << END                                                    >> $NGX_MAKEFILE
0045 
0046 ALL_INCS = $ngx_include_opt$ngx_incs
0047 
0048 END
0049 
0050 
0051 ngx_all_srcs="$CORE_SRCS"
0052 
0053 
0054 # the core dependencies and include paths
0055 
0056 ngx_deps=`echo $CORE_DEPS $NGX_AUTO_CONFIG_H $NGX_PCH \
0057     | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
0058           -e "s/\//$ngx_regex_dirsep/g"`
0059 
0060 ngx_incs=`echo $CORE_INCS $NGX_OBJS \
0061     | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
0062           -e "s/\//$ngx_regex_dirsep/g"`
0063 
0064 cat << END                                                    >> $NGX_MAKEFILE
0065 
0066 CORE_DEPS = $ngx_deps
0067 
0068 
0069 CORE_INCS = $ngx_include_opt$ngx_incs
0070 
0071 END
0072 
0073 
0074 # the http dependencies and include paths
0075 
0076 if [ $HTTP = YES ]; then
0077 
0078     ngx_all_srcs="$ngx_all_srcs $HTTP_SRCS"
0079 
0080     ngx_deps=`echo $HTTP_DEPS \
0081         | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
0082               -e "s/\//$ngx_regex_dirsep/g"`
0083 
0084     ngx_incs=`echo $HTTP_INCS \
0085         | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
0086               -e "s/\//$ngx_regex_dirsep/g"`
0087 
0088     cat << END                                                >> $NGX_MAKEFILE
0089 
0090 HTTP_DEPS = $ngx_deps
0091 
0092 
0093 HTTP_INCS = $ngx_include_opt$ngx_incs
0094 
0095 END
0096 
0097 fi
0098 
0099 
0100 # the mail dependencies and include paths
0101 
0102 if [ $MAIL != NO ]; then
0103 
0104     if [ $MAIL = YES ]; then
0105         ngx_all_srcs="$ngx_all_srcs $MAIL_SRCS"
0106     fi
0107 
0108     ngx_deps=`echo $MAIL_DEPS \
0109         | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
0110               -e "s/\//$ngx_regex_dirsep/g"`
0111 
0112     ngx_incs=`echo $MAIL_INCS \
0113         | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
0114               -e "s/\//$ngx_regex_dirsep/g"`
0115 
0116     cat << END                                                >> $NGX_MAKEFILE
0117 
0118 MAIL_DEPS = $ngx_deps
0119 
0120 
0121 MAIL_INCS = $ngx_include_opt$ngx_incs
0122 
0123 END
0124 
0125 fi
0126 
0127 
0128 # the stream dependencies and include paths
0129 
0130 if [ $STREAM != NO ]; then
0131 
0132     if [ $STREAM = YES ]; then
0133         ngx_all_srcs="$ngx_all_srcs $STREAM_SRCS"
0134     fi
0135 
0136     ngx_deps=`echo $STREAM_DEPS \
0137         | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
0138               -e "s/\//$ngx_regex_dirsep/g"`
0139 
0140     ngx_incs=`echo $STREAM_INCS \
0141         | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
0142               -e "s/\//$ngx_regex_dirsep/g"`
0143 
0144     cat << END                                                >> $NGX_MAKEFILE
0145 
0146 STREAM_DEPS = $ngx_deps
0147 
0148 
0149 STREAM_INCS = $ngx_include_opt$ngx_incs
0150 
0151 END
0152 
0153 fi
0154 
0155 
0156 ngx_all_srcs="$ngx_all_srcs $MISC_SRCS"
0157 
0158 
0159 if test -n "$NGX_ADDON_SRCS$DYNAMIC_MODULES"; then
0160 
0161 cat << END                                                >> $NGX_MAKEFILE
0162 
0163 ADDON_DEPS = \$(CORE_DEPS) $NGX_ADDON_DEPS
0164 
0165 END
0166 
0167 fi
0168 
0169 
0170 # nginx
0171 
0172 ngx_all_srcs=`echo $ngx_all_srcs | sed -e "s/\//$ngx_regex_dirsep/g"`
0173 
0174 for ngx_src in $NGX_ADDON_SRCS
0175 do
0176     ngx_obj="addon/`basename \`dirname $ngx_src\``"
0177 
0178     test -d $NGX_OBJS/$ngx_obj || mkdir -p $NGX_OBJS/$ngx_obj
0179 
0180     ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \
0181         | sed -e "s/\//$ngx_regex_dirsep/g"`
0182 
0183     ngx_all_srcs="$ngx_all_srcs $ngx_obj"
0184 done
0185 
0186 ngx_all_objs=`echo $ngx_all_srcs \
0187     | sed -e "s#\([^ ]*\.\)cpp#$NGX_OBJS\/\1$ngx_objext#g" \
0188           -e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \
0189           -e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g" \
0190           -e "s#\([^ ]*\.\)S#$NGX_OBJS\/\1$ngx_objext#g"`
0191 
0192 ngx_modules_c=`echo $NGX_MODULES_C | sed -e "s/\//$ngx_regex_dirsep/g"`
0193 
0194 ngx_modules_obj=`echo $ngx_modules_c | sed -e "s/\(.*\.\)c/\1$ngx_objext/"`
0195 
0196 
0197 if test -n "$NGX_RES"; then
0198    ngx_res=$NGX_RES
0199 else
0200    ngx_res="$NGX_RC $NGX_ICONS"
0201    ngx_rcc=`echo $NGX_RCC | sed -e "s/\//$ngx_regex_dirsep/g"`
0202 fi
0203 
0204 ngx_deps=`echo $ngx_all_objs $ngx_modules_obj $ngx_res $LINK_DEPS \
0205     | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
0206           -e "s/\//$ngx_regex_dirsep/g"`
0207 
0208 ngx_objs=`echo $ngx_all_objs $ngx_modules_obj \
0209     | sed -e "s/  *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
0210           -e "s/\//$ngx_regex_dirsep/g"`
0211 
0212 ngx_libs=
0213 if test -n "$NGX_LD_OPT$CORE_LIBS"; then
0214     ngx_libs=`echo $NGX_LD_OPT $CORE_LIBS \
0215         | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`
0216 fi
0217 
0218 ngx_link=${CORE_LINK:+`echo $CORE_LINK \
0219     | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
0220 
0221 ngx_main_link=${MAIN_LINK:+`echo $MAIN_LINK \
0222     | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
0223 
0224 
0225 cat << END                                                    >> $NGX_MAKEFILE
0226 
0227 build:  binary modules manpage
0228 
0229 binary: $NGX_OBJS${ngx_dirsep}nginx$ngx_binext
0230 
0231 $NGX_OBJS${ngx_dirsep}nginx$ngx_binext: $ngx_deps$ngx_spacer
0232         \$(LINK) $ngx_long_start$ngx_binout$NGX_OBJS${ngx_dirsep}nginx$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_main_link
0233         $ngx_rcc
0234 $ngx_long_end
0235 
0236 modules:
0237 END
0238 
0239 
0240 # ngx_modules.c
0241 
0242 if test -n "$NGX_PCH"; then
0243     ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
0244 else
0245     ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS)"
0246 fi
0247 
0248 cat << END                                                    >> $NGX_MAKEFILE
0249 
0250 $ngx_modules_obj:       \$(CORE_DEPS)$ngx_cont$ngx_modules_c
0251         $ngx_cc$ngx_tab$ngx_objout$ngx_modules_obj$ngx_tab$ngx_modules_c$NGX_AUX
0252 
0253 END
0254 
0255 
0256 # the core sources
0257 
0258 for ngx_src in $CORE_SRCS
0259 do
0260     ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
0261     ngx_obj=`echo $ngx_src \
0262         | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
0263               -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
0264               -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
0265               -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
0266 
0267     cat << END                                                >> $NGX_MAKEFILE
0268 
0269 $ngx_obj:       \$(CORE_DEPS)$ngx_cont$ngx_src
0270         $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
0271 
0272 END
0273 
0274 done
0275 
0276 
0277 # the http sources
0278 
0279 if [ $HTTP = YES ]; then
0280 
0281     if test -n "$NGX_PCH"; then
0282         ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
0283     else
0284         ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(HTTP_INCS)"
0285         ngx_perl_cc="\$(CC) $ngx_compile_opt \$(NGX_PERL_CFLAGS)"
0286         ngx_perl_cc="$ngx_perl_cc \$(CORE_INCS) \$(HTTP_INCS)"
0287     fi
0288 
0289     for ngx_source in $HTTP_SRCS
0290     do
0291         ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
0292         ngx_obj=`echo $ngx_src \
0293             | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
0294                   -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
0295                   -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
0296                   -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
0297 
0298         if [ $ngx_source = src/http/modules/perl/ngx_http_perl_module.c ]; then
0299 
0300             cat << END                                        >> $NGX_MAKEFILE
0301 
0302 $ngx_obj:       \$(CORE_DEPS) \$(HTTP_DEPS)$ngx_cont$ngx_src
0303         $ngx_perl_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
0304 
0305 END
0306         else
0307 
0308             cat << END                                        >> $NGX_MAKEFILE
0309 
0310 $ngx_obj:       \$(CORE_DEPS) \$(HTTP_DEPS)$ngx_cont$ngx_src
0311         $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
0312 
0313 END
0314 
0315         fi
0316      done
0317 
0318 fi
0319 
0320 
0321 # the mail sources
0322 
0323 if [ $MAIL = YES ]; then
0324 
0325     if test -n "$NGX_PCH"; then
0326         ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
0327     else
0328         ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(MAIL_INCS)"
0329     fi
0330 
0331     for ngx_src in $MAIL_SRCS
0332     do
0333         ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
0334         ngx_obj=`echo $ngx_src \
0335             | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
0336                   -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
0337                   -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
0338                   -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
0339 
0340         cat << END                                            >> $NGX_MAKEFILE
0341 
0342 $ngx_obj:       \$(CORE_DEPS) \$(MAIL_DEPS)$ngx_cont$ngx_src
0343         $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
0344 
0345 END
0346      done
0347 
0348 fi
0349 
0350 
0351 # the stream sources
0352 
0353 if [ $STREAM = YES ]; then
0354 
0355     if test -n "$NGX_PCH"; then
0356         ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
0357     else
0358         ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(STREAM_INCS)"
0359     fi
0360 
0361     for ngx_src in $STREAM_SRCS
0362     do
0363         ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
0364         ngx_obj=`echo $ngx_src \
0365             | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
0366                   -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
0367                   -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
0368                   -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
0369 
0370         cat << END                                            >> $NGX_MAKEFILE
0371 
0372 $ngx_obj:       \$(CORE_DEPS) \$(STREAM_DEPS)$ngx_cont$ngx_src
0373         $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
0374 
0375 END
0376      done
0377 
0378 fi
0379 
0380 
0381 # the misc sources
0382 
0383 if test -n "$MISC_SRCS"; then
0384 
0385     ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
0386 
0387     for ngx_src in $MISC_SRCS
0388     do
0389         ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
0390         ngx_obj=`echo $ngx_src \
0391             | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
0392                   -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
0393                   -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
0394                   -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
0395 
0396         cat << END                                            >> $NGX_MAKEFILE
0397 
0398 $ngx_obj:       \$(CORE_DEPS) $ngx_cont$ngx_src
0399         $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
0400 
0401 END
0402      done
0403 
0404 fi
0405 
0406 
0407 # the addons sources
0408 
0409 if test -n "$NGX_ADDON_SRCS"; then
0410 
0411     ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
0412 
0413     for ngx_src in $NGX_ADDON_SRCS
0414     do
0415         ngx_obj="addon/`basename \`dirname $ngx_src\``"
0416 
0417         ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \
0418             | sed -e "s/\//$ngx_regex_dirsep/g"`
0419 
0420         ngx_obj=`echo $ngx_obj \
0421             | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
0422                   -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
0423                   -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
0424                   -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
0425 
0426         ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
0427 
0428         cat << END                                            >> $NGX_MAKEFILE
0429 
0430 $ngx_obj:       \$(ADDON_DEPS)$ngx_cont$ngx_src
0431         $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
0432 
0433 END
0434      done
0435 
0436 fi
0437 
0438 
0439 # the addons config.make
0440 
0441 if test -n "$NGX_ADDONS$DYNAMIC_ADDONS"; then
0442 
0443     for ngx_addon_dir in $NGX_ADDONS $DYNAMIC_ADDONS
0444     do
0445         if test -f $ngx_addon_dir/config.make; then
0446             . $ngx_addon_dir/config.make
0447         fi
0448     done
0449 fi
0450 
0451 
0452 # Win32 resource file
0453 
0454 if test -n "$NGX_RES"; then
0455 
0456     ngx_res=`echo "$NGX_RES:    $NGX_RC $NGX_ICONS" \
0457                  | sed -e "s/\//$ngx_regex_dirsep/g"`
0458     ngx_rcc=`echo $NGX_RCC | sed -e "s/\//$ngx_regex_dirsep/g"`
0459 
0460     cat << END                                                >> $NGX_MAKEFILE
0461 
0462 $ngx_res
0463         $ngx_rcc
0464 
0465 END
0466 
0467 fi
0468 
0469 
0470 # the precompiled headers
0471 
0472 if test -n "$NGX_PCH"; then
0473     echo "#include <ngx_config.h>" > $NGX_OBJS/ngx_pch.c
0474 
0475     ngx_pch="src/core/ngx_config.h $OS_CONFIG $NGX_OBJS/ngx_auto_config.h"
0476     ngx_pch=`echo "$NGX_PCH:    $ngx_pch" | sed -e "s/\//$ngx_regex_dirsep/g"`
0477 
0478     ngx_src="\$(CC) \$(CFLAGS) $NGX_BUILD_PCH $ngx_compile_opt \$(ALL_INCS)"
0479     ngx_src="$ngx_src $ngx_objout$NGX_OBJS/ngx_pch.obj $NGX_OBJS/ngx_pch.c"
0480     ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
0481 
0482     cat << END                                                >> $NGX_MAKEFILE
0483 
0484 $ngx_pch
0485         $ngx_src
0486 
0487 END
0488 
0489 fi
0490 
0491 
0492 # dynamic modules
0493 
0494 if test -n "$NGX_PCH"; then
0495     ngx_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
0496 else
0497     ngx_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(CFLAGS) \$(ALL_INCS)"
0498     ngx_perl_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(NGX_PERL_CFLAGS)"
0499     ngx_perl_cc="$ngx_perl_cc \$(ALL_INCS)"
0500 fi
0501 
0502 for ngx_module in $DYNAMIC_MODULES
0503 do
0504     eval ngx_module_srcs="\$${ngx_module}_SRCS"
0505     eval eval ngx_module_libs="\\\"\$${ngx_module}_LIBS\\\""
0506 
0507     eval ngx_module_modules="\$${ngx_module}_MODULES"
0508     eval ngx_module_order="\$${ngx_module}_ORDER"
0509 
0510     ngx_modules_c=$NGX_OBJS/${ngx_module}_modules.c
0511 
0512     cat << END                                    > $ngx_modules_c
0513 
0514 #include <ngx_config.h>
0515 #include <ngx_core.h>
0516 
0517 END
0518 
0519     for mod in $ngx_module_modules
0520     do
0521         echo "extern ngx_module_t  $mod;"         >> $ngx_modules_c
0522     done
0523 
0524     echo                                          >> $ngx_modules_c
0525     echo 'ngx_module_t *ngx_modules[] = {'        >> $ngx_modules_c
0526 
0527     for mod in $ngx_module_modules
0528     do
0529         echo "    &$mod,"                         >> $ngx_modules_c
0530     done
0531 
0532     cat << END                                    >> $ngx_modules_c
0533     NULL
0534 };
0535 
0536 END
0537 
0538     echo 'char *ngx_module_names[] = {'           >> $ngx_modules_c
0539 
0540     for mod in $ngx_module_modules
0541     do
0542         echo "    \"$mod\","                      >> $ngx_modules_c
0543     done
0544 
0545     cat << END                                    >> $ngx_modules_c
0546     NULL
0547 };
0548 
0549 END
0550 
0551     echo 'char *ngx_module_order[] = {'           >> $ngx_modules_c
0552 
0553     for mod in $ngx_module_order
0554     do
0555         echo "    \"$mod\","                      >> $ngx_modules_c
0556     done
0557 
0558     cat << END                                    >> $ngx_modules_c
0559     NULL
0560 };
0561 
0562 END
0563 
0564     ngx_modules_c=`echo $ngx_modules_c | sed -e "s/\//$ngx_regex_dirsep/g"`
0565 
0566     ngx_modules_obj=`echo $ngx_modules_c \
0567         | sed -e "s/\(.*\.\)c/\1$ngx_objext/"`
0568 
0569     ngx_module_objs=
0570     for ngx_src in $ngx_module_srcs
0571     do
0572         case "$ngx_src" in
0573             src/*)
0574                 ngx_obj=$ngx_src
0575                 ;;
0576             *)
0577                 ngx_obj="addon/`basename \`dirname $ngx_src\``"
0578                 mkdir -p $NGX_OBJS/$ngx_obj
0579                 ngx_obj="$ngx_obj/`basename $ngx_src`"
0580                 ;;
0581         esac
0582 
0583         ngx_module_objs="$ngx_module_objs $ngx_obj"
0584     done
0585 
0586     ngx_module_objs=`echo $ngx_module_objs \
0587         | sed -e "s#\([^ ]*\.\)cpp#$NGX_OBJS\/\1$ngx_objext#g" \
0588               -e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \
0589               -e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g" \
0590               -e "s#\([^ ]*\.\)S#$NGX_OBJS\/\1$ngx_objext#g"`
0591 
0592     ngx_deps=`echo $ngx_module_objs $ngx_modules_obj $LINK_DEPS \
0593         | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
0594               -e "s/\//$ngx_regex_dirsep/g"`
0595 
0596     ngx_objs=`echo $ngx_module_objs $ngx_modules_obj \
0597         | sed -e "s/  *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
0598               -e "s/\//$ngx_regex_dirsep/g"`
0599 
0600     ngx_obj=$NGX_OBJS$ngx_dirsep$ngx_module$ngx_modext
0601 
0602     if [ "$NGX_PLATFORM" = win32 ]; then
0603         ngx_module_libs="$CORE_LIBS $ngx_module_libs"
0604     fi
0605 
0606     ngx_libs=
0607     if test -n "$NGX_LD_OPT$ngx_module_libs"; then
0608         ngx_libs=`echo $NGX_LD_OPT $ngx_module_libs \
0609             | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`
0610     fi
0611 
0612     ngx_link=${CORE_LINK:+`echo $CORE_LINK \
0613         | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
0614 
0615     ngx_module_link=${MODULE_LINK:+`echo $MODULE_LINK \
0616         | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
0617 
0618 
0619     cat << END                                            >> $NGX_MAKEFILE
0620 
0621 modules:        $ngx_obj
0622 
0623 $ngx_obj:       $ngx_deps$ngx_spacer
0624         \$(LINK) $ngx_long_start$ngx_binout$ngx_obj$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_module_link
0625 $ngx_long_end
0626 
0627 $ngx_modules_obj:       \$(CORE_DEPS)$ngx_cont$ngx_modules_c
0628         $ngx_cc$ngx_tab$ngx_objout$ngx_modules_obj$ngx_tab$ngx_modules_c$NGX_AUX
0629 
0630 END
0631 
0632     for ngx_source in $ngx_module_srcs
0633     do
0634         case "$ngx_source" in
0635             src/*)
0636                 ngx_obj=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
0637                 ;;
0638             *)
0639                 ngx_obj="addon/`basename \`dirname $ngx_source\``"
0640                 ngx_obj=`echo $ngx_obj/\`basename $ngx_source\` \
0641                     | sed -e "s/\//$ngx_regex_dirsep/g"`
0642                 ;;
0643         esac
0644 
0645         ngx_obj=`echo $ngx_obj \
0646             | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
0647                   -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
0648                   -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
0649                   -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
0650 
0651         ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
0652 
0653         if [ $ngx_source = src/http/modules/perl/ngx_http_perl_module.c ]; then
0654 
0655             cat << END                                        >> $NGX_MAKEFILE
0656 
0657 $ngx_obj:       \$(ADDON_DEPS)$ngx_cont$ngx_src
0658         $ngx_perl_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
0659 
0660 END
0661         else
0662 
0663             cat << END                                        >> $NGX_MAKEFILE
0664 
0665 $ngx_obj:       \$(ADDON_DEPS)$ngx_cont$ngx_src
0666         $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
0667 
0668 END
0669 
0670         fi
0671     done
0672 done