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