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.py -f ninja
51 $(PYTHON) tools/gyp_node.py -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/Release/weakref.node:
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/Release/weakref.node
92 $(PYTHON) tools/test.py --mode=release gc
94 test-all: all test/gc/node_modules/weak/build/Release/weakref.node
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 RAWVER=$(shell $(PYTHON) tools/getnodeversion.py)
212 RELEASE=$(shell $(PYTHON) tools/getnodeisrelease.py)
213 PLATFORM=$(shell uname | tr '[:upper:]' '[:lower:]')
214 ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
219 ifeq ($(DESTCPU),x64)
222 ifeq ($(DESTCPU),arm)
228 TARNAME=node-$(VERSION)
230 TAG = nightly-$(NIGHTLY)
231 TARNAME=node-$(VERSION)-$(TAG)
233 TARBALL=$(TARNAME).tar.gz
234 BINARYNAME=$(TARNAME)-$(PLATFORM)-$(ARCH)
235 BINARYTAR=$(BINARYNAME).tar.gz
236 PKG=out/$(TARNAME).pkg
237 packagemaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
239 PKGSRC=nodejs-$(DESTCPU)-$(RAWVER).tgz
241 PKGSRC=nodejs-$(DESTCPU)-$(RAWVER)-$(TAG).tgz
244 dist: doc $(TARBALL) $(PKG)
249 @if [ "$(shell git status --porcelain | egrep -v '^\?\? ')" = "" ]; then \
253 echo "The git repository is not clean." >&2 ; \
254 echo "Please commit changes before building release tarball." >&2 ; \
256 git status --porcelain | egrep -v '^\?\?' >&2 ; \
260 @if [ "$(NIGHTLY)" != "" -o "$(RELEASE)" = "1" ]; then \
264 echo "#NODE_VERSION_IS_RELEASE is set to $(RELEASE)." >&2 ; \
265 echo "Did you remember to update src/node_version.cc?" >&2 ; \
274 rm -rf out/deps out/Release
275 $(PYTHON) ./configure --without-snapshot --dest-cpu=ia32 --tag=$(TAG)
276 $(MAKE) install V=$(V) DESTDIR=$(PKGDIR)/32
277 rm -rf out/deps out/Release
278 $(PYTHON) ./configure --without-snapshot --dest-cpu=x64 --tag=$(TAG)
279 $(MAKE) install V=$(V) DESTDIR=$(PKGDIR)
280 SIGN="$(APP_SIGN)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh
281 lipo $(PKGDIR)/32/usr/local/bin/node \
282 $(PKGDIR)/usr/local/bin/node \
283 -output $(PKGDIR)/usr/local/bin/node-universal \
285 mv $(PKGDIR)/usr/local/bin/node-universal $(PKGDIR)/usr/local/bin/node
288 --id "org.nodejs.Node" \
289 --doc tools/osx-pkg.pmdoc \
291 SIGN="$(INT_SIGN)" PKG="$(PKG)" bash tools/osx-productsign.sh
293 $(TARBALL): release-only node doc
294 git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
295 mkdir -p $(TARNAME)/doc/api
296 cp doc/node.1 $(TARNAME)/doc/node.1
297 cp -r out/doc/api/* $(TARNAME)/doc/api/
298 rm -rf $(TARNAME)/deps/v8/test # too big
299 rm -rf $(TARNAME)/doc/images # too big
300 find $(TARNAME)/ -type l | xargs rm # annoying on windows
301 tar -cf $(TARNAME).tar $(TARNAME)
303 gzip -f -9 $(TARNAME).tar
307 $(BINARYTAR): release-only
309 rm -rf out/deps out/Release
310 $(PYTHON) ./configure --prefix=/ --without-snapshot --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS)
311 $(MAKE) install DESTDIR=$(BINARYNAME) V=$(V) PORTABLE=1
312 cp README.md $(BINARYNAME)
313 cp LICENSE $(BINARYNAME)
314 cp ChangeLog $(BINARYNAME)
315 tar -cf $(BINARYNAME).tar $(BINARYNAME)
317 gzip -f -9 $(BINARYNAME).tar
321 $(PKGSRC): release-only
323 $(PYTHON) configure --prefix=/ --without-snapshot \
324 --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS)
325 $(MAKE) install DESTDIR=dist
326 (cd dist; find * -type f | sort) > packlist
327 pkg_info -X pkg_install | \
328 egrep '^(MACHINE_ARCH|OPSYS|OS_VERSION|PKGTOOLS_VERSION)' > build-info
329 pkg_create -B build-info -c tools/pkgsrc/comment -d tools/pkgsrc/description \
330 -f packlist -I /opt/local -p dist -U $(PKGSRC)
334 dist-upload: $(TARBALL) $(PKG)
335 ssh node@nodejs.org mkdir -p web/nodejs.org/dist/$(VERSION)
336 scp $(TARBALL) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARBALL)
337 scp $(PKG) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARNAME).pkg
340 $(MAKE) -C tools/wrk/ clean
345 $(MAKE) -C tools/wrk/
348 @$(NODE) benchmark/common.js net
351 @$(NODE) benchmark/common.js crypto
354 @$(NODE) benchmark/common.js tls
357 @$(NODE) benchmark/common.js http
360 @$(NODE) benchmark/common.js fs
363 @$(MAKE) -C benchmark/misc/function_call/
364 @$(NODE) benchmark/common.js misc
367 @$(NODE) benchmark/common.js arrays
370 @$(NODE) benchmark/common.js buffers
372 bench-all: bench bench-misc bench-array bench-buffer
374 bench: bench-net bench-http bench-fs bench-tls
377 benchmark/http_simple_bench.sh
380 ./node benchmark/idle_server.js &
382 ./node benchmark/idle_clients.js &
385 PYTHONPATH=tools/closure_linter/ $(PYTHON) tools/closure_linter/closure_linter/fixjsstyle.py --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js
388 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
391 @$(PYTHON) tools/cpplint.py $(wildcard src/*.cc src/*.h src/*.c)
395 .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