make 18 KB

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