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.
17 # BUILDTYPE=Debug builds both release and debug builds. If you want to compile
18 # just the debug build, run `make -C out BUILDTYPE=Debug` instead.
19 ifeq ($(BUILDTYPE),Release)
20 all: out/Makefile node
22 all: out/Makefile node node_g
25 # The .PHONY is needed to ensure that we recursively use the out/Makefile
26 # to check for changes.
31 $(NINJA) -C out/Release/
32 ln -fs out/Release/node node
35 $(NINJA) -C out/Debug/
36 ln -fs out/Debug/node $@
38 node: config.gypi out/Makefile
39 $(MAKE) -C out BUILDTYPE=Release V=$(V)
40 ln -fs out/Release/node node
42 node_g: config.gypi out/Makefile
43 $(MAKE) -C out BUILDTYPE=Debug V=$(V)
44 ln -fs out/Debug/node $@
47 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
50 $(PYTHON) tools/gyp_node -f ninja
52 $(PYTHON) tools/gyp_node -f make
55 config.gypi: configure
59 $(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
62 $(PYTHON) tools/install.py $@ '$(DESTDIR)' '$(PREFIX)'
65 -rm -rf out/Makefile node node_g out/$(BUILDTYPE)/node blog.html email.md
66 -find out/ -name '*.o' -o -name '*.a' | xargs rm -rf
73 -rm -rf node node_g blog.html email.md
77 $(PYTHON) tools/test.py --mode=release simple message
82 $(PYTHON) tools/test.py --mode=release --use-http1 simple message
85 $(PYTHON) tools/test.py --mode=release --valgrind simple message
87 test/gc/node_modules/weak/build:
88 @if [ ! -f node ]; then make all; fi
89 ./node deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
90 --directory="$(shell pwd)/test/gc/node_modules/weak" \
91 --nodedir="$(shell pwd)"
93 test-gc: all test/gc/node_modules/weak/build
94 $(PYTHON) tools/test.py --mode=release gc
96 test-all: all test/gc/node_modules/weak/build
97 $(PYTHON) tools/test.py --mode=debug,release
101 $(PYTHON) tools/test.py --mode=debug,release --use-http1
103 test-all-valgrind: all
104 $(PYTHON) tools/test.py --mode=debug,release --valgrind
107 $(PYTHON) tools/test.py --mode=release
110 $(PYTHON) tools/test.py --mode=debug
113 $(PYTHON) tools/test.py message
116 $(PYTHON) tools/test.py simple
119 $(PYTHON) tools/test.py pummel
122 $(PYTHON) tools/test.py internet
125 ./node deps/npm/test/run.js
127 test-npm-publish: node
128 npm_package_config_publishtest=true ./node deps/npm/test/run.js
130 apidoc_sources = $(wildcard doc/api/*.markdown)
131 apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \
132 $(addprefix out/,$(apidoc_sources:.markdown=.json))
134 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
136 apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
138 doc_images = $(addprefix out/,$(wildcard doc/images/* doc/*.jpg doc/*.png))
142 out/doc/v0.4_announcement.html \
145 out/doc/sh_javascript.min.js \
146 out/doc/sh_vim-dark.css \
148 out/doc/favicon.ico \
150 out/doc/about/index.html \
151 out/doc/community/index.html \
152 out/doc/download/index.html \
153 out/doc/logos/index.html \
154 out/doc/changelog.html \
157 doc: $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs) tools/doc/ blog node
162 blog: doc/blog out/Release/node tools/blog
163 out/Release/node tools/blog/generate.js doc/blog/ out/blog/ doc/blog.html doc/rss.xml
168 out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets/
171 out/doc/changelog.html: ChangeLog doc/changelog-head.html doc/changelog-foot.html tools/build-changelog.sh node
172 bash tools/build-changelog.sh
174 out/doc/%.html: doc/%.html node
175 cat $< | sed -e 's|__VERSION__|'$(VERSION)'|g' > $@
180 out/doc/api/%.json: doc/api/%.markdown node
181 out/Release/node tools/doc/generate.js --format=json $< > $@
183 out/doc/api/%.html: doc/api/%.markdown node
184 out/Release/node tools/doc/generate.js --format=html --template=doc/template.html $< > $@
186 email.md: ChangeLog tools/email-footer.md
187 bash tools/changelog-head.sh | sed 's|^\* #|* \\#|g' > $@
188 cat tools/email-footer.md | sed -e 's|__VERSION__|'$(VERSION)'|g' >> $@
191 cat $< | ./node tools/doc/node_modules/.bin/marked > $@
194 rsync -r out/blog/ node@nodejs.org:~/web/nodejs.org/blog/
197 rsync -r out/doc/ node@nodejs.org:~/web/nodejs.org/
198 ssh node@nodejs.org '\
199 rm -f ~/web/nodejs.org/dist/latest &&\
200 ln -s $(VERSION) ~/web/nodejs.org/dist/latest &&\
201 rm -f ~/web/nodejs.org/docs/latest &&\
202 ln -s $(VERSION) ~/web/nodejs.org/docs/latest &&\
203 rm -f ~/web/nodejs.org/dist/node-latest.tar.gz &&\
204 ln -s $(VERSION)/node-$(VERSION).tar.gz ~/web/nodejs.org/dist/node-latest.tar.gz'
206 docopen: out/doc/api/all.html
207 -google-chrome out/doc/api/all.html
212 RAWVER=$(shell $(PYTHON) tools/getnodeversion.py)
214 RELEASE=$(shell $(PYTHON) tools/getnodeisrelease.py)
215 PLATFORM=$(shell uname | tr '[:upper:]' '[:lower:]')
216 ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
221 ifeq ($(DESTCPU),x64)
224 ifeq ($(DESTCPU),arm)
230 TARNAME=node-$(VERSION)
232 TAG = nightly-$(NIGHTLY)
233 TARNAME=node-$(VERSION)-$(TAG)
235 TARBALL=$(TARNAME).tar.gz
236 BINARYNAME=$(TARNAME)-$(PLATFORM)-$(ARCH)
237 BINARYTAR=$(BINARYNAME).tar.gz
238 PKG=out/$(TARNAME).pkg
239 packagemaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
241 PKGSRC=nodejs-$(DESTCPU)-$(RAWVER).tgz
243 PKGSRC=nodejs-$(DESTCPU)-$(RAWVER)-$(TAG).tgz
246 dist: doc $(TARBALL) $(PKG)
251 @if [ "$(shell git status --porcelain | egrep -v '^\?\? ')" = "" ]; then \
255 echo "The git repository is not clean." >&2 ; \
256 echo "Please commit changes before building release tarball." >&2 ; \
258 git status --porcelain | egrep -v '^\?\?' >&2 ; \
262 @if [ "$(NIGHTLY)" != "" -o "$(RELEASE)" = "1" ]; then \
266 echo "#NODE_VERSION_IS_RELEASE is set to $(RELEASE)." >&2 ; \
267 echo "Did you remember to update src/node_version.cc?" >&2 ; \
276 rm -rf out/deps out/Release
277 $(PYTHON) ./configure --without-snapshot --dest-cpu=ia32 --tag=$(TAG)
278 $(MAKE) install V=$(V) DESTDIR=$(PKGDIR)/32
279 rm -rf out/deps out/Release
280 $(PYTHON) ./configure --without-snapshot --dest-cpu=x64 --tag=$(TAG)
281 $(MAKE) install V=$(V) DESTDIR=$(PKGDIR)
282 SIGN="$(APP_SIGN)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh
283 lipo $(PKGDIR)/32/usr/local/bin/node \
284 $(PKGDIR)/usr/local/bin/node \
285 -output $(PKGDIR)/usr/local/bin/node-universal \
287 mv $(PKGDIR)/usr/local/bin/node-universal $(PKGDIR)/usr/local/bin/node
290 --id "org.nodejs.Node" \
291 --doc tools/osx-pkg.pmdoc \
293 SIGN="$(INT_SIGN)" PKG="$(PKG)" bash tools/osx-productsign.sh
295 $(TARBALL): release-only node doc
296 git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
297 mkdir -p $(TARNAME)/doc/api
298 cp doc/node.1 $(TARNAME)/doc/node.1
299 cp -r out/doc/api/* $(TARNAME)/doc/api/
300 rm -rf $(TARNAME)/deps/v8/test # too big
301 rm -rf $(TARNAME)/doc/images # too big
302 find $(TARNAME)/ -type l | xargs rm # annoying on windows
303 tar -cf $(TARNAME).tar $(TARNAME)
305 gzip -f -9 $(TARNAME).tar
309 $(BINARYTAR): release-only
311 rm -rf out/deps out/Release
312 $(PYTHON) ./configure --prefix=/ --without-snapshot --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS)
313 $(MAKE) install DESTDIR=$(BINARYNAME) V=$(V) PORTABLE=1
314 cp README.md $(BINARYNAME)
315 cp LICENSE $(BINARYNAME)
316 cp ChangeLog $(BINARYNAME)
317 tar -cf $(BINARYNAME).tar $(BINARYNAME)
319 gzip -f -9 $(BINARYNAME).tar
323 $(PKGSRC): release-only
325 $(PYTHON) configure --prefix=/ --without-snapshot \
326 --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS)
327 $(MAKE) install DESTDIR=dist
328 (cd dist; find * -type f | sort) > packlist
329 pkg_info -X pkg_install | \
330 egrep '^(MACHINE_ARCH|OPSYS|OS_VERSION|PKGTOOLS_VERSION)' > build-info
331 pkg_create -B build-info -c tools/pkgsrc/comment -d tools/pkgsrc/description \
332 -f packlist -I /opt/local -p dist -U $(PKGSRC)
336 dist-upload: $(TARBALL) $(PKG)
337 ssh node@nodejs.org mkdir -p web/nodejs.org/dist/$(VERSION)
338 scp $(TARBALL) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARBALL)
339 scp $(PKG) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARNAME).pkg
342 $(MAKE) -C tools/wrk/ clean
347 $(MAKE) -C tools/wrk/
350 @$(NODE) benchmark/common.js net
353 @$(NODE) benchmark/common.js crypto
356 @$(NODE) benchmark/common.js tls
359 @$(NODE) benchmark/common.js http
362 @$(NODE) benchmark/common.js fs
365 @$(MAKE) -C benchmark/misc/function_call/
366 @$(NODE) benchmark/common.js misc
369 @$(NODE) benchmark/common.js arrays
372 @$(NODE) benchmark/common.js buffers
374 bench-all: bench bench-misc bench-array bench-buffer
376 bench: bench-net bench-http bench-fs bench-tls
379 benchmark/http_simple_bench.sh
382 ./node benchmark/idle_server.js &
384 ./node benchmark/idle_clients.js &
387 PYTHONPATH=tools/closure_linter/ $(PYTHON) tools/closure_linter/closure_linter/fixjsstyle.py --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js
390 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
393 CPPLINT_EXCLUDE += src/tree.h
394 CPPLINT_EXCLUDE += src/queue.h
395 CPPLINT_EXCLUDE += src/v8abbr.h
396 CPPLINT_EXCLUDE += src/node_root_certs.h
397 CPPLINT_EXCLUDE += src/node_dtrace.cc
399 CPPLINT_FILES = $(filter-out $(CPPLINT_EXCLUDE), $(wildcard src/*.cc src/*.h src/*.c))
402 @$(PYTHON) tools/cpplint.py $(CPPLINT_FILES)
406 .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 bench-http-simple bench-idle bench-all bench bench-misc bench-array bench-buffer bench-net bench-http bench-fs bench-tls