nginx/auto/make

279 lines
7.1 KiB
Plaintext
Raw Normal View History

2003-11-26 04:44:56 +08:00
# Copyright (C) Igor Sysoev
2003-11-26 04:44:56 +08:00
mkdir -p $OBJS/src/core $OBJS/src/event $OBJS/src/event/modules \
$OBJS/src/os/unix $OBJS/src/os/win32 \
$OBJS/src/http $OBJS/src/http/modules $OBJS/src/http/modules/proxy \
$OBJS/src/imap
2003-11-26 04:44:56 +08:00
ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep
ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"`
2003-11-26 04:44:56 +08:00
cat << END >> $NGX_MAKEFILE
2004-03-10 03:47:07 +08:00
CC = $CC
CFLAGS = $CFLAGS
CPP = $CPP
LINK = $LINK
2004-03-10 03:47:07 +08:00
END
if [ "$CC" = wcl386 ]; then
echo MAKE = wmake >> $NGX_MAKEFILE
2004-03-10 03:47:07 +08:00
ngx_regex_cont=' '
ngx_cont=' '
ngx_tab=' '
2003-11-26 04:44:56 +08:00
2004-03-05 16:34:24 +08:00
fi
# ALL_INCS, required by OpenWatcom C precompiled headers
2003-11-26 04:44:56 +08:00
ngx_incs=`echo $CORE_INCS $OBJS $HTTP_INCS $IMAP_INCS\
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
-e "s/\//$ngx_regex_dirsep/g"`
2003-11-26 04:44:56 +08:00
cat << END >> $NGX_MAKEFILE
2004-03-05 16:34:24 +08:00
ALL_INCS = $ngx_include_opt$ngx_incs
2003-11-26 04:44:56 +08:00
END
2003-11-26 04:44:56 +08:00
ngx_all_srcs="$CORE_SRCS"
2004-03-05 16:34:24 +08:00
# the core dependences and include pathes
2004-03-05 16:34:24 +08:00
ngx_deps=`echo $CORE_DEPS $NGX_PCH \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
-e "s/\//$ngx_regex_dirsep/g"`
2004-03-05 16:34:24 +08:00
ngx_incs=`echo $CORE_INCS $OBJS \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
-e "s/\//$ngx_regex_dirsep/g"`
2003-11-26 04:44:56 +08:00
cat << END >> $NGX_MAKEFILE
2004-03-05 16:34:24 +08:00
CORE_DEPS = $ngx_deps
2004-03-05 16:34:24 +08:00
CORE_INCS = $ngx_include_opt$ngx_incs
END
# the http dependences and include pathes
if [ $HTTP = YES ]; then
2003-11-26 04:44:56 +08:00
ngx_all_srcs="$ngx_all_srcs $HTTP_SRCS"
2003-11-26 04:44:56 +08:00
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
fi
# the imap dependences and include pathes
if [ $IMAP = YES ]; then
ngx_all_srcs="$ngx_all_srcs $IMAP_SRCS"
2003-11-26 04:44:56 +08:00
ngx_deps=`echo $IMAP_DEPS \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
-e "s/\//$ngx_regex_dirsep/g"`
2003-11-26 04:44:56 +08:00
ngx_incs=`echo $IMAP_INCS \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
-e "s/\//$ngx_regex_dirsep/g"`
2004-03-05 16:34:24 +08:00
cat << END >> $NGX_MAKEFILE
2004-03-05 16:34:24 +08:00
IMAP_DEPS = $ngx_deps
2004-03-05 16:34:24 +08:00
2003-11-26 04:44:56 +08:00
IMAP_INCS = $ngx_include_opt$ngx_incs
2004-03-04 15:04:55 +08:00
END
2003-11-26 04:44:56 +08:00
fi
2004-03-04 15:04:55 +08:00
2004-03-05 16:34:24 +08:00
# nginx
2004-03-05 16:34:24 +08:00
ngx_all_srcs=`echo $ngx_all_srcs | sed -e "s/\//$ngx_regex_dirsep/g"`
ngx_modules_c=`echo $NGX_MODULES_C | sed -e "s/\//$ngx_regex_dirsep/g"`
2004-03-05 16:34:24 +08:00
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"`
2003-11-26 04:44:56 +08:00
ngx_modules_obj=`echo $ngx_modules_c | sed -e "s/\(.*\.\)c/\1$ngx_objext/"`
2004-03-05 16:34:24 +08:00
ngx_deps=`echo $ngx_all_objs $ngx_modules_obj $LINK_DEPS \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
-e "s/\//$ngx_regex_dirsep/g"`
2003-11-26 04:44:56 +08:00
ngx_objs=`echo $ngx_all_objs $ngx_modules_obj \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
-e "s/\//$ngx_regex_dirsep/g"`
2004-03-04 15:04:55 +08:00
ngx_libs=${CORE_LIBS:+`echo $NGX_LD_OPT $CORE_LIBS \
| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_regex_cont/"`}
2003-11-26 04:44:56 +08:00
ngx_link=${CORE_LINK:+`echo $CORE_LINK \
| sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_regex_cont/"`}
2004-03-05 16:34:24 +08:00
cat << END >> $NGX_MAKEFILE
2004-03-05 16:34:24 +08:00
$NGX_OBJS${ngx_dirsep}nginx${ngx_binext}: $ngx_deps$ngx_spacer
\$(LINK) ${ngx_binout}$NGX_OBJS${ngx_dirsep}nginx$ngx_cont$ngx_objs$ngx_libs$ngx_link
2003-11-26 04:44:56 +08:00
END
2004-03-05 16:34:24 +08:00
# ngx_modules.c
2003-11-26 04:44:56 +08:00
if test -n "$NGX_PCH"; then
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
2004-03-10 03:47:07 +08:00
else
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS)"
2004-03-10 03:47:07 +08:00
fi
2003-11-26 04:44:56 +08:00
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
2003-11-26 04:44:56 +08:00
END
2003-11-26 04:44:56 +08:00
# the core sources
for ngx_src in $CORE_SRCS
2003-11-26 04:44:56 +08:00
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
END
2003-11-26 04:44:56 +08:00
done
# the http sources
2004-03-05 16:34:24 +08:00
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)"
fi
for ngx_src in $HTTP_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) \$(HTTP_DEPS)$ngx_cont$ngx_src
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src
END
done
2004-03-10 03:47:07 +08:00
fi
2003-11-26 04:44:56 +08:00
2004-03-05 16:34:24 +08:00
# the imap sources
if [ $IMAP = YES ]; then
if test -n "$NGX_PCH"; then
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
2004-03-05 16:34:24 +08:00
else
ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(IMAP_INCS)"
2004-03-05 16:34:24 +08:00
fi
for ngx_src in $IMAP_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) \$(IMAP_DEPS)$ngx_cont$ngx_src
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src
END
done
fi
2004-03-10 03:47:07 +08:00
# the precompiled headers
if test -n "$NGX_PCH"; then
echo "#include <ngx_config.h>" > $OBJS/ngx_pch.c
ngx_pch="src/core/ngx_config.h $OS_CONFIG $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$OBJS/ngx_pch.obj $OBJS/ngx_pch.c"
ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
cat << END >> $NGX_MAKEFILE
2004-03-10 03:47:07 +08:00
$ngx_pch
$ngx_src
2004-03-10 03:47:07 +08:00
END
2004-03-10 03:47:07 +08:00
fi