11 # Default to verbose builds.
12 # To do quiet/pretty builds, run `make V=` to set V to an empty string,
13 # or set the V environment variable to an empty string.
16 # BUILDTYPE=Debug builds both release and debug builds. If you want to compile
17 # just the debug build, run `make -C out BUILDTYPE=Debug` instead.
18 ifeq ($(BUILDTYPE),Release)
19 all: out/Makefile node
21 all: out/Makefile node node_g
24 # The .PHONY is needed to ensure that we recursively use the out/Makefile
25 # to check for changes.
30 $(NINJA) -C out/Release/
31 ln -fs out/Release/node node
34 $(NINJA) -C out/Debug/
35 ln -fs out/Debug/node $@
37 node: config.gypi out/Makefile
38 $(MAKE) -C out BUILDTYPE=Release V=$(V)
39 ln -fs out/Release/node node
41 node_g: config.gypi out/Makefile
42 $(MAKE) -C out BUILDTYPE=Debug V=$(V)
43 ln -fs out/Debug/node $@
46 out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp deps/zlib/zlib.gyp deps/v8/build/common.gypi deps/v8/tools/gyp/v8.gyp node.gyp config.gypi
49 $(PYTHON) tools/gyp_node -f ninja
51 $(PYTHON) tools/gyp_node -f make
54 config.gypi: configure
58 $(PYTHON) tools/install.py $@ $(DESTDIR)
61 $(PYTHON) tools/install.py $@ $(DESTDIR)
64 -rm -rf out/Makefile node node_g out/$(BUILDTYPE)/node blog.html email.md
65 -find out/ -name '*.o' -o -name '*.a' | xargs rm -rf
72 -rm -rf node node_g blog.html email.md
76 $(PYTHON) tools/test.py --mode=release simple message
80 $(PYTHON) tools/test.py --mode=release --use-http1 simple message
83 $(PYTHON) tools/test.py --mode=release --valgrind simple message
85 test/gc/node_modules/weak/build:
86 @if [ ! -f node ]; then make all; fi
87 ./node deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
88 --directory="$(shell pwd)/test/gc/node_modules/weak" \
89 --nodedir="$(shell pwd)"
91 test-gc: all test/gc/node_modules/weak/build
92 $(PYTHON) tools/test.py --mode=release gc
94 test-all: all test/gc/node_modules/weak/build
95 $(PYTHON) tools/test.py --mode=debug,release
99 $(PYTHON) tools/test.py --mode=debug,release --use-http1
101 test-all-valgrind: all
102 $(PYTHON) tools/test.py --mode=debug,release --valgrind
105 $(PYTHON) tools/test.py --mode=release
108 $(PYTHON) tools/test.py --mode=debug
111 $(PYTHON) tools/test.py message
114 $(PYTHON) tools/test.py simple
117 $(PYTHON) tools/test.py pummel
120 $(PYTHON) tools/test.py internet
123 ./node deps/npm/test/run.js
125 test-npm-publish: node
126 npm_package_config_publishtest=true ./node deps/npm/test/run.js
128 apidoc_sources = $(wildcard doc/api/*.markdown)
129 apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \
130 $(addprefix out/,$(apidoc_sources:.markdown=.json))
132 apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets out/doc/about out/doc/community out/doc/download out/doc/logos out/doc/images
134 apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
136 doc_images = $(addprefix out/,$(wildcard doc/images/* doc/*.jpg doc/*.png))
140 out/doc/v0.4_announcement.html \
143 out/doc/sh_javascript.min.js \
144 out/doc/sh_vim-dark.css \
146 out/doc/favicon.ico \
148 out/doc/about/index.html \
149 out/doc/community/index.html \
150 out/doc/download/index.html \
151 out/doc/logos/index.html \
152 out/doc/changelog.html \
155 doc: $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs) tools/doc/ blog node
160 blog: doc/blog out/Release/node tools/blog
161 out/Release/node tools/blog/generate.js doc/blog/ out/blog/ doc/blog.html doc/rss.xml
166 out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets/
169 out/doc/changelog.html: ChangeLog doc/changelog-head.html doc/changelog-foot.html tools/build-changelog.sh node
170 bash tools/build-changelog.sh
172 out/doc/%.html: doc/%.html node
173 cat $< | sed -e 's|__VERSION__|'$(VERSION)'|g' > $@
178 out/doc/api/%.json: doc/api/%.markdown node
179 out/Release/node tools/doc/generate.js --format=json $< > $@
181 out/doc/api/%.html: doc/api/%.markdown node
182 out/Release/node tools/doc/generate.js --format=html --template=doc/template.html $< > $@
184 email.md: ChangeLog tools/email-footer.md
185 bash tools/changelog-head.sh | sed 's|^\* #|* \\#|g' > $@
186 cat tools/email-footer.md | sed -e 's|__VERSION__|'$(VERSION)'|g' >> $@
189 cat $< | ./node tools/doc/node_modules/.bin/marked > $@
192 rsync -r out/blog/ node@nodejs.org:~/web/nodejs.org/blog/
195 rsync -r out/doc/ node@nodejs.org:~/web/nodejs.org/
196 ssh node@nodejs.org '\
197 rm -f ~/web/nodejs.org/dist/latest &&\
198 ln -s $(VERSION) ~/web/nodejs.org/dist/latest &&\
199 rm -f ~/web/nodejs.org/docs/latest &&\
200 ln -s $(VERSION) ~/web/nodejs.org/docs/latest &&\
201 rm -f ~/web/nodejs.org/dist/node-latest.tar.gz &&\
202 ln -s $(VERSION)/node-$(VERSION).tar.gz ~/web/nodejs.org/dist/node-latest.tar.gz'
204 docopen: out/doc/api/all.html
205 -google-chrome out/doc/api/all.html
210 VERSION=v$(shell $(PYTHON) tools/getnodeversion.py)
211 RELEASE=$(shell $(PYTHON) tools/getnodeisrelease.py)
212 PLATFORM=$(shell uname | tr '[:upper:]' '[:lower:]')
213 ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
218 ifeq ($(DESTCPU),x64)
221 ifeq ($(DESTCPU),arm)
227 TARNAME=node-$(VERSION)
228 TARBALL=$(TARNAME).tar.gz
229 BINARYNAME=$(TARNAME)-$(PLATFORM)-$(ARCH)
230 BINARYTAR=$(BINARYNAME).tar.gz
231 PKG=out/$(TARNAME).pkg
232 packagemaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
234 dist: doc $(TARBALL) $(PKG)
239 @if [ "$(shell git status --porcelain | egrep -v '^\?\? ')" = "" ]; then \
243 echo "The git repository is not clean." >&2 ; \
244 echo "Please commit changes before building release tarball." >&2 ; \
246 git status --porcelain | egrep -v '^\?\?' >&2 ; \
250 @if [ "$(RELEASE)" = "1" ]; then \
254 echo "#NODE_VERSION_IS_RELEASE is set to $(RELEASE)." >&2 ; \
255 echo "Did you remember to update src/node_version.cc?" >&2 ; \
264 rm -rf out/deps out/Release
265 $(PYTHON) ./configure --prefix=$(PKGDIR)/32/usr/local --without-snapshot --dest-cpu=ia32
266 $(MAKE) install V=$(V)
267 rm -rf out/deps out/Release
268 $(PYTHON) ./configure --prefix=$(PKGDIR)/usr/local --without-snapshot --dest-cpu=x64
269 $(MAKE) install V=$(V)
270 SIGN="$(SIGN)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh
271 lipo $(PKGDIR)/32/usr/local/bin/node \
272 $(PKGDIR)/usr/local/bin/node \
273 -output $(PKGDIR)/usr/local/bin/node-universal \
275 mv $(PKGDIR)/usr/local/bin/node-universal $(PKGDIR)/usr/local/bin/node
278 --id "org.nodejs.Node" \
279 --doc tools/osx-pkg.pmdoc \
281 SIGN="$(SIGN)" PKG="$(PKG)" bash tools/osx-productsign.sh
283 $(TARBALL): release-only node doc
284 git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
285 mkdir -p $(TARNAME)/doc/api
286 cp doc/node.1 $(TARNAME)/doc/node.1
287 cp -r out/doc/api/* $(TARNAME)/doc/api/
288 rm -rf $(TARNAME)/deps/v8/test # too big
289 rm -rf $(TARNAME)/doc/images # too big
290 find $(TARNAME)/ -type l | xargs rm # annoying on windows
291 tar -cf $(TARNAME).tar $(TARNAME)
293 gzip -f -9 $(TARNAME).tar
297 $(BINARYTAR): release-only
299 rm -rf out/deps out/Release
300 $(PYTHON) ./configure --prefix=/ --without-snapshot --dest-cpu=$(DESTCPU) $(CONFIG_FLAGS)
301 $(MAKE) install DESTDIR=$(BINARYNAME) V=$(V) PORTABLE=1
302 cp README.md $(BINARYNAME)
303 cp LICENSE $(BINARYNAME)
304 cp ChangeLog $(BINARYNAME)
305 tar -cf $(BINARYNAME).tar $(BINARYNAME)
307 gzip -f -9 $(BINARYNAME).tar
311 dist-upload: $(TARBALL) $(PKG)
312 ssh node@nodejs.org mkdir -p web/nodejs.org/dist/$(VERSION)
313 scp $(TARBALL) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARBALL)
314 scp $(PKG) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARNAME).pkg
317 $(MAKE) -C tools/wrk/ clean
322 $(MAKE) -C tools/wrk/
325 @$(NODE) benchmark/common.js net
328 @$(NODE) benchmark/common.js tls
331 @$(NODE) benchmark/common.js http
334 @$(NODE) benchmark/common.js fs
337 @$(MAKE) -C benchmark/misc/function_call/
338 @$(NODE) benchmark/common.js misc
341 @$(NODE) benchmark/common.js arrays
344 @$(NODE) benchmark/common.js buffers
346 bench: bench-misc bench-net bench-http bench-fs bench-array bench-buffer bench-tls
349 benchmark/http_simple_bench.sh
352 ./node benchmark/idle_server.js &
354 ./node benchmark/idle_clients.js &
357 PYTHONPATH=tools/closure_linter/ $(PYTHON) tools/closure_linter/closure_linter/fixjsstyle.py --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js
360 PYTHONPATH=tools/closure_linter/ $(PYTHON) tools/closure_linter/closure_linter/gjslint.py --unix_mode --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js
363 @$(PYTHON) tools/cpplint.py $(wildcard src/*.cc src/*.h src/*.c)
367 .PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean check uninstall install install-includes install-bin all staticlib dynamiclib test test-all website-upload pkg blog blogclean tar binary release-only