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 -f ninja
58 $(PYTHON) tools/gyp_node -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:
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)"
103 test-gc: all test/gc/node_modules/weak/build
104 $(PYTHON) tools/test.py --mode=release gc
106 test-all: all test/gc/node_modules/weak/build
107 $(PYTHON) tools/test.py --mode=debug,release
111 $(PYTHON) tools/test.py --mode=debug,release --use-http1
113 test-all-valgrind: all
114 $(PYTHON) tools/test.py --mode=debug,release --valgrind
117 $(PYTHON) tools/test.py --mode=release
120 $(PYTHON) tools/test.py --mode=debug
123 $(PYTHON) tools/test.py message
126 $(PYTHON) tools/test.py simple
129 $(PYTHON) tools/test.py pummel
132 $(PYTHON) tools/test.py internet
135 ./node deps/npm/test/run.js
137 test-npm-publish: node
138 npm_package_config_publishtest=true ./node deps/npm/test/run.js
140 apidoc_sources = $(wildcard doc/api/*.markdown)
141 apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \
142 $(addprefix out/,$(apidoc_sources:.markdown=.json))
144 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
146 apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
148 doc_images = $(addprefix out/,$(wildcard doc/images/* doc/*.jpg doc/*.png))
152 out/doc/v0.4_announcement.html \
155 out/doc/sh_javascript.min.js \
156 out/doc/sh_vim-dark.css \
158 out/doc/favicon.ico \
160 out/doc/about/index.html \
161 out/doc/community/index.html \
162 out/doc/download/index.html \
163 out/doc/logos/index.html \
164 out/doc/changelog.html \
167 doc: $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs) tools/doc/ blog node
172 blog: doc/blog out/Release/node tools/blog
173 out/Release/node tools/blog/generate.js doc/blog/ out/blog/ doc/blog.html doc/rss.xml
178 out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets/
181 out/doc/changelog.html: ChangeLog doc/changelog-head.html doc/changelog-foot.html tools/build-changelog.sh node
182 bash tools/build-changelog.sh
184 out/doc/%.html: doc/%.html node
185 cat $< | sed -e 's|__VERSION__|'$(VERSION)'|g' > $@
190 out/doc/api/%.json: doc/api/%.markdown node
191 out/Release/node tools/doc/generate.js --format=json $< > $@
193 out/doc/api/%.html: doc/api/%.markdown node
194 out/Release/node tools/doc/generate.js --format=html --template=doc/template.html $< > $@
196 email.md: ChangeLog tools/email-footer.md
197 bash tools/changelog-head.sh | sed 's|^\* #|* \\#|g' > $@
198 cat tools/email-footer.md | sed -e 's|__VERSION__|'$(VERSION)'|g' >> $@
201 cat $< | ./node tools/doc/node_modules/.bin/marked > $@
204 rsync -r out/blog/ node@nodejs.org:~/web/nodejs.org/blog/
207 rsync -r out/doc/ node@nodejs.org:~/web/nodejs.org/
208 ssh node@nodejs.org '\
209 rm -f ~/web/nodejs.org/dist/latest &&\
210 ln -s $(VERSION) ~/web/nodejs.org/dist/latest &&\
211 rm -f ~/web/nodejs.org/docs/latest &&\
212 ln -s $(VERSION) ~/web/nodejs.org/docs/latest &&\
213 rm -f ~/web/nodejs.org/dist/node-latest.tar.gz &&\
214 ln -s $(VERSION)/node-$(VERSION).tar.gz ~/web/nodejs.org/dist/node-latest.tar.gz'
216 docopen: out/doc/api/all.html
217 -google-chrome out/doc/api/all.html
222 RAWVER=$(shell $(PYTHON) tools/getnodeversion.py)
224 RELEASE=$(shell $(PYTHON) tools/getnodeisrelease.py)
225 PLATFORM=$(shell uname | tr '[:upper:]' '[:lower:]')
226 ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
231 ifeq ($(DESTCPU),x64)
234 ifeq ($(DESTCPU),arm)
240 TARNAME=node-$(VERSION)
242 TAG = nightly-$(NIGHTLY)
243 TARNAME=node-$(VERSION)-$(TAG)
245 TARBALL=$(TARNAME).tar.gz
246 BINARYNAME=$(TARNAME)-$(PLATFORM)-$(ARCH)
247 BINARYTAR=$(BINARYNAME).tar.gz
248 PKG=out/$(TARNAME).pkg
249 packagemaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
251 PKGSRC=nodejs-$(DESTCPU)-$(RAWVER).tgz
253 PKGSRC=nodejs-$(DESTCPU)-$(RAWVER)-$(TAG).tgz
256 dist: doc $(TARBALL) $(PKG)
261 @if [ "$(shell git status --porcelain | egrep -v '^\?\? ')" = "" ]; then \
265 echo "The git repository is not clean." >&2 ; \
266 echo "Please commit changes before building release tarball." >&2 ; \
268 git status --porcelain | egrep -v '^\?\?' >&2 ; \
272 @if [ "$(NIGHTLY)" != "" -o "$(RELEASE)" = "1" ]; then \
276 echo "#NODE_VERSION_IS_RELEASE is set to $(RELEASE)." >&2 ; \
277 echo "Did you remember to update src/node_version.cc?" >&2 ; \
286 rm -rf out/deps out/Release
287 $(PYTHON) ./configure --without-snapshot --dest-cpu=ia32 --tag=$(TAG)
288 $(MAKE) install V=$(V) DESTDIR=$(PKGDIR)/32
289 rm -rf out/deps out/Release
290 $(PYTHON) ./configure --without-snapshot --dest-cpu=x64 --tag=$(TAG)
291 $(MAKE) install V=$(V) DESTDIR=$(PKGDIR)
292 SIGN="$(APP_SIGN)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh
293 lipo $(PKGDIR)/32/usr/local/bin/node \
294 $(PKGDIR)/usr/local/bin/node \
295 -output $(PKGDIR)/usr/local/bin/node-universal \
297 mv $(PKGDIR)/usr/local/bin/node-universal $(PKGDIR)/usr/local/bin/node
300 --id "org.nodejs.Node" \
301 --doc tools/osx-pkg.pmdoc \
303 SIGN="$(INT_SIGN)" PKG="$(PKG)" bash tools/osx-productsign.sh
305 $(TARBALL): release-only node doc
306 git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
307 mkdir -p $(TARNAME)/doc/api
308 cp doc/node.1 $(TARNAME)/doc/node.1
309 cp -r out/doc/api/* $(TARNAME)/doc/api/
310 rm -rf $(TARNAME)/deps/v8/test # too big
311 rm -rf $(TARNAME)/doc/images # too big
312 find $(TARNAME)/ -type l | xargs rm # annoying on windows
313 tar -cf $(TARNAME).tar $(TARNAME)
315 gzip -f -9 $(TARNAME).tar
319 $(BINARYTAR): release-only
321 rm -rf out/deps out/Release
322 $(PYTHON) ./configure --prefix=/ --without-snapshot --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS)
323 $(MAKE) install DESTDIR=$(BINARYNAME) V=$(V) PORTABLE=1
324 cp README.md $(BINARYNAME)
325 cp LICENSE $(BINARYNAME)
326 cp ChangeLog $(BINARYNAME)
327 tar -cf $(BINARYNAME).tar $(BINARYNAME)
329 gzip -f -9 $(BINARYNAME).tar
333 $(PKGSRC): release-only
335 $(PYTHON) configure --prefix=/ --without-snapshot \
336 --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS)
337 $(MAKE) install DESTDIR=dist
338 (cd dist; find * -type f | sort) > packlist
339 pkg_info -X pkg_install | \
340 egrep '^(MACHINE_ARCH|OPSYS|OS_VERSION|PKGTOOLS_VERSION)' > build-info
341 pkg_create -B build-info -c tools/pkgsrc/comment -d tools/pkgsrc/description \
342 -f packlist -I /opt/local -p dist -U $(PKGSRC)
346 dist-upload: $(TARBALL) $(PKG)
347 ssh node@nodejs.org mkdir -p web/nodejs.org/dist/$(VERSION)
348 scp $(TARBALL) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARBALL)
349 scp $(PKG) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARNAME).pkg
352 $(MAKE) -C tools/wrk/ clean
357 $(MAKE) -C tools/wrk/
360 @$(NODE) benchmark/common.js net
363 @$(NODE) benchmark/common.js crypto
366 @$(NODE) benchmark/common.js tls
369 @$(NODE) benchmark/common.js http
372 @$(NODE) benchmark/common.js fs
375 @$(MAKE) -C benchmark/misc/function_call/
376 @$(NODE) benchmark/common.js misc
379 @$(NODE) benchmark/common.js arrays
382 @$(NODE) benchmark/common.js buffers
384 bench-all: bench bench-misc bench-array bench-buffer
386 bench: bench-net bench-http bench-fs bench-tls
389 benchmark/http_simple_bench.sh
392 ./node benchmark/idle_server.js &
394 ./node benchmark/idle_clients.js &
397 PYTHONPATH=tools/closure_linter/ $(PYTHON) tools/closure_linter/closure_linter/fixjsstyle.py --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js
400 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
403 CPPLINT_EXCLUDE += src/node_dtrace.cc
404 CPPLINT_EXCLUDE += src/node_dtrace.cc
405 CPPLINT_EXCLUDE += src/node_root_certs.h
406 CPPLINT_EXCLUDE += src/node_win32_perfctr_provider.cc
407 CPPLINT_EXCLUDE += src/queue.h
408 CPPLINT_EXCLUDE += src/tree.h
409 CPPLINT_EXCLUDE += src/v8abbr.h
411 CPPLINT_FILES = $(filter-out $(CPPLINT_EXCLUDE), $(wildcard src/*.cc src/*.h src/*.c))
414 @$(PYTHON) tools/cpplint.py $(CPPLINT_FILES)
418 .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