mirror of https://github.com/alibaba/tengine.git
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.
651 lines
18 KiB
651 lines
18 KiB
|
|
# Copyright (C) Igor Sysoev
|
|
# Copyright (C) Nginx, Inc.
|
|
|
|
|
|
if test -n "$NGX_SHARED_MODULES"; then
|
|
if [ $NGX_DSO != YES ]; then
|
|
cat << END
|
|
|
|
you should enable dso, if you want to use a dynamically loaded module.
|
|
END
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
|
|
echo "creating $NGX_MAKEFILE"
|
|
|
|
mkdir -p $NGX_OBJS/src/core $NGX_OBJS/src/event $NGX_OBJS/src/event/modules \
|
|
$NGX_OBJS/src/os/unix $NGX_OBJS/src/os/win32 \
|
|
$NGX_OBJS/src/http $NGX_OBJS/src/http/modules \
|
|
$NGX_OBJS/src/http/modules/perl \
|
|
$NGX_OBJS/src/http/modules/lua \
|
|
$NGX_OBJS/src/http/modules/tfs \
|
|
$NGX_OBJS/src/mail \
|
|
$NGX_OBJS/src/misc \
|
|
$NGX_OBJS/src/proc \
|
|
$NGX_OBJS/modules
|
|
|
|
|
|
ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep
|
|
ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
|
|
cat << END > $NGX_MAKEFILE
|
|
|
|
CC = $CC
|
|
CFLAGS = $CFLAGS
|
|
CPP = $CPP
|
|
LINK = $LINK
|
|
|
|
END
|
|
|
|
|
|
if test -n "$NGX_PERL_CFLAGS"; then
|
|
echo NGX_PERL_CFLAGS = $NGX_PERL_CFLAGS >> $NGX_MAKEFILE
|
|
echo NGX_PM_CFLAGS = $NGX_PM_CFLAGS >> $NGX_MAKEFILE
|
|
fi
|
|
|
|
|
|
# ALL_INCS, required by the addons and by OpenWatcom C precompiled headers
|
|
|
|
ngx_incs=`echo $CORE_INCS $NGX_OBJS $HTTP_INCS $MAIL_INCS\
|
|
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
|
|
-e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
ALL_INCS = $ngx_include_opt$ngx_incs
|
|
|
|
END
|
|
|
|
dso_all_incs=$ngx_include_opt$ngx_incs
|
|
|
|
|
|
ngx_all_srcs="$CORE_SRCS"
|
|
|
|
|
|
# the core dependences and include paths
|
|
|
|
ngx_deps=`echo $CORE_DEPS $NGX_AUTO_CONFIG_H $NGX_PCH \
|
|
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
|
|
-e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
ngx_incs=`echo $CORE_INCS $NGX_OBJS \
|
|
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
|
|
-e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
CORE_DEPS = $ngx_deps
|
|
|
|
|
|
CORE_INCS = $ngx_include_opt$ngx_incs
|
|
|
|
END
|
|
|
|
dso_core_deps=$ngx_deps
|
|
dso_core_incs=$ngx_include_opt$ngx_incs
|
|
|
|
|
|
# the http dependences and include paths
|
|
|
|
if [ $HTTP = YES ]; then
|
|
|
|
ngx_all_srcs="$ngx_all_srcs $HTTP_SRCS"
|
|
|
|
ngx_deps=`echo $HTTP_DEPS \
|
|
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
|
|
-e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
ngx_incs=`echo $HTTP_INCS \
|
|
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
|
|
-e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
HTTP_DEPS = $ngx_deps
|
|
|
|
|
|
HTTP_INCS = $ngx_include_opt$ngx_incs
|
|
|
|
END
|
|
|
|
dso_http_deps=$ngx_deps
|
|
dso_http_incs=$ngx_include_opt$ngx_incs
|
|
|
|
fi
|
|
|
|
|
|
# the mail dependences and include paths
|
|
|
|
if [ $MAIL = YES ]; then
|
|
|
|
ngx_all_srcs="$ngx_all_srcs $MAIL_SRCS"
|
|
|
|
ngx_deps=`echo $MAIL_DEPS \
|
|
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
|
|
-e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
ngx_incs=`echo $MAIL_INCS \
|
|
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
|
|
-e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
MAIL_DEPS = $ngx_deps
|
|
|
|
|
|
MAIL_INCS = $ngx_include_opt$ngx_incs
|
|
|
|
END
|
|
|
|
fi
|
|
|
|
|
|
ngx_all_srcs="$ngx_all_srcs $NGX_MISC_SRCS"
|
|
|
|
|
|
if test -n "$NGX_ADDON_SRCS"; then
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
ADDON_DEPS = \$(CORE_DEPS) $NGX_ADDON_DEPS
|
|
|
|
END
|
|
|
|
fi
|
|
|
|
|
|
# nginx
|
|
|
|
ngx_all_srcs=`echo $ngx_all_srcs | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
for ngx_src in $NGX_ADDON_SRCS
|
|
do
|
|
ngx_obj="addon/`basename \`dirname $ngx_src\``"
|
|
|
|
test -d $NGX_OBJS/$ngx_obj || mkdir -p $NGX_OBJS/$ngx_obj
|
|
|
|
ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \
|
|
| sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
ngx_all_srcs="$ngx_all_srcs $ngx_obj"
|
|
done
|
|
|
|
ngx_all_objs=`echo $ngx_all_srcs \
|
|
| sed -e "s#\([^ ]*\.\)cpp#$NGX_OBJS\/\1$ngx_objext#g" \
|
|
-e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \
|
|
-e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g" \
|
|
-e "s#\([^ ]*\.\)S#$NGX_OBJS\/\1$ngx_objext#g"`
|
|
|
|
ngx_modules_c=`echo $NGX_MODULES_C | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
ngx_modules_obj=`echo $ngx_modules_c | sed -e "s/\(.*\.\)c/\1$ngx_objext/"`
|
|
|
|
|
|
if test -n "$NGX_RES"; then
|
|
ngx_res=$NGX_RES
|
|
else
|
|
ngx_res="$NGX_RC $NGX_ICONS"
|
|
ngx_rcc=`echo $NGX_RCC | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
fi
|
|
|
|
ngx_deps=`echo $ngx_all_objs $ngx_modules_obj $ngx_res $LINK_DEPS \
|
|
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
|
|
-e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
ngx_objs=`echo $ngx_all_objs $ngx_modules_obj \
|
|
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
|
|
-e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
if test -n "$NGX_LD_OPT$CORE_LIBS"; then
|
|
ngx_libs=`echo $NGX_LD_OPT $CORE_LIBS \
|
|
| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`
|
|
fi
|
|
|
|
ngx_link=${CORE_LINK:+`echo $CORE_LINK \
|
|
| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
|
|
|
|
|
|
for ngx_shared_modules in $NGX_SHARED_MODULES
|
|
do
|
|
NGX_DSO_ALL_TARGETS="$NGX_DSO_ALL_TARGETS $NGX_OBJS${ngx_dirsep}modules${ngx_dirsep}${ngx_shared_modules}${NGX_SOEXT}"
|
|
done
|
|
|
|
if test -n "$NGX_DSO_ALL_TARGETS"; then
|
|
|
|
ngx_dso_target=`echo $NGX_DSO_ALL_TARGETS \
|
|
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
|
|
-e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
all: $NGX_OBJS${ngx_dirsep}nginx${ngx_binext} $ngx_dso_target
|
|
|
|
END
|
|
|
|
fi
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
$NGX_OBJS${ngx_dirsep}nginx${ngx_binext}: $ngx_deps$ngx_spacer
|
|
\$(LINK) ${ngx_long_start}${ngx_binout}$NGX_OBJS${ngx_dirsep}nginx$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$NGX_EXTEND_LD_OPT
|
|
$ngx_rcc
|
|
${ngx_long_end}
|
|
END
|
|
|
|
|
|
# ngx_modules.c
|
|
|
|
if test -n "$NGX_PCH"; then
|
|
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
|
|
else
|
|
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS)"
|
|
fi
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
$ngx_modules_obj: \$(CORE_DEPS)$ngx_cont$ngx_modules_c
|
|
$ngx_cc$ngx_tab$ngx_objout$ngx_modules_obj$ngx_tab$ngx_modules_c$NGX_AUX
|
|
|
|
END
|
|
|
|
|
|
# the core sources
|
|
|
|
for ngx_src in $CORE_SRCS
|
|
do
|
|
ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
ngx_obj=`echo $ngx_src \
|
|
| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
$ngx_obj: \$(CORE_DEPS)$ngx_cont$ngx_src
|
|
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
|
|
|
|
END
|
|
|
|
done
|
|
|
|
|
|
# the http sources
|
|
|
|
if [ $HTTP = YES ]; then
|
|
|
|
if test -n "$NGX_PCH"; then
|
|
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
|
|
else
|
|
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(HTTP_INCS)"
|
|
ngx_perl_cc="\$(CC) $ngx_compile_opt \$(NGX_PERL_CFLAGS) "
|
|
ngx_perl_cc="$ngx_perl_cc \$(CORE_INCS) \$(HTTP_INCS)"
|
|
fi
|
|
|
|
for ngx_source in $HTTP_SRCS
|
|
do
|
|
ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
ngx_obj=`echo $ngx_src \
|
|
| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
|
|
|
|
if [ $ngx_source = src/http/modules/perl/ngx_http_perl_module.c ]; then
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
$ngx_obj: \$(CORE_DEPS) \$(HTTP_DEPS)$ngx_cont$ngx_src
|
|
$ngx_perl_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
|
|
|
|
END
|
|
else
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
$ngx_obj: \$(CORE_DEPS) \$(HTTP_DEPS)$ngx_cont$ngx_src
|
|
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
|
|
|
|
END
|
|
|
|
fi
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
# the mail sources
|
|
|
|
if [ $MAIL = YES ]; then
|
|
|
|
if test -n "$NGX_PCH"; then
|
|
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
|
|
else
|
|
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(MAIL_INCS)"
|
|
fi
|
|
|
|
for ngx_src in $MAIL_SRCS
|
|
do
|
|
ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
ngx_obj=`echo $ngx_src \
|
|
| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
$ngx_obj: \$(CORE_DEPS) \$(MAIL_DEPS)$ngx_cont$ngx_src
|
|
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
|
|
|
|
END
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
# the misc sources
|
|
|
|
if test -n "$NGX_MISC_SRCS"; then
|
|
|
|
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
|
|
|
|
for ngx_src in $NGX_MISC_SRCS
|
|
do
|
|
ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
ngx_obj=`echo $ngx_src \
|
|
| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
$ngx_obj: \$(CORE_DEPS) $ngx_cont$ngx_src
|
|
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
|
|
|
|
END
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
# the addons sources
|
|
|
|
if test -n "$NGX_ADDON_SRCS"; then
|
|
|
|
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
|
|
|
|
for ngx_src in $NGX_ADDON_SRCS
|
|
do
|
|
ngx_obj="addon/`basename \`dirname $ngx_src\``"
|
|
|
|
ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \
|
|
| sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
ngx_obj=`echo $ngx_obj \
|
|
| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
|
|
|
|
ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
$ngx_obj: \$(ADDON_DEPS)$ngx_cont$ngx_src
|
|
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
|
|
|
|
END
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
# the addons config.make
|
|
|
|
if test -n "$NGX_ADDONS"; then
|
|
|
|
for ngx_addon_dir in $NGX_ADDONS
|
|
do
|
|
if test -f $ngx_addon_dir/config.make; then
|
|
. $ngx_addon_dir/config.make
|
|
fi
|
|
done
|
|
fi
|
|
|
|
|
|
# Win32 resource file
|
|
|
|
if test -n "$NGX_RES"; then
|
|
|
|
ngx_res=`echo "$NGX_RES: $NGX_RC $NGX_ICONS" \
|
|
| sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
ngx_rcc=`echo $NGX_RCC | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
$ngx_res
|
|
$ngx_rcc
|
|
|
|
END
|
|
|
|
fi
|
|
|
|
|
|
# the precompiled headers
|
|
|
|
if test -n "$NGX_PCH"; then
|
|
echo "#include <ngx_config.h>" > $NGX_OBJS/ngx_pch.c
|
|
|
|
ngx_pch="src/core/ngx_config.h $OS_CONFIG $NGX_OBJS/ngx_auto_config.h"
|
|
ngx_pch=`echo "$NGX_PCH: $ngx_pch" | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
ngx_src="\$(CC) \$(CFLAGS) $NGX_BUILD_PCH $ngx_compile_opt \$(ALL_INCS)"
|
|
ngx_src="$ngx_src $ngx_objout$NGX_OBJS/ngx_pch.obj $NGX_OBJS/ngx_pch.c"
|
|
ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
$ngx_pch
|
|
$ngx_src
|
|
|
|
END
|
|
|
|
fi
|
|
|
|
|
|
if [ $NGX_DSO = YES ] ; then
|
|
|
|
ngx_dso_cflag=" -fPIC "
|
|
ngx_dso_link_flag=" -shared "
|
|
ngx_dso_index=2
|
|
|
|
case "$NGX_PLATFORM" in
|
|
Darwin:*)
|
|
ngx_dso_link_flag="$ngx_dso_link_flag -undefined dynamic_lookup "
|
|
esac
|
|
|
|
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(HTTP_INCS)"
|
|
|
|
for ngx_shared_modules in $NGX_SHARED_MODULES
|
|
do
|
|
ngx_dso_all_objs=
|
|
ngx_dso_srcs=`echo $NGX_SHARED_SRCS \
|
|
| awk -v dso_index=$ngx_dso_index 'BEGIN { FS="|" } {print $dso_index}'`
|
|
|
|
for ngx_source in $ngx_dso_srcs
|
|
do
|
|
ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
ngx_obj=`echo $ngx_src \
|
|
| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
|
|
|
|
ngx_dso_all_objs="$ngx_dso_all_objs $ngx_obj"
|
|
|
|
done
|
|
|
|
ngx_dso_feture_path=`echo $DSO_INCS | awk 'BEGIN { FS="|" } \
|
|
{for (i=1; i<=NF; i++) print $i}' | awk -v module_name=$ngx_shared_modules \
|
|
'BEGIN { FS=":"} {if ($1 == module_name) print $2}'`
|
|
|
|
ngx_dso_incs=`echo $ngx_dso_feture_path \
|
|
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_include_opt\1/g" \
|
|
-e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
for ngx_source in $ngx_dso_srcs
|
|
do
|
|
ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
|
|
ngx_obj=`echo $ngx_src \
|
|
| sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
|
|
-e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
$ngx_obj: \$(CORE_DEPS) \$(HTTP_DEPS)$ngx_cont$ngx_src
|
|
$ngx_cc$ngx_dso_cflag $ngx_dso_incs$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
|
|
|
|
END
|
|
|
|
done
|
|
ngx_dso_deps=`echo $ngx_dso_all_objs $ngx_res $LINK_DEPS \
|
|
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
|
|
-e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
ngx_dso_objs=`echo $ngx_dso_all_objs \
|
|
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
|
|
-e "s/\//$ngx_regex_dirsep/g"`
|
|
|
|
ngx_dso_link=${CORE_LINK:+`echo $CORE_LINK \
|
|
| sed -e "s/\//$ngx_regex_dirsep%%/g" -e "s/^/$ngx_long_regex_cont/"`}
|
|
|
|
ngx_dso_feture_lib=`echo $DSO_LIBS | awk 'BEGIN { FS="|" } \
|
|
{for (i=1; i<=NF; i++) print $i}' | awk -v module_name=$ngx_shared_modules \
|
|
'BEGIN { FS=":"} {if ($1 == module_name) print $2}'`
|
|
|
|
cat << END >> $NGX_MAKEFILE
|
|
|
|
$NGX_OBJS${ngx_dirsep}modules${ngx_dirsep}${ngx_shared_modules}${NGX_SOEXT}: $ngx_dso_deps$ngx_spacer
|
|
\$(LINK)${ngx_dso_link_flag} ${ngx_long_start}${ngx_binout} $NGX_OBJS/modules${ngx_dirsep}${ngx_shared_modules}${NGX_SOEXT}$ngx_long_cont$ngx_dso_objs$ngx_libs$ngx_dso_link $ngx_dso_feture_lib
|
|
$ngx_rcc
|
|
${ngx_long_end}
|
|
END
|
|
|
|
ngx_dso_index=$(($ngx_dso_index+1))
|
|
done
|
|
|
|
core_deps_temp=
|
|
core_incs_temp=
|
|
http_deps_temp=
|
|
http_incs_temp=
|
|
all_incs_temp=
|
|
|
|
for dai in $dso_all_incs
|
|
do
|
|
if [ "$dai" = "-I" ]; then
|
|
all_incs_temp="$all_incs_temp $dai"
|
|
elif [ "$dai" = "\\" ]; then
|
|
all_incs_temp="$all_incs_temp \\"
|
|
elif test -n "$dai"; then
|
|
all_incs_temp="$all_incs_temp $dai"
|
|
fi
|
|
done
|
|
|
|
for cdep in $dso_core_deps
|
|
do
|
|
if test -n "$cdep"; then
|
|
core_deps_temp="$core_deps_temp $cdep"
|
|
fi
|
|
done
|
|
|
|
for dci in $dso_core_incs
|
|
do
|
|
if [ "$dci" = "-I" ]; then
|
|
core_incs_temp="$core_incs_temp $dci"
|
|
elif [ "$dci" = "\\" ]; then
|
|
core_incs_temp="$core_incs_temp \\"
|
|
elif test -n "$dci"; then
|
|
core_incs_temp="$core_incs_temp $dci"
|
|
fi
|
|
done
|
|
|
|
for hdep in $dso_http_deps
|
|
do
|
|
if test -n "$hdep"; then
|
|
http_deps_temp="$http_deps_temp $hdep"
|
|
fi
|
|
done
|
|
|
|
for dhi in $dso_http_incs
|
|
do
|
|
if [ "$dhi" = "-I" ]; then
|
|
http_incs_temp="$http_incs_temp $dhi"
|
|
elif [ "$dhi" = "\\" ]; then
|
|
http_incs_temp="$http_incs_temp \\"
|
|
elif test -n "$dhi"; then
|
|
http_incs_temp="$http_incs_temp $dhi"
|
|
fi
|
|
done
|
|
|
|
cat << END > $NGX_DSO_COMPILE
|
|
#!/bin/sh
|
|
|
|
# Copyright (C) 2010-2013 Alibaba Group Holding Limited
|
|
|
|
|
|
ngx_soext='$NGX_SOEXT'
|
|
CC=$CC
|
|
CFLAGS='$CFLAGS -fPIC'
|
|
CPP='$CPP'
|
|
LINK='$LINK -fPIC $ngx_dso_link_flag'
|
|
|
|
|
|
CORE_LIBS='$CORE_LIBS'
|
|
CORE_LINK='$ngx_link'
|
|
|
|
NGX_LD_OPT='$NGX_LD_OPT'
|
|
NGX_PREFIX=$NGX_PREFIX
|
|
|
|
NGX_RPATH=$NGX_RPATH
|
|
|
|
ngx_regex_dirsep='$ngx_regex_dirsep'
|
|
ngx_cont='$ngx_cont'
|
|
ngx_cc='$ngx_cc'
|
|
ngx_tab='$ngx_tab'
|
|
ngx_objout='$ngx_objout'
|
|
NGX_AUX='$NGX_AUX'
|
|
ngx_long_regex_cont='$ngx_long_regex_cont'
|
|
ngx_dirsep='$ngx_dirsep'
|
|
ngx_binext='$ngx_binext'
|
|
ngx_long_start='$ngx_long_start'
|
|
ngx_long_cont='$ngx_long_cont'
|
|
ngx_rcc='$ngx_rcc'
|
|
ngx_spacer='$ngx_spacer'
|
|
ngx_objext='$ngx_objext'
|
|
ngx_regex_cont='$ngx_regex_cont'
|
|
ngx_include_opt='$ngx_include_opt'
|
|
ngx_binout='$ngx_binout'
|
|
NGX_DSO_PATH=$NGX_DSO_PATH
|
|
NGX_AUTOCONF_ERR=$NGX_AUTOCONF_ERR
|
|
NGX_AUTOTEST=$NGX_AUTOTEST
|
|
NGX_AUTO_CONFIG_H=$NGX_AUTO_CONFIG_H
|
|
NGX_CONFIGURE="$NGX_CONFIGURE"
|
|
|
|
END
|
|
|
|
sed -e "s|%%ALL_INCS%%|'$all_incs_temp'|g" \
|
|
-e "s|%%CORE_DEPS%%|'$core_deps_temp'|g" \
|
|
-e "s|%%CORE_INCS%%|'$core_incs_temp'|g" \
|
|
-e "s|%%HTTP_DEPS%%|'$http_deps_temp'|g" \
|
|
-e "s|%%HTTP_INCS%%|'$http_incs_temp'|g" \
|
|
-e "s|%%NGX_SOURCE_HOME%%|'$(cd ${0%/*} && pwd)'|g" \
|
|
contrib/dso.in >> $NGX_DSO_COMPILE
|
|
fi
|