make 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  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 eval ngx_module_libs="\\\"\$${ngx_module}_LIBS\\\""
  319. eval ngx_module_modules="\$${ngx_module}_MODULES"
  320. eval ngx_module_order="\$${ngx_module}_ORDER"
  321. ngx_modules_c=$NGX_OBJS/${ngx_module}_modules.c
  322. cat << END > $ngx_modules_c
  323. #include <ngx_config.h>
  324. #include <ngx_core.h>
  325. END
  326. for mod in $ngx_module_modules
  327. do
  328. echo "extern ngx_module_t $mod;" >> $ngx_modules_c
  329. done
  330. echo >> $ngx_modules_c
  331. echo 'ngx_module_t *ngx_modules[] = {' >> $ngx_modules_c
  332. for mod in $ngx_module_modules
  333. do
  334. echo " &$mod," >> $ngx_modules_c
  335. done
  336. cat << END >> $ngx_modules_c
  337. NULL
  338. };
  339. END
  340. echo 'char *ngx_module_names[] = {' >> $ngx_modules_c
  341. for mod in $ngx_module_modules
  342. do
  343. echo " \"$mod\"," >> $ngx_modules_c
  344. done
  345. cat << END >> $ngx_modules_c
  346. NULL
  347. };
  348. END
  349. echo 'char *ngx_module_order[] = {' >> $ngx_modules_c
  350. for mod in $ngx_module_order
  351. do
  352. echo " \"$mod\"," >> $ngx_modules_c
  353. done
  354. cat << END >> $ngx_modules_c
  355. NULL
  356. };
  357. END
  358. ngx_modules_c=`echo $ngx_modules_c | sed -e "s/\//$ngx_regex_dirsep/g"`
  359. ngx_modules_obj=`echo $ngx_modules_c \
  360. | sed -e "s/\(.*\.\)c/\1$ngx_objext/"`
  361. ngx_module_objs=
  362. for ngx_src in $ngx_module_srcs
  363. do
  364. case "$ngx_src" in
  365. src/*)
  366. ngx_obj=$ngx_src
  367. ;;
  368. *)
  369. ngx_obj="addon/`basename \`dirname $ngx_src\``"
  370. mkdir -p $NGX_OBJS/$ngx_obj
  371. ngx_obj="$ngx_obj/`basename $ngx_src`"
  372. ;;
  373. esac
  374. ngx_module_objs="$ngx_module_objs $ngx_obj"
  375. done
  376. ngx_module_objs=`echo $ngx_module_objs \
  377. | sed -e "s#\([^ ]*\.\)cpp#$NGX_OBJS\/\1$ngx_objext#g" \
  378. -e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \
  379. -e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g" \
  380. -e "s#\([^ ]*\.\)S#$NGX_OBJS\/\1$ngx_objext#g"`
  381. ngx_deps=`echo $ngx_module_objs $ngx_modules_obj $LINK_DEPS \
  382. | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
  383. -e "s/\//$ngx_regex_dirsep/g"`
  384. ngx_objs=`echo $ngx_module_objs $ngx_modules_obj \
  385. | sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
  386. -e "s/\//$ngx_regex_dirsep/g"`
  387. ngx_obj=$NGX_OBJS$ngx_dirsep$ngx_module$ngx_modext
  388. if [ "$NGX_PLATFORM" = win32 ]; then
  389. ngx_module_libs="$CORE_LIBS $ngx_module_libs"
  390. fi
  391. ngx_libs=
  392. if test -n "$NGX_LD_OPT$ngx_module_libs"; then
  393. ngx_libs=`echo $NGX_LD_OPT $ngx_module_libs \
  394. | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`
  395. fi
  396. ngx_link=${CORE_LINK:+`echo $CORE_LINK \
  397. | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
  398. ngx_module_link=${MODULE_LINK:+`echo $MODULE_LINK \
  399. | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
  400. cat << END >> $NGX_MAKEFILE
  401. modules: $ngx_obj
  402. $ngx_obj: $ngx_deps$ngx_spacer
  403. \$(LINK) $ngx_long_start$ngx_binout$ngx_obj$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_module_link
  404. $ngx_long_end
  405. $ngx_modules_obj: \$(CORE_DEPS)$ngx_cont$ngx_modules_c
  406. $ngx_cc$ngx_tab$ngx_objout$ngx_modules_obj$ngx_tab$ngx_modules_c$NGX_AUX
  407. END
  408. for ngx_source in $ngx_module_srcs
  409. do
  410. case "$ngx_source" in
  411. src/*)
  412. ngx_obj=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
  413. ;;
  414. *)
  415. ngx_obj="addon/`basename \`dirname $ngx_source\``"
  416. ngx_obj=`echo $ngx_obj/\`basename $ngx_source\` \
  417. | sed -e "s/\//$ngx_regex_dirsep/g"`
  418. ;;
  419. esac
  420. ngx_obj=`echo $ngx_obj \
  421. | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
  422. -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
  423. -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
  424. -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
  425. ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
  426. if [ $ngx_source = src/http/modules/perl/ngx_http_perl_module.c ]; then
  427. cat << END >> $NGX_MAKEFILE
  428. $ngx_obj: \$(ADDON_DEPS)$ngx_cont$ngx_src
  429. $ngx_perl_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
  430. END
  431. else
  432. cat << END >> $NGX_MAKEFILE
  433. $ngx_obj: \$(ADDON_DEPS)$ngx_cont$ngx_src
  434. $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
  435. END
  436. fi
  437. done
  438. done