nginx/auto/make

361 lines
11 KiB
Plaintext
Raw Normal View History

2003-11-25 14:44:56 -06:00
# Copyright (C) Igor Sysoev
2003-11-25 14:44:56 -06: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-25 14:44:56 -06:00
2004-03-05 02:34:24 -06:00
echo "CC = $CC" > $MAKEFILE
2004-03-11 15:34:52 -06:00
echo "CPP = $CPP" >> $MAKEFILE
2004-03-09 13:47:07 -06:00
echo "LINK = $LINK" >> $MAKEFILE
2004-03-25 14:03:02 -06:00
if [ "$CC" = wcl386 ]; then
2004-03-09 13:47:07 -06:00
echo MAKE = wmake >> $MAKEFILE
fi
2004-03-05 02:34:24 -06:00
echo "CFLAGS = $CFLAGS" >> $MAKEFILE
echo >> $MAKEFILE
2003-11-25 14:44:56 -06:00
2004-03-09 13:47:07 -06:00
if [ $MAKE_SL = YES ]; then
echo >> $MAKEFILE
fi
all_inc="$CORE_INCS $OBJS $HTTP_INCS $IMAP_INCS"
2004-03-29 11:43:58 -06:00
all_inc=`echo " $all_inc" | sed -e "s/ \([^ ]\)/ $INCOPT\1/g"`
all_inc=`echo $all_inc | sed -e "s/\//$DIRSEP/g"`
2004-03-09 13:47:07 -06:00
echo "ALL_INCS = $all_inc" >> $MAKEFILE
echo >> $MAKEFILE
all_srcs="$CORE_SRCS"
2004-03-09 13:47:07 -06:00
2004-03-05 02:34:24 -06:00
# CORE_DEPS
2003-11-25 14:44:56 -06:00
2004-03-05 02:34:24 -06:00
if [ $MAKE_SL = YES ]; then
echo $ngx_n "CORE_DEPS =" $ngx_c >> $MAKEFILE
else
echo "CORE_DEPS = \\" >> $MAKEFILE
fi
for dep in $CORE_DEPS
2003-11-25 14:44:56 -06:00
do
2004-03-29 11:43:58 -06:00
dep=`echo $dep | sed -e "s/\//$DIRSEP/g"`
2004-03-05 02:34:24 -06:00
if [ $MAKE_SL = YES ]; then
echo $ngx_n " $dep" $ngx_c >> $MAKEFILE
else
echo " $dep \\" >> $MAKEFILE
fi
2003-11-25 14:44:56 -06:00
done
2004-03-05 02:34:24 -06:00
echo >> $MAKEFILE
2003-11-25 14:44:56 -06:00
2004-03-05 02:34:24 -06:00
# CORE_INCS
if [ $MAKE_SL = YES ]; then
echo >> $MAKEFILE
fi
2003-11-25 14:44:56 -06:00
2004-03-29 11:43:58 -06:00
inc="$CORE_INCS $OBJS"
inc=`echo " $inc" | sed -e "s/ \([^ ]\)/ $INCOPT\1/g" -e "s/\//$DIRSEP/g"`
2003-11-25 14:44:56 -06:00
2004-03-05 02:34:24 -06:00
echo "CORE_INCS = $inc" >> $MAKEFILE
echo >> $MAKEFILE
2003-11-25 14:44:56 -06:00
2004-03-05 02:34:24 -06:00
if [ $HTTP = YES ]; then
2004-03-05 02:34:24 -06:00
all_srcs="$all_srcs $HTTP_SRCS"
2004-03-05 02:34:24 -06:00
# HTTP_DEPS
2004-03-05 02:34:24 -06:00
if [ $MAKE_SL = YES ]; then
echo $ngx_n "HTTP_DEPS =" $ngx_c >> $MAKEFILE
2004-03-05 02:34:24 -06:00
else
echo "HTTP_DEPS = \\" >> $MAKEFILE
2004-03-05 02:34:24 -06:00
fi
2003-11-25 14:44:56 -06:00
for dep in $HTTP_DEPS
do
dep=`echo $dep | sed -e "s/\//$DIRSEP/g"`
2004-03-05 02:34:24 -06:00
if [ $MAKE_SL = YES ]; then
echo $ngx_n " $dep" $ngx_c >> $MAKEFILE
else
echo " $dep \\" >> $MAKEFILE
fi
done
echo >> $MAKEFILE
2004-03-05 02:34:24 -06:00
# HTTP_INCS
if [ $MAKE_SL = YES ]; then
echo >> $MAKEFILE
fi
inc="$HTTP_INCS $OBJS"
inc=`echo " $inc" | sed -e "s/ \([^ ]\)/ $INCOPT\1/g" -e "s/\//$DIRSEP/g"`
echo "HTTP_INCS = $inc" >> $MAKEFILE
2004-03-05 02:34:24 -06:00
echo >> $MAKEFILE
2004-03-04 10:34:23 -06:00
fi
2003-11-25 14:44:56 -06:00
if [ $IMAP = YES ]; then
all_srcs="$all_srcs $IMAP_SRCS"
# IMAP_DEPS
if [ $MAKE_SL = YES ]; then
echo $ngx_n "IMAP_DEPS =" $ngx_c >> $MAKEFILE
else
echo "IMAP_DEPS = \\" >> $MAKEFILE
fi
for dep in $IMAP_DEPS
do
dep=`echo $dep | sed -e "s/\//$DIRSEP/g"`
if [ $MAKE_SL = YES ]; then
echo $ngx_n " $dep" $ngx_c >> $MAKEFILE
else
echo " $dep \\" >> $MAKEFILE
fi
done
echo >> $MAKEFILE
# IMAP_INCS
if [ $MAKE_SL = YES ]; then
echo >> $MAKEFILE
fi
inc="$IMAP_INCS $OBJS"
inc=`echo " $inc" | sed -e "s/ \([^ ]\)/ $INCOPT\1/g" -e "s/\//$DIRSEP/g"`
echo "IMAP_INCS = $inc" >> $MAKEFILE
echo >> $MAKEFILE
fi
2003-11-25 14:44:56 -06:00
2004-03-05 02:34:24 -06:00
# nginx
if [ $MAKE_SL = YES ]; then
2004-03-09 13:47:07 -06:00
echo $ngx_n "nginx$BINEXT: " $ngx_c >> $MAKEFILE
2004-03-05 02:34:24 -06:00
else
2004-03-09 13:47:07 -06:00
echo "nginx$BINEXT: \\" >> $MAKEFILE
2004-03-05 02:34:24 -06:00
fi
# nginx deps
2003-11-25 14:44:56 -06:00
for src in $all_srcs
2003-11-25 14:44:56 -06:00
do
2004-02-24 11:31:46 -06:00
obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\.S\$/.$OBJEXT/"`
2004-03-29 11:43:58 -06:00
obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"`
2004-03-04 01:04:55 -06:00
2004-03-05 02:34:24 -06:00
if [ $MAKE_SL = YES ]; then
echo $ngx_n " $obj" $ngx_c >> $MAKEFILE
else
echo " $obj \\" >> $MAKEFILE
fi
2003-11-25 14:44:56 -06:00
done
for src in $NGX_MODULES_C $LINK_DEPS
do
obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/"`
2004-03-29 11:43:58 -06:00
obj=`echo $obj | sed -e "s/\//$DIRSEP/g"`
2004-03-04 01:04:55 -06:00
2004-03-05 02:34:24 -06:00
if [ $MAKE_SL = YES ]; then
echo $ngx_n " $obj" $ngx_c >> $MAKEFILE
else
echo " $obj \\" >> $MAKEFILE
fi
2003-11-25 14:44:56 -06:00
done
2004-03-05 02:34:24 -06:00
echo >> $MAKEFILE
# nginx build
if [ $MAKE_SL = YES ]; then
2004-03-09 13:47:07 -06:00
echo $ngx_n " \$(LINK) ${BINOUT}nginx" $ngx_c >> $MAKEFILE
2004-03-05 02:34:24 -06:00
else
2004-03-09 13:47:07 -06:00
echo " \$(LINK) ${BINOUT}nginx \\" >> $MAKEFILE
2004-03-05 02:34:24 -06:00
fi
2003-11-25 14:44:56 -06:00
2004-03-05 02:34:24 -06:00
# nginx build sources
2003-11-25 14:44:56 -06:00
for src in $all_srcs
2003-11-25 14:44:56 -06:00
do
2004-02-24 11:31:46 -06:00
obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\.S\$/.$OBJEXT/"`
2004-03-29 11:43:58 -06:00
obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"`
2004-03-04 01:04:55 -06:00
2004-03-05 02:34:24 -06:00
if [ $MAKE_SL = YES ]; then
2004-03-05 10:37:51 -06:00
echo $ngx_n " $obj" $ngx_c >> $MAKEFILE
2004-03-05 02:34:24 -06:00
else
echo " $obj \\" >> $MAKEFILE
fi
2003-11-25 14:44:56 -06:00
done
2004-03-05 02:34:24 -06:00
# nginx build ngx_modules.c and libs
2004-03-29 11:43:58 -06:00
obj=`echo $NGX_MODULES_C | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\//$DIRSEP/g"`
src=`echo $NGX_MODULES_C | sed -e "s/\//$DIRSEP/g"`
libs=`echo $CORE_LIBS | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\//$DIRSEP/g"`
link=`echo $CORE_LINK | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\//$DIRSEP/g"`
2003-11-25 14:44:56 -06:00
2004-03-05 02:34:24 -06:00
if [ $MAKE_SL = YES ]; then
echo " $obj $libs $CORE_LINK" >> $MAKEFILE
echo >> $MAKEFILE
else
echo " $obj \\" >> $MAKEFILE
2004-03-29 11:43:58 -06:00
echo " $libs \\" >> $MAKEFILE
echo " $link" >> $MAKEFILE
2004-03-05 02:34:24 -06:00
echo >> $MAKEFILE
fi
# ngx_modules.c
2003-11-25 14:44:56 -06:00
deps="\$(CORE_DEPS)"
2004-03-09 13:47:07 -06:00
if [ $PCH != NO ]; then
args="\$(CFLAGS) $USEPCH \$(ALL_INCS)"
else
args="\$(CFLAGS) $USEPCH \$(CORE_INCS)"
fi
2003-11-25 14:44:56 -06:00
2004-03-05 02:34:24 -06:00
if [ $MAKE_SL = YES ]; then
echo "$obj: $NGX_MODULES_C $deps" >> $MAKEFILE
2004-03-29 11:43:58 -06:00
echo $ngx_n " \$(CC) $COMPOPT $args" $ngx_c >> $MAKEFILE
2004-03-05 02:34:24 -06:00
echo " $OBJOUT$obj $src" >> $MAKEFILE
echo >> $MAKEFILE
else
echo "$obj: \\" >> $MAKEFILE
echo " $NGX_MODULES_C $deps" >> $MAKEFILE
2004-03-29 11:43:58 -06:00
echo " \$(CC) $COMPOPT $args \\" >> $MAKEFILE
2004-03-05 02:34:24 -06:00
echo " $OBJOUT$obj \\" >> $MAKEFILE
echo " $src" >> $MAKEFILE
echo >> $MAKEFILE
fi
2003-11-25 14:44:56 -06:00
2004-03-05 02:34:24 -06:00
# core sources
2003-11-25 14:44:56 -06:00
for src in $CORE_SRCS
do
2004-02-24 11:31:46 -06:00
obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/" -e "s/\.S\$/.$OBJEXT/"`
2004-03-29 11:43:58 -06:00
obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"`
src=`echo $src | sed -e "s/\//$DIRSEP/g"`
2003-11-25 14:44:56 -06:00
2004-03-05 02:34:24 -06:00
if [ $MAKE_SL = YES ]; then
echo "$obj: $src $deps" >> $MAKEFILE
2004-03-29 11:43:58 -06:00
echo " \$(CC) $COMPOPT $args $OBJOUT$obj $src" >> $MAKEFILE
2004-03-05 02:34:24 -06:00
echo >> $MAKEFILE
else
echo "$obj: \\" >> $MAKEFILE
echo " $src $deps" >> $MAKEFILE
2004-03-29 11:43:58 -06:00
echo " \$(CC) $COMPOPT $args \\" >> $MAKEFILE
2004-03-05 02:34:24 -06:00
echo " $OBJOUT$obj \\" >> $MAKEFILE
echo " $src" >> $MAKEFILE
echo >> $MAKEFILE
fi
2003-11-25 14:44:56 -06:00
done
2004-03-05 02:34:24 -06:00
# http sources
if [ $HTTP = YES ]; then
deps="\$(CORE_DEPS) \$(HTTP_DEPS)"
if [ $PCH != NO ]; then
args="\$(CFLAGS) $USEPCH \$(ALL_INCS)"
else
args="\$(CFLAGS) $USEPCH \$(CORE_INCS) \$(HTTP_INCS)"
fi
for src in $HTTP_SRCS
do
obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/"`
obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"`
src=`echo $src | sed -e "s/\//$DIRSEP/g"`
if [ $MAKE_SL = YES ]; then
echo "$obj: $src $deps" >> $MAKEFILE
echo " \$(CC) $COMPOPT $args $OBJOUT$obj $src" >> $MAKEFILE
echo >> $MAKEFILE
else
echo "$obj: \\" >> $MAKEFILE
echo " $src $deps" >> $MAKEFILE
echo " \$(CC) $COMPOPT $args \\" >> $MAKEFILE
echo " $OBJOUT$obj \\" >> $MAKEFILE
echo " $src" >> $MAKEFILE
echo >> $MAKEFILE
fi
done
2004-03-09 13:47:07 -06:00
fi
2003-11-25 14:44:56 -06:00
2004-03-05 02:34:24 -06:00
# imap sources
if [ $IMAP = YES ]; then
deps="\$(CORE_DEPS) \$(IMAP_DEPS)"
if [ $PCH != NO ]; then
args="\$(CFLAGS) $USEPCH \$(ALL_INCS)"
2004-03-05 02:34:24 -06:00
else
args="\$(CFLAGS) $USEPCH \$(CORE_INCS) \$(IMAP_INCS)"
2004-03-05 02:34:24 -06:00
fi
for src in $IMAP_SRCS
do
obj=`echo $src | sed -e "s/\.c\$/.$OBJEXT/"`
obj=`echo $OBJS/$obj | sed -e "s/\//$DIRSEP/g"`
src=`echo $src | sed -e "s/\//$DIRSEP/g"`
if [ $MAKE_SL = YES ]; then
echo "$obj: $src $deps" >> $MAKEFILE
echo " \$(CC) $COMPOPT $args $OBJOUT$obj $src" >> $MAKEFILE
echo >> $MAKEFILE
else
echo "$obj: \\" >> $MAKEFILE
echo " $src $deps" >> $MAKEFILE
echo " \$(CC) $COMPOPT $args \\" >> $MAKEFILE
echo " $OBJOUT$obj \\" >> $MAKEFILE
echo " $src" >> $MAKEFILE
echo >> $MAKEFILE
fi
done
fi
2004-03-09 13:47:07 -06:00
# precompiled headers
if [ $PCH != NO ]; then
echo "#include <ngx_config.h>" > $OBJS/pch.c
pch="$PCH: src/core/ngx_config.h $OS_CONFIG $OBJS/ngx_auto_config.h"
2004-03-29 11:43:58 -06:00
pch=`echo $pch | sed -e "s/\//$DIRSEP/g"`
src="\$(CC) \$(CFLAGS) $BUILDPCH $COMPOPT \$(ALL_INCS)"
2004-03-09 13:47:07 -06:00
src="$src $OBJOUT$OBJS/pch.obj $OBJS/pch.c"
2004-03-29 11:43:58 -06:00
src=`echo $src | sed -e "s/\//$DIRSEP/g"`
2004-03-09 13:47:07 -06:00
echo "$pch" >> $MAKEFILE
echo " $src" >> $MAKEFILE
echo >> $MAKEFILE
fi