Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 361 lines (250 sloc) 10.058 kB
15594ea @ry Replace WAF with make/autoconf
ry authored
1 #config
90ab079 @ry Use --jobs=1 with WAF
ry authored
2
15594ea @ry Replace WAF with make/autoconf
ry authored
3 # define DEBUG=1 to build node_g
861f28f @ry Don't unnecessarily output the makefile from the configure script.
ry authored
4
15594ea @ry Replace WAF with make/autoconf
ry authored
5 WANT_OPENSSL=1
6 PREFIX=/usr
7 SHELL=/bin/sh
8 INSTALL = install
861f28f @ry Don't unnecessarily output the makefile from the configure script.
ry authored
9
10
15594ea @ry Replace WAF with make/autoconf
ry authored
11 -include config.mak.autogen
12 -include config.mak
bf0d278 @ry Improve "make dist" remove generated doc from repo.
ry authored
13
15594ea @ry Replace WAF with make/autoconf
ry authored
14
15 platform := $(shell python -c 'import sys; print sys.platform')
16
17
18 ifeq ($(platform),linux2)
19 platform := linux
20 endif
21
22 # fix me
23 arch = x86_64
24
25
26 ifeq ($(platform),darwin)
27 LINKFLAGS += -framework Carbon
28 endif
29
30 ifeq ($(platform),linux)
31 LINKFLAGS += -pthread -lrt
32 endif
33
34 ifdef WANT_OPENSSL
35 HAVE_OPENSSL = 1
36 HAVE_CRYPTO = 1
37 ifdef OPENSSL_DIR
38 OPENSSL_LINKFLAGS += -L$(OPENSSL_DIR)/lib
39 OPENSSL_CPPFLAGS += -I$(OPENSSL_DIR)/include
40 endif
41 OPENSSL_LINKFLAGS += -lssl -lcrypto
42 endif
43
44 cflags += -pedantic
45
46
47
48
49 debug_CPPDEFINES = -DDEBUG $(CFLAGS)
50 debug_CFLAGS = -Wall -O0 -ggdb $(CFLAGS)
51 debug_CXXFLAGS = $(debug_CFLAGS)
52 debug_LINKFLAGS = $(LINKFLAGS)
53
54 release_CPPDEFINES = -DNODEBUG
55 release_CFLAGS = -Wall -O2
56 release_CXXFLAGS = $(release_CFLAGS)
57 release_LINKFLAGS = $(LINKFLAGS)
58
59 builddir = build
60
61
62 libev_sources = deps/libev/ev.c
63 # Note: -I$(builddir)/deps/libev contains config.h which is generated from
64 # deps/libev/config.h.in during the configure script
65 libev_CPPFLAGS = -Ideps/libev -I$(builddir)/deps/libev
66 libev_release_objects = $(builddir)/release/deps/libev/ev.o
67 libev_debug_objects = $(builddir)/debug/deps/libev/ev.o
68
69 libeio_sources = deps/libeio/eio.c
70 libeio_release_objects = $(builddir)/release/deps/libeio/eio.o
71 libeio_debug_objects = $(builddir)/debug/deps/libeio/eio.o
72 # Note: -I$(builddir)/deps/libeio contains config.h which is generated from
73 # deps/libeio/config.h.in during the configure script
74 libeio_CPPFLAGS = -D_GNU_SOURCE -Ideps/libeio -I$(builddir)/deps/libeio
75
76 http_parser_sources = deps/http_parser/http_parser.c
77 http_parser_release_objects = $(builddir)/release/deps/http_parser/http_parser.o
78 http_parser_debug_objects = $(builddir)/debug/deps/http_parser/http_parser.o
79 http_parser_CPPFLAGS = -Ideps/http_parser
80
81 cares_sources = $(wildcard deps/c-ares/*.c)
82 cares_release_objects = $(addprefix $(builddir)/release/,$(cares_sources:.c=.o))
83 cares_debug_objects = $(addprefix $(builddir)/debug/,$(cares_sources:.c=.o))
84 cares_CPPFLAGS = -DHAVE_CONFIG_H=1 -Ideps/c-ares -Ideps/c-ares/$(platform)-$(arch)
85
86 node_sources = src/node.cc \
87 src/platform_$(platform).cc \
88 src/node_buffer.cc \
89 src/node_cares.cc \
90 src/node_child_process.cc \
91 src/node_constants.cc \
92 src/node_crypto.cc \
93 src/node_events.cc \
94 src/node_extensions.cc \
95 src/node_file.cc \
96 src/node_http_parser.cc \
97 src/node_idle_watcher.cc \
98 src/node_io_watcher.cc \
99 src/node_main.cc \
100 src/node_net.cc \
101 src/node_script.cc \
102 src/node_signal_watcher.cc \
103 src/node_stat_watcher.cc \
104 src/node_stdio.cc \
105 src/node_timer.cc \
106 src/node_javascript.cc \
107
108 node_debug_objects = $(addprefix $(builddir)/debug/,$(node_sources:.cc=.o))
109 node_release_objects = $(addprefix $(builddir)/release/,$(node_sources:.cc=.o))
110
111 # TODO HAVE_FDATASYNC should be set in configure.
112
113 node_CPPFLAGS = -Isrc/ -Ideps/libeio/ -Ideps/libev/ -Ideps/http_parser/ \
114 -Ideps/libev/include/ -Ideps/v8/include -DPLATFORM=\"$(platform)\" \
115 -DX_STACKSIZE=65536 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
116 -DHAVE_FDATASYNC=0 -I$(builddir)/release/src $(cares_CPPFLAGS)
117 node_debug_CPPFLAGS = $(subst release,debug,$(NODE_CPPFLAGS))
118
119 libv8 = $(builddir)/libv8.a
120 libv8_g = $(builddir)/libv8_g.a
121
122 dirs = $(builddir)/release/src \
123 $(builddir)/release/deps/libev \
124 $(builddir)/release/deps/libeio \
125 $(builddir)/release/deps/c-ares \
126 $(builddir)/release/deps/http_parser \
127 $(builddir)/release/deps/v8 \
128 $(builddir)/release/lib/pkgconfig
129 debug_dirs = $(subst release,debug,$(dirs))
130
131
132
133
134 # Rules
135
136 all: $(dirs) node
137
138 ifdef DEBUG
139 all: $(debug_dirs) node_g
140 endif
141
142
143 node: $(builddir)/node
144 ln -fs $< $@
145
146 node_g: $(builddir)/node_g
147 ln -fs $< $@
148
149
150
151 $(dirs) $(debug_dirs):
152 mkdir -p $@
153
154
155 # libev
156
157 $(builddir)/release/deps/libev/%.o: deps/libev/%.c
158 $(CC) -c $(release_CFLAGS) $(release_CPPFLAGS) $(libev_CFLAGS) \
159 $(libev_CPPFLAGS) $< -o $@
160
161 $(builddir)/debug/deps/libev/%.o: deps/libev/%.c
162 $(CC) -c $(debug_CFLAGS) $(debug_CPPFLAGS) $(libev_CFLAGS) \
163 $(libev_CPPFLAGS) $< -o $@
164
165
166 # libeio
167
168 $(builddir)/release/deps/libeio/%.o: deps/libeio/%.c
169 $(CC) -c $(release_CFLAGS) $(release_CPPFLAGS) $(libeio_CFLAGS) \
170 $(libeio_CPPFLAGS) $< -o $@
171
172 $(builddir)/debug/deps/libeio/%.o: deps/libeio/%.c
173 $(CC) -c $(debug_CFLAGS) $(debug_CPPFLAGS) $(libeio_CFLAGS) \
174 $(libeio_CPPFLAGS) $< -o $@
175
176
177 # http-parser
178
179 $(builddir)/release/deps/http_parser/%.o: deps/http_parser/%.c
180 $(CC) -c $(release_CFLAGS) $(release_CPPFLAGS) $(http_parser_CFLAGS) \
181 $(http_parser_CPPFLAGS) $< -o $@
182
183 $(builddir)/debug/deps/http_parser/%.o: deps/http_parser/%.c
184 $(CC) -c $(debug_CFLAGS) $(debug_CPPFLAGS) $(http_parser_CFLAGS) \
185 $(http_parser_CPPFLAGS) $< -o $@
186
187
188 # c-ares
189
190 $(builddir)/release/deps/c-ares/%.o: deps/c-ares/%.c
191 $(CC) -c $(release_CFLAGS) $(release_CPPFLAGS) $(cares_CFLAGS) \
192 $(cares_CPPFLAGS) $< -o $@
193
194 $(builddir)/debug/deps/c-ares/%.o: deps/c-ares/%.c
195 $(CC) -c $(debug_CFLAGS) $(debug_CPPFLAGS) $(cares_CFLAGS) \
196 $(cares_CPPFLAGS) $< -o $@
197
198
199 # node
200
201 $(builddir)/release/src/%.o: src/%.cc
202 $(CXX) -c $(release_CXXFLAGS) $(release_CPPFLAGS) $(node_CXXFLAGS) \
203 $(node_CPPFLAGS) $(OPENSSL_CPPFLAGS) $< -o $@
204
205 $(builddir)/debug/src/%.o: src/%.cc
206 $(CXX) -c $(debug_CXXFLAGS) $(debug_CPPFLAGS) $(node_CXXFLAGS) \
207 $(node_CPPFLAGS) $(OPENSSL_CPPFLAGS) $< -o $@
208
209
210 # node.o
211
212 $(builddir)/release/src/node.o: src/node.cc $(builddir)/release/src/node_natives.h
213 $(CXX) -c $(release_CXXFLAGS) $(release_CPPFLAGS) $(node_CFLAGS) \
214 $(node_CPPFLAGS) $(OPENSSL_CPPFLAGS) $< -o $@
215
216 $(builddir)/debug/src/node.o: src/node.cc $(builddir)/debug/src/node_natives.h
217 $(CXX) -c $(debug_CXXFLAGS) $(debug_CPPFLAGS) $(node_CFLAGS) \
218 $(node_CPPFLAGS) $(OPENSSL_CPPFLAGS) $< -o $@
219
220
221 # node executable
222
223 $(builddir)/node: $(node_release_objects) $(libev_release_objects) \
224 $(libeio_release_objects) $(http_parser_release_objects) \
225 $(cares_release_objects) $(libv8)
226 $(CXX) -o $@ $^ $(release_LINKFLAGS) $(node_LINKFLAGS) $(OPENSSL_LINKFLAGS)
227
228 $(builddir)/node_g: $(node_debug_objects) $(libev_debug_objects) \
229 $(libeio_debug_objects) $(http_parser_debug_objects) \
230 $(cares_debug_objects) $(libv8_g)
231 $(CXX) -o $@ $^ $(debug_LINKFLAGS) $(node_LINKFLAGS) $(OPENSSL_LINKFLAGS)
232
233
234
235 $(builddir)/release/src/node_natives.h: src/node.js lib/*.js
236 python tools/js2c.py $^ > $@
237
238 $(builddir)/debug/src/node_natives.h: src/node.js lib/*.js
239 python tools/js2c.py $^ > $@
240 # TODO a debug flag for the macros ?
241
242
243
244 $(builddir)/release/src/node_config.h: src/node_config.h.in
245 sed -e "s#@PREFIX@#$(PREFIX)#" \
246 -e "s#@CCFLAGS@#$(release_CFLAGS)#" \
247 -e "s#@CPPFLAGS@#$(release_CPPFLAGS)#" $< > $@ || rm $@
248
249 $(builddir)/debug/src/node_config.h: src/node_config.h.in
250 sed -e "s#@PREFIX@#$(PREFIX)#" \
251 -e "s#@CCFLAGS@#$(debug_CFLAGS)#" \
252 -e "s#@CPPFLAGS@#$(debug_CPPFLAGS)#" $< > $@ || rm $@
253
254
255 # FIXME convert to a generalized *.in preprocessor
256 $(builddir)/release/lib/pkgconfig/nodejs.pc: tools/nodejs.pc.in
257 sed \
258 -e "s#@PREFIX@#$(PREFIX)#" \
259 -e "s#@VERSION@#$(VERSION)#" \
260 -e "s#@CCFLAGS@#$(CFLAGS)#" \
261 -e "s#@CPPFLAGS@#$(CPPFLAGS)#" $< > $@ || rm $@
262
263 # v8 does its own debug and release version, so we don't put it in the
264 # profile_builddir but rather just the builddir.
265 $(libv8):
266 python tools/scons/scons.py -C $(builddir) -Y `pwd`/deps/v8 \
267 visibility=default mode=release arch=x64 library=static snapshot=on
268
269 $(libv8_g):
270 python tools/scons/scons.py -C $(builddir) -Y `pwd`/deps/v8 \
271 visibility=default mode=debug arch=x64 library=static snapshot=on
272
273
274 # header deps
275 $(builddir)/release/src/node.o: $(builddir)/release/src/node_config.h
276 $(builddir)/debug/src/node.o: $(builddir)/debug/src/node_config.h
277
278
279 # TODO install
280
281 test: $(builddir)/node
125b868 @ry Add message tests
ry authored
282 python tools/test.py --mode=release simple message
bf0d278 @ry Improve "make dist" remove generated doc from repo.
ry authored
283
15594ea @ry Replace WAF with make/autoconf
ry authored
284 test-all: $(builddir)/node $(builddir)/node_g
861f28f @ry Don't unnecessarily output the makefile from the configure script.
ry authored
285 python tools/test.py --mode=debug,release
286
15594ea @ry Replace WAF with make/autoconf
ry authored
287 test-release: $(builddir)/node
6670154 @ry 'make test' only runs the simple test
ry authored
288 python tools/test.py --mode=release
289
15594ea @ry Replace WAF with make/autoconf
ry authored
290 test-debug: $(builddir)/node_g
861f28f @ry Don't unnecessarily output the makefile from the configure script.
ry authored
291 python tools/test.py --mode=debug
292
15594ea @ry Replace WAF with make/autoconf
ry authored
293 test-message: $(builddir)/node
125b868 @ry Add message tests
ry authored
294 python tools/test.py message
295
15594ea @ry Replace WAF with make/autoconf
ry authored
296 test-simple: $(builddir)/node
04fac19 @arlolra Split tests.
arlolra authored
297 python tools/test.py simple
298
15594ea @ry Replace WAF with make/autoconf
ry authored
299 test-pummel: $(builddir)/node
04fac19 @arlolra Split tests.
arlolra authored
300 python tools/test.py pummel
301
15594ea @ry Replace WAF with make/autoconf
ry authored
302 test-internet: $(builddir)/node
04fac19 @arlolra Split tests.
arlolra authored
303 python tools/test.py internet
304
aa6a785 @ry Add note about where to find ronn
ry authored
305 # http://rtomayko.github.com/ronn
306 # gem install ronn
1db824a @ry Add changelog to website
ry authored
307 doc: doc/node.1 doc/api.html doc/index.html doc/changelog.html
861f28f @ry Don't unnecessarily output the makefile from the configure script.
ry authored
308
ee30267 @ry More documentation work. Remove long lines
ry authored
309 ## HACK to give the ronn-generated page a TOC
2b8a9a8 @kapouer Use ronnjs 0.2 to generate docs. Small cosmetic change.
kapouer authored
310 doc/api.html: all doc/api.markdown doc/api_header.html doc/api_footer.html
311 build/default/node tools/ronnjs/bin/ronn.js --fragment doc/api.markdown \
1a9c9b0 @felixge Bring back the old manual style
felixge authored
312 | sed "s/<h2>\(.*\)<\/h2>/<h2 id=\"\1\">\1<\/h2>/g" \
313 | cat doc/api_header.html - doc/api_footer.html > doc/api.html
861f28f @ry Don't unnecessarily output the makefile from the configure script.
ry authored
314
eb4951d @mranney Add proper HTML header for changelog so UTF-8 works.
mranney authored
315 doc/changelog.html: ChangeLog doc/changelog_header.html doc/changelog_footer.html
316 cat doc/changelog_header.html ChangeLog doc/changelog_footer.html > doc/changelog.html
1db824a @ry Add changelog to website
ry authored
317
abd3f8a @kapouer make node.1 depend on make all
kapouer authored
318 doc/node.1: doc/api.markdown all
2b8a9a8 @kapouer Use ronnjs 0.2 to generate docs. Small cosmetic change.
kapouer authored
319 build/default/node tools/ronnjs/bin/ronn.js --roff doc/api.markdown > doc/node.1
861f28f @ry Don't unnecessarily output the makefile from the configure script.
ry authored
320
321 website-upload: doc
4fcbc1b @ry Update make website-upload
ry authored
322 scp doc/* ryan@nodejs.org:~/web/nodejs.org/
861f28f @ry Don't unnecessarily output the makefile from the configure script.
ry authored
323
2c016ba @ry 'make distclean' should not call 'waf clean'
ry authored
324 docclean:
179f718 @creationix Conversion to markdown based API docs.
creationix authored
325 @-rm -f doc/node.1 doc/api.html doc/changelog.html
2c016ba @ry 'make distclean' should not call 'waf clean'
ry authored
326
d67fdcc @ry clean should not docclean
ry authored
327 clean:
15594ea @ry Replace WAF with make/autoconf
ry authored
328 -rm -f node node_g $(builddir)/node $(builddir)/node_g
329 -find $(builddir) -name "*.o" | xargs rm -f
330 -find . -name "*.pyc" | xargs rm -f
861f28f @ry Don't unnecessarily output the makefile from the configure script.
ry authored
331
ff64094 @ry Make 'make distclean' work on solaris
ry authored
332 distclean: docclean
15594ea @ry Replace WAF with make/autoconf
ry authored
333 -find tools -name "*.pyc" | xargs rm -f
334 -rm -rf build/ node node_g
335 -rm -rf configure config.mak.autogen config.log autom4te.cache config.status
861f28f @ry Don't unnecessarily output the makefile from the configure script.
ry authored
336
337
217b60a @ry sed -i 's/git-/git /g' Makefile
ry authored
338 VERSION=$(shell git describe)
bf0d278 @ry Improve "make dist" remove generated doc from repo.
ry authored
339 TARNAME=node-$(VERSION)
340
341 dist: doc/node.1 doc/api.html
ce2d5ad @ry Change the 'make dist' to remove v8 test dir
ry authored
342 git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
bf0d278 @ry Improve "make dist" remove generated doc from repo.
ry authored
343 mkdir -p $(TARNAME)/doc
344 cp doc/node.1 $(TARNAME)/doc/node.1
345 cp doc/api.html $(TARNAME)/doc/api.html
ce2d5ad @ry Change the 'make dist' to remove v8 test dir
ry authored
346 rm -rf $(TARNAME)/deps/v8/test # too big
347 tar -cf $(TARNAME).tar $(TARNAME)
348 rm -rf $(TARNAME)
bf0d278 @ry Improve "make dist" remove generated doc from repo.
ry authored
349 gzip -f -9 $(TARNAME).tar
861f28f @ry Don't unnecessarily output the makefile from the configure script.
ry authored
350
ff456b3 @ry Add 'make bench' script
ry authored
351 bench:
352 benchmark/http_simple_bench.sh
353
3cf4827 @ry Add idle connection test
ry authored
354 bench-idle:
355 ./node benchmark/idle_server.js &
356 sleep 1
357 ./node benchmark/idle_clients.js &
358
359
ff456b3 @ry Add 'make bench' script
ry authored
360 .PHONY: bench clean docclean dist distclean check uninstall install all test test-all website-upload
Something went wrong with that request. Please try again.