12 # Default to verbose builds.
13 # To do quiet/pretty builds, run `make V=` to set V to an empty string,
14 # or set the V environment variable to an empty string.
23 # BUILDTYPE=Debug builds both release and debug builds. If you want to compile
24 # just the debug build, run `make -C out BUILDTYPE=Debug` instead.
25 ifeq ($(BUILDTYPE),Release)
26 all: out/Makefile node
28 all: out/Makefile node node_g
31 # The .PHONY is needed to ensure that we recursively use the out/Makefile
32 # to check for changes.
37 $(NINJA) -C out/Release/
38 ln -fs out/Release/node node
41 $(NINJA) -C out/Debug/
42 ln -fs out/Debug/node $@
44 node: config.gypi out/Makefile
45 $(MAKE) -C out BUILDTYPE=Release V=$(V)
46 ln -fs out/Release/node node
48 node_g: config.gypi out/Makefile
49 $(MAKE) -C out BUILDTYPE=Debug V=$(V)
50 ln -fs out/Debug/node $@
53 out/Makefile: common.gypi deps/uv/uv.gyp deps/http_parser/http_parser.gyp deps/zlib/zlib.gyp deps/v8/build/toolchain.gypi deps/v8/build/features.gypi deps/v8/tools/gyp/v8.gyp node.gyp config.gypi
56 $(PYTHON) tools/gyp_node.py -f ninja
58 $(PYTHON) tools/gyp_node.py -f make
61 config.gypi: configure
63 $(error Stale $@, please re-run ./configure)
65 $(error No $@, please run ./configure first)
69 $(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
72 $(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
75 -rm -rf out/Makefile node node_g out/$(BUILDTYPE)/node blog.html email.md
76 -find out/ -name '*.o' -o -name '*.a' | xargs rm -rf
83 -rm -rf node node_g blog.html email.md
87 $(PYTHON) tools/test.py --mode=release simple message
92 $(PYTHON) tools/test.py --mode=release --use-http1 simple message
95 $(PYTHON) tools/test.py --mode=release --valgrind simple message
97 test/gc/node_modules/weak/build/Release/weakref.node:
98 @if [ ! -f node ]; then make all; fi
99 ./node deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
100 --directory="$(shell pwd)/test/gc/node_modules/weak" \
101 --nodedir="$(shell pwd)"
104 @if [ ! -f node ]; then make all; fi
105 rm -rf test/addons/doc-*/
106 ./node tools/doc/addon-verify.js
108 $(sort $(dir $(wildcard test/addons/*/*.gyp))), \
109 ./node deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
110 --directory="$(shell pwd)/$(dir)" \
111 --nodedir="$(shell pwd)" && ) echo "build done"
113 test-gc: all test/gc/node_modules/weak/build/Release/weakref.node
114 $(PYTHON) tools/test.py --mode=release gc
116 test-build: all build-addons
118 test-all: test-build test/gc/node_modules/weak/build/Release/weakref.node
119 $(PYTHON) tools/test.py --mode=debug,release
122 test-all-http1: test-build
123 $(PYTHON) tools/test.py --mode=debug,release --use-http1
125 test-all-valgrind: test-build
126 $(PYTHON) tools/test.py --mode=debug,release --valgrind
128 test-release: test-build
129 $(PYTHON) tools/test.py --mode=release
131 test-debug: test-build
132 $(PYTHON) tools/test.py --mode=debug
134 test-message: test-build
135 $(PYTHON) tools/test.py message
138 $(PYTHON) tools/test.py simple
141 $(PYTHON) tools/test.py pummel
144 $(PYTHON) tools/test.py internet
147 $(PYTHON) tools/test.py debugger
150 ./node deps/npm/test/run.js
152 test-npm-publish: node
153 npm_package_config_publishtest=true ./node deps/npm/test/run.js
155 test-addons: test-build
156 $(PYTHON) tools/test.py --mode=release addons
158 apidoc_sources = $(wildcard doc/api/*.markdown)
159 apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \
160 $(addprefix out/,$(apidoc_sources:.markdown=.json))
162 apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets
164 apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
168 out/doc/sh_javascript.min.js
170 doc: $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs) tools/doc/ node
175 out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets/
178 out/doc/changelog.html: ChangeLog doc/changelog-head.html doc/changelog-foot.html tools/build-changelog.sh node
179 bash tools/build-changelog.sh
184 out/doc/api/%.json: doc/api/%.markdown node
185 out/Release/node tools/doc/generate.js --format=json $< > $@
187 out/doc/api/%.html: doc/api/%.markdown node
188 out/Release/node tools/doc/generate.js --format=html --template=doc/template.html $< > $@
190 email.md: ChangeLog tools/email-footer.md
191 bash tools/changelog-head.sh | sed 's|^\* #|* \\#|g' > $@
192 cat tools/email-footer.md | sed -e 's|__VERSION__|'$(VERSION)'|g' >> $@
195 cat $< | ./node tools/doc/node_modules/.bin/marked > $@
198 rsync -r out/doc/ node@nodejs.org:~/web/nodejs.org/
199 ssh node@nodejs.org '\
200 rm -f ~/web/nodejs.org/dist/latest &&\
201 ln -s $(VERSION) ~/web/nodejs.org/dist/latest &&\
202 rm -f ~/web/nodejs.org/docs/latest &&\
203 ln -s $(VERSION) ~/web/nodejs.org/docs/latest &&\
204 rm -f ~/web/nodejs.org/dist/node-latest.tar.gz &&\
205 ln -s $(VERSION)/node-$(VERSION).tar.gz ~/web/nodejs.org/dist/node-latest.tar.gz'
207 docopen: out/doc/api/all.html
208 -google-chrome out/doc/api/all.html
213 RAWVER=$(shell $(PYTHON) tools/getnodeversion.py)
215 RELEASE=$(shell $(PYTHON) tools/getnodeisrelease.py)
216 PLATFORM=$(shell uname | tr '[:upper:]' '[:lower:]')
217 ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
222 ifeq ($(DESTCPU),x64)
225 ifeq ($(DESTCPU),arm)
231 TARNAME=node-$(VERSION)
233 TAG = nightly-$(NIGHTLY)
234 TARNAME=node-$(VERSION)-$(TAG)
236 TARBALL=$(TARNAME).tar.gz
237 BINARYNAME=$(TARNAME)-$(PLATFORM)-$(ARCH)
238 BINARYTAR=$(BINARYNAME).tar.gz
239 PKG=out/$(TARNAME).pkg
240 packagemaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
242 PKGSRC=nodejs-$(DESTCPU)-$(RAWVER).tgz
244 PKGSRC=nodejs-$(DESTCPU)-$(RAWVER)-$(TAG).tgz
247 dist: doc $(TARBALL) $(PKG)
252 @if [ "$(shell git status --porcelain | egrep -v '^\?\? ')" = "" ]; then \
256 echo "The git repository is not clean." >&2 ; \
257 echo "Please commit changes before building release tarball." >&2 ; \
259 git status --porcelain | egrep -v '^\?\?' >&2 ; \
263 @if [ "$(NIGHTLY)" != "" -o "$(RELEASE)" = "1" ]; then \
267 echo "#NODE_VERSION_IS_RELEASE is set to $(RELEASE)." >&2 ; \
268 echo "Did you remember to update src/node_version.cc?" >&2 ; \
277 rm -rf out/deps out/Release
278 $(PYTHON) ./configure --without-snapshot --dest-cpu=ia32 --tag=$(TAG)
279 $(MAKE) install V=$(V) DESTDIR=$(PKGDIR)/32
280 rm -rf out/deps out/Release
281 $(PYTHON) ./configure --without-snapshot --dest-cpu=x64 --tag=$(TAG)
282 $(MAKE) install V=$(V) DESTDIR=$(PKGDIR)
283 SIGN="$(APP_SIGN)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh
284 lipo $(PKGDIR)/32/usr/local/bin/node \
285 $(PKGDIR)/usr/local/bin/node \
286 -output $(PKGDIR)/usr/local/bin/node-universal \
288 mv $(PKGDIR)/usr/local/bin/node-universal $(PKGDIR)/usr/local/bin/node
291 --id "org.nodejs.Node" \
292 --doc tools/osx-pkg.pmdoc \
294 SIGN="$(INT_SIGN)" PKG="$(PKG)" bash tools/osx-productsign.sh
296 $(TARBALL): release-only node doc
297 git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
298 mkdir -p $(TARNAME)/doc/api
299 cp doc/node.1 $(TARNAME)/doc/node.1
300 cp -r out/doc/api/* $(TARNAME)/doc/api/
301 rm -rf $(TARNAME)/deps/v8/test # too big
302 rm -rf $(TARNAME)/doc/images # too big
303 find $(TARNAME)/ -type l | xargs rm # annoying on windows
304 tar -cf $(TARNAME).tar $(TARNAME)
306 gzip -f -9 $(TARNAME).tar
310 $(BINARYTAR): release-only
312 rm -rf out/deps out/Release
313 $(PYTHON) ./configure --prefix=/ --without-snapshot --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS)
314 $(MAKE) install DESTDIR=$(BINARYNAME) V=$(V) PORTABLE=1
315 cp README.md $(BINARYNAME)
316 cp LICENSE $(BINARYNAME)
317 cp ChangeLog $(BINARYNAME)
318 tar -cf $(BINARYNAME).tar $(BINARYNAME)
320 gzip -f -9 $(BINARYNAME).tar
324 $(PKGSRC): release-only
326 $(PYTHON) configure --prefix=/ --without-snapshot \
327 --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS)
328 $(MAKE) install DESTDIR=dist
329 (cd dist; find * -type f | sort) > packlist
330 pkg_info -X pkg_install | \
331 egrep '^(MACHINE_ARCH|OPSYS|OS_VERSION|PKGTOOLS_VERSION)' > build-info
332 pkg_create -B build-info -c tools/pkgsrc/comment -d tools/pkgsrc/description \
333 -f packlist -I /opt/local -p dist -U $(PKGSRC)
337 dist-upload: $(TARBALL) $(PKG)
338 ssh node@nodejs.org mkdir -p web/nodejs.org/dist/$(VERSION)
339 scp $(TARBALL) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARBALL)
340 scp $(PKG) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARNAME).pkg
343 $(MAKE) -C tools/wrk/ clean
348 $(MAKE) -C tools/wrk/
351 @$(NODE) benchmark/common.js net
354 @$(NODE) benchmark/common.js crypto
357 @$(NODE) benchmark/common.js tls
360 @$(NODE) benchmark/common.js http
363 @$(NODE) benchmark/common.js fs
366 @$(MAKE) -C benchmark/misc/function_call/
367 @$(NODE) benchmark/common.js misc
370 @$(NODE) benchmark/common.js arrays
373 @$(NODE) benchmark/common.js buffers
375 bench-all: bench bench-misc bench-array bench-buffer
377 bench: bench-net bench-http bench-fs bench-tls
380 benchmark/http_simple_bench.sh
383 ./node benchmark/idle_server.js &
385 ./node benchmark/idle_clients.js &
388 PYTHONPATH=tools/closure_linter/ $(PYTHON) tools/closure_linter/closure_linter/fixjsstyle.py --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js
391 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
394 CPPLINT_EXCLUDE += src/node_dtrace.cc
395 CPPLINT_EXCLUDE += src/node_dtrace.cc
396 CPPLINT_EXCLUDE += src/node_root_certs.h
397 CPPLINT_EXCLUDE += src/node_win32_perfctr_provider.cc
398 CPPLINT_EXCLUDE += src/queue.h
399 CPPLINT_EXCLUDE += src/tree.h
400 CPPLINT_EXCLUDE += src/v8abbr.h
402 CPPLINT_FILES = $(filter-out $(CPPLINT_EXCLUDE), $(wildcard src/*.cc src/*.h src/*.c))
405 @$(PYTHON) tools/cpplint.py $(CPPLINT_FILES)
409 .PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean check uninstall install install-includes install-bin all staticlib dynamiclib test test-all test-addons build-addons website-upload pkg blog blogclean tar binary release-only bench-http-simple bench-idle bench-all bench bench-misc bench-array bench-buffer bench-net bench-http bench-fs bench-tls