File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / nginx / auto / make
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 09:20:38 2013 UTC (11 years ago) by misho
Branches: nginx, MAIN
CVS tags: v1_4_3p0, v1_4_3, HEAD
v 1.4.3

    1: 
    2: # Copyright (C) Igor Sysoev
    3: # Copyright (C) Nginx, Inc.
    4: 
    5: 
    6: echo "creating $NGX_MAKEFILE"
    7: 
    8: mkdir -p $NGX_OBJS/src/core $NGX_OBJS/src/event $NGX_OBJS/src/event/modules \
    9:          $NGX_OBJS/src/os/unix $NGX_OBJS/src/os/win32 \
   10:          $NGX_OBJS/src/http $NGX_OBJS/src/http/modules \
   11: 	 $NGX_OBJS/src/http/modules/perl \
   12:          $NGX_OBJS/src/mail \
   13:          $NGX_OBJS/src/misc
   14: 
   15: 
   16: ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep
   17: ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"`
   18: 
   19: 
   20: cat << END                                                     > $NGX_MAKEFILE
   21: 
   22: CC =	$CC
   23: CFLAGS = $CFLAGS
   24: CPP =	$CPP
   25: LINK =	$LINK
   26: 
   27: END
   28: 
   29: 
   30: if test -n "$NGX_PERL_CFLAGS"; then
   31:     echo NGX_PERL_CFLAGS = $NGX_PERL_CFLAGS                   >> $NGX_MAKEFILE
   32:     echo NGX_PM_CFLAGS = $NGX_PM_CFLAGS                       >> $NGX_MAKEFILE
   33: fi
   34: 
   35: 
   36: # ALL_INCS, required by the addons and by OpenWatcom C precompiled headers
   37: 
   38: ngx_incs=`echo $CORE_INCS $NGX_OBJS $HTTP_INCS $MAIL_INCS\
   39:     | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
   40:           -e "s/\//$ngx_regex_dirsep/g"`
   41: 
   42: cat << END                                                    >> $NGX_MAKEFILE
   43: 
   44: ALL_INCS = $ngx_include_opt$ngx_incs
   45: 
   46: END
   47: 
   48: 
   49: ngx_all_srcs="$CORE_SRCS"
   50: 
   51: 
   52: # the core dependences and include paths
   53: 
   54: ngx_deps=`echo $CORE_DEPS $NGX_AUTO_CONFIG_H $NGX_PCH \
   55:     | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
   56:           -e "s/\//$ngx_regex_dirsep/g"`
   57: 
   58: ngx_incs=`echo $CORE_INCS $NGX_OBJS \
   59:     | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
   60:           -e "s/\//$ngx_regex_dirsep/g"`
   61: 
   62: cat << END                                                    >> $NGX_MAKEFILE
   63: 
   64: CORE_DEPS = $ngx_deps
   65: 
   66: 
   67: CORE_INCS = $ngx_include_opt$ngx_incs
   68: 
   69: END
   70: 
   71: 
   72: # the http dependences and include paths
   73: 
   74: if [ $HTTP = YES ]; then
   75: 
   76:     ngx_all_srcs="$ngx_all_srcs $HTTP_SRCS"
   77: 
   78:     ngx_deps=`echo $HTTP_DEPS \
   79:         | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
   80:               -e "s/\//$ngx_regex_dirsep/g"`
   81: 
   82:     ngx_incs=`echo $HTTP_INCS \
   83:         | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
   84:               -e "s/\//$ngx_regex_dirsep/g"`
   85: 
   86:     cat << END                                                >> $NGX_MAKEFILE
   87: 
   88: HTTP_DEPS = $ngx_deps
   89: 
   90: 
   91: HTTP_INCS = $ngx_include_opt$ngx_incs
   92: 
   93: END
   94: 
   95: fi
   96: 
   97: 
   98: # the mail dependences and include paths
   99: 
  100: if [ $MAIL = YES ]; then
  101: 
  102:     ngx_all_srcs="$ngx_all_srcs $MAIL_SRCS"
  103: 
  104:     ngx_deps=`echo $MAIL_DEPS \
  105:         | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
  106:               -e "s/\//$ngx_regex_dirsep/g"`
  107: 
  108:     ngx_incs=`echo $MAIL_INCS \
  109:         | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
  110:               -e "s/\//$ngx_regex_dirsep/g"`
  111: 
  112:     cat << END                                                >> $NGX_MAKEFILE
  113: 
  114: MAIL_DEPS = $ngx_deps
  115: 
  116: 
  117: MAIL_INCS = $ngx_include_opt$ngx_incs
  118: 
  119: END
  120: 
  121: fi
  122: 
  123: 
  124: ngx_all_srcs="$ngx_all_srcs $NGX_MISC_SRCS"
  125: 
  126: 
  127: if test -n "$NGX_ADDON_SRCS"; then
  128: 
  129: cat << END                                                >> $NGX_MAKEFILE
  130: 
  131: ADDON_DEPS = \$(CORE_DEPS) $NGX_ADDON_DEPS
  132: 
  133: END
  134: 
  135: fi
  136: 
  137: 
  138: # nginx
  139: 
  140: ngx_all_srcs=`echo $ngx_all_srcs | sed -e "s/\//$ngx_regex_dirsep/g"`
  141: 
  142: for ngx_src in $NGX_ADDON_SRCS
  143: do
  144:     ngx_obj="addon/`basename \`dirname $ngx_src\``"
  145: 
  146:     test -d $NGX_OBJS/$ngx_obj || mkdir -p $NGX_OBJS/$ngx_obj
  147: 
  148:     ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \
  149:         | sed -e "s/\//$ngx_regex_dirsep/g"`
  150: 
  151:     ngx_all_srcs="$ngx_all_srcs $ngx_obj"
  152: done
  153: 
  154: ngx_all_objs=`echo $ngx_all_srcs \
  155:     | sed -e "s#\([^ ]*\.\)cpp#$NGX_OBJS\/\1$ngx_objext#g" \
  156:           -e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \
  157:           -e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g" \
  158:           -e "s#\([^ ]*\.\)S#$NGX_OBJS\/\1$ngx_objext#g"`
  159: 
  160: ngx_modules_c=`echo $NGX_MODULES_C | sed -e "s/\//$ngx_regex_dirsep/g"`
  161: 
  162: ngx_modules_obj=`echo $ngx_modules_c | sed -e "s/\(.*\.\)c/\1$ngx_objext/"`
  163: 
  164: 
  165: if test -n "$NGX_RES"; then
  166:    ngx_res=$NGX_RES
  167: else
  168:    ngx_res="$NGX_RC $NGX_ICONS"
  169:    ngx_rcc=`echo $NGX_RCC | sed -e "s/\//$ngx_regex_dirsep/g"`
  170: fi
  171: 
  172: ngx_deps=`echo $ngx_all_objs $ngx_modules_obj $ngx_res $LINK_DEPS \
  173:     | sed -e "s/  *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
  174:           -e "s/\//$ngx_regex_dirsep/g"`
  175: 
  176: ngx_objs=`echo $ngx_all_objs $ngx_modules_obj \
  177:     | sed -e "s/  *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
  178:           -e "s/\//$ngx_regex_dirsep/g"`
  179: 
  180: if test -n "$NGX_LD_OPT$CORE_LIBS"; then
  181:     ngx_libs=`echo $NGX_LD_OPT $CORE_LIBS \
  182:         | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`
  183: fi
  184: 
  185: ngx_link=${CORE_LINK:+`echo $CORE_LINK \
  186:     | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
  187: 
  188: 
  189: cat << END                                                    >> $NGX_MAKEFILE
  190: 
  191: $NGX_OBJS${ngx_dirsep}nginx${ngx_binext}:	$ngx_deps$ngx_spacer
  192: 	\$(LINK) ${ngx_long_start}${ngx_binout}$NGX_OBJS${ngx_dirsep}nginx$ngx_long_cont$ngx_objs$ngx_libs$ngx_link
  193: 	$ngx_rcc
  194: ${ngx_long_end}
  195: END
  196: 
  197: 
  198: # ngx_modules.c
  199: 
  200: if test -n "$NGX_PCH"; then
  201:     ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
  202: else
  203:     ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS)"
  204: fi
  205: 
  206: cat << END                                                    >> $NGX_MAKEFILE
  207: 
  208: $ngx_modules_obj:	\$(CORE_DEPS)$ngx_cont$ngx_modules_c
  209: 	$ngx_cc$ngx_tab$ngx_objout$ngx_modules_obj$ngx_tab$ngx_modules_c$NGX_AUX
  210: 
  211: END
  212: 
  213: 
  214: # the core sources
  215: 
  216: for ngx_src in $CORE_SRCS
  217: do
  218:     ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
  219:     ngx_obj=`echo $ngx_src \
  220:         | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
  221:               -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
  222:               -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
  223:               -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
  224: 
  225:     cat << END                                                >> $NGX_MAKEFILE
  226: 
  227: $ngx_obj:	\$(CORE_DEPS)$ngx_cont$ngx_src
  228: 	$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
  229: 
  230: END
  231: 
  232: done
  233: 
  234: 
  235: # the http sources
  236: 
  237: if [ $HTTP = YES ]; then
  238: 
  239:     if test -n "$NGX_PCH"; then
  240:         ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
  241:     else
  242:         ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(HTTP_INCS)"
  243:         ngx_perl_cc="\$(CC) $ngx_compile_opt \$(NGX_PERL_CFLAGS) "
  244:         ngx_perl_cc="$ngx_perl_cc \$(CORE_INCS) \$(HTTP_INCS)"
  245:     fi
  246: 
  247:     for ngx_source in $HTTP_SRCS
  248:     do
  249:         ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
  250:         ngx_obj=`echo $ngx_src \
  251:             | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
  252:                   -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
  253:                   -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
  254:                   -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
  255: 
  256:         if [ $ngx_source = src/http/modules/perl/ngx_http_perl_module.c ]; then
  257: 
  258:             cat << END                                        >> $NGX_MAKEFILE
  259: 
  260: $ngx_obj:	\$(CORE_DEPS) \$(HTTP_DEPS)$ngx_cont$ngx_src
  261: 	$ngx_perl_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
  262: 
  263: END
  264:         else
  265: 
  266:             cat << END                                        >> $NGX_MAKEFILE
  267: 
  268: $ngx_obj:	\$(CORE_DEPS) \$(HTTP_DEPS)$ngx_cont$ngx_src
  269: 	$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
  270: 
  271: END
  272: 
  273:         fi
  274:      done
  275: 
  276: fi
  277: 
  278: 
  279: # the mail sources
  280: 
  281: if [ $MAIL = YES ]; then
  282: 
  283:     if test -n "$NGX_PCH"; then
  284:         ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
  285:     else
  286:         ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(MAIL_INCS)"
  287:     fi
  288: 
  289:     for ngx_src in $MAIL_SRCS
  290:     do
  291:         ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
  292:         ngx_obj=`echo $ngx_src \
  293:             | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
  294:                   -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
  295:                   -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
  296:                   -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
  297: 
  298:         cat << END                                            >> $NGX_MAKEFILE
  299: 
  300: $ngx_obj:	\$(CORE_DEPS) \$(MAIL_DEPS)$ngx_cont$ngx_src
  301: 	$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
  302: 
  303: END
  304:      done
  305: 
  306: fi
  307: 
  308: 
  309: # the misc sources
  310: 
  311: if test -n "$NGX_MISC_SRCS"; then
  312: 
  313:     ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
  314: 
  315:     for ngx_src in $NGX_MISC_SRCS
  316:     do
  317:         ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
  318:         ngx_obj=`echo $ngx_src \
  319:             | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
  320:                   -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
  321:                   -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
  322:                   -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
  323: 
  324:         cat << END                                            >> $NGX_MAKEFILE
  325: 
  326: $ngx_obj:	\$(CORE_DEPS) $ngx_cont$ngx_src
  327: 	$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
  328: 
  329: END
  330:      done
  331: 
  332: fi
  333: 
  334: 
  335: # the addons sources
  336: 
  337: if test -n "$NGX_ADDON_SRCS"; then
  338: 
  339:     ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)"
  340: 
  341:     for ngx_src in $NGX_ADDON_SRCS
  342:     do
  343:         ngx_obj="addon/`basename \`dirname $ngx_src\``"
  344: 
  345:         ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \
  346:             | sed -e "s/\//$ngx_regex_dirsep/g"`
  347: 
  348:         ngx_obj=`echo $ngx_obj \
  349:             | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
  350:                   -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
  351:                   -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
  352:                   -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
  353: 
  354:         ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
  355: 
  356:         cat << END                                            >> $NGX_MAKEFILE
  357: 
  358: $ngx_obj:	\$(ADDON_DEPS)$ngx_cont$ngx_src
  359: 	$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
  360: 
  361: END
  362:      done
  363: 
  364: fi
  365: 
  366: 
  367: # the addons config.make
  368: 
  369: if test -n "$NGX_ADDONS"; then
  370: 
  371:     for ngx_addon_dir in $NGX_ADDONS
  372:     do
  373:         if test -f $ngx_addon_dir/config.make; then
  374:             . $ngx_addon_dir/config.make
  375:         fi
  376:     done
  377: fi
  378: 
  379: 
  380: # Win32 resource file
  381: 
  382: if test -n "$NGX_RES"; then
  383: 
  384:     ngx_res=`echo "$NGX_RES:	$NGX_RC $NGX_ICONS" \
  385:                  | sed -e "s/\//$ngx_regex_dirsep/g"`
  386:     ngx_rcc=`echo $NGX_RCC | sed -e "s/\//$ngx_regex_dirsep/g"`
  387: 
  388:     cat << END                                                >> $NGX_MAKEFILE
  389: 
  390: $ngx_res
  391: 	$ngx_rcc
  392: 
  393: END
  394: 
  395: fi
  396: 
  397: 
  398: # the precompiled headers
  399: 
  400: if test -n "$NGX_PCH"; then
  401:     echo "#include <ngx_config.h>" > $NGX_OBJS/ngx_pch.c
  402: 
  403:     ngx_pch="src/core/ngx_config.h $OS_CONFIG $NGX_OBJS/ngx_auto_config.h"
  404:     ngx_pch=`echo "$NGX_PCH:	$ngx_pch" | sed -e "s/\//$ngx_regex_dirsep/g"`
  405: 
  406:     ngx_src="\$(CC) \$(CFLAGS) $NGX_BUILD_PCH $ngx_compile_opt \$(ALL_INCS)"
  407:     ngx_src="$ngx_src $ngx_objout$NGX_OBJS/ngx_pch.obj $NGX_OBJS/ngx_pch.c"
  408:     ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
  409: 
  410:     cat << END                                                >> $NGX_MAKEFILE
  411: 
  412: $ngx_pch
  413: 	$ngx_src
  414: 
  415: END
  416: 
  417: fi

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>