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/common.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
81 $(PYTHON) tools/test.py --mode=release --use-http1 simple message
84 $(PYTHON) tools/test.py --mode=release --valgrind simple message
86 test/gc/node_modules/weak/build:
87 @if [ ! -f node ]; then make all; fi
88 ./node deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
89 --directory="$(shell pwd)/test/gc/node_modules/weak" \
90 --nodedir="$(shell pwd)"
92 test-gc: all test/gc/node_modules/weak/build
93 $(PYTHON) tools/test.py --mode=release gc
95 test-all: all test/gc/node_modules/weak/build
96 $(PYTHON) tools/test.py --mode=debug,release
100 $(PYTHON) tools/test.py --mode=debug,release --use-http1
102 test-all-valgrind: all
103 $(PYTHON) tools/test.py --mode=debug,release --valgrind
106 $(PYTHON) tools/test.py --mode=release
109 $(PYTHON) tools/test.py --mode=debug
112 $(PYTHON) tools/test.py message
115 $(PYTHON) tools/test.py simple
118 $(PYTHON) tools/test.py pummel
121 $(PYTHON) tools/test.py internet
124 ./node deps/npm/test/run.js
126 test-npm-publish: node
127 npm_package_config_publishtest=true ./node deps/npm/test/run.js
129 apidoc_sources = $(wildcard doc/api/*.markdown)
130 apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \
131 $(addprefix out/,$(apidoc_sources:.markdown=.json))
133 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
135 apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
137 doc_images = $(addprefix out/,$(wildcard doc/images/* doc/*.jpg doc/*.png))
141 out/doc/v0.4_announcement.html \
144 out/doc/sh_javascript.min.js \
145 out/doc/sh_vim-dark.css \
147 out/doc/favicon.ico \
149 out/doc/about/index.html \
150 out/doc/community/index.html \
151 out/doc/download/index.html \
152 out/doc/logos/index.html \
153 out/doc/changelog.html \
156 doc: $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs) tools/doc/ blog node
161 blog: doc/blog out/Release/node tools/blog
162 out/Release/node tools/blog/generate.js doc/blog/ out/blog/ doc/blog.html doc/rss.xml
167 out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets/
170 out/doc/changelog.html: ChangeLog doc/changelog-head.html doc/changelog-foot.html tools/build-changelog.sh node
171 bash tools/build-changelog.sh
173 out/doc/%.html: doc/%.html node
174 cat $< | sed -e 's|__VERSION__|'$(VERSION)'|g' > $@
179 out/doc/api/%.json: doc/api/%.markdown node
180 out/Release/node tools/doc/generate.js --format=json $< > $@
182 out/doc/api/%.html: doc/api/%.markdown node
183 out/Release/node tools/doc/generate.js --format=html --template=doc/template.html $< > $@
185 email.md: ChangeLog tools/email-footer.md
186 bash tools/changelog-head.sh | sed 's|^\* #|* \\#|g' > $@
187 cat tools/email-footer.md | sed -e 's|__VERSION__|'$(VERSION)'|g' >> $@
190 cat $< | ./node tools/doc/node_modules/.bin/marked > $@
193 rsync -r out/blog/ node@nodejs.org:~/web/nodejs.org/blog/
196 rsync -r out/doc/ node@nodejs.org:~/web/nodejs.org/
197 ssh node@nodejs.org '\
198 rm -f ~/web/nodejs.org/dist/latest &&\
199 ln -s $(VERSION) ~/web/nodejs.org/dist/latest &&\
200 rm -f ~/web/nodejs.org/docs/latest &&\
201 ln -s $(VERSION) ~/web/nodejs.org/docs/latest &&\
202 rm -f ~/web/nodejs.org/dist/node-latest.tar.gz &&\
203 ln -s $(VERSION)/node-$(VERSION).tar.gz ~/web/nodejs.org/dist/node-latest.tar.gz'
205 docopen: out/doc/api/all.html
206 -google-chrome out/doc/api/all.html
211 VERSION=v$(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 dist: doc $(TARBALL) $(PKG)
244 @if [ "$(shell git status --porcelain | egrep -v '^\?\? ')" = "" ]; then \
248 echo "The git repository is not clean." >&2 ; \
249 echo "Please commit changes before building release tarball." >&2 ; \
251 git status --porcelain | egrep -v '^\?\?' >&2 ; \
255 @if [ "$(NIGHTLY)" != "" -o "$(RELEASE)" = "1" ]; then \
259 echo "#NODE_VERSION_IS_RELEASE is set to $(RELEASE)." >&2 ; \
260 echo "Did you remember to update src/node_version.cc?" >&2 ; \
269 rm -rf out/deps out/Release
270 $(PYTHON) ./configure --without-snapshot --dest-cpu=ia32 --tag=$(TAG)
271 $(MAKE) install V=$(V) DESTDIR=$(PKGDIR)/32
272 rm -rf out/deps out/Release
273 $(PYTHON) ./configure --without-snapshot --dest-cpu=x64 --tag=$(TAG)
274 $(MAKE) install V=$(V) DESTDIR=$(PKGDIR)
275 SIGN="$(SIGN)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh
276 lipo $(PKGDIR)/32/usr/local/bin/node \
277 $(PKGDIR)/usr/local/bin/node \
278 -output $(PKGDIR)/usr/local/bin/node-universal \
280 mv $(PKGDIR)/usr/local/bin/node-universal $(PKGDIR)/usr/local/bin/node
283 --id "org.nodejs.Node" \
284 --doc tools/osx-pkg.pmdoc \
286 SIGN="$(SIGN)" PKG="$(PKG)" bash tools/osx-productsign.sh
288 $(TARBALL): release-only node doc
289 git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
290 mkdir -p $(TARNAME)/doc/api
291 cp doc/node.1 $(TARNAME)/doc/node.1
292 cp -r out/doc/api/* $(TARNAME)/doc/api/
293 rm -rf $(TARNAME)/deps/v8/test # too big
294 rm -rf $(TARNAME)/doc/images # too big
295 find $(TARNAME)/ -type l | xargs rm # annoying on windows
296 tar -cf $(TARNAME).tar $(TARNAME)
298 gzip -f -9 $(TARNAME).tar
302 $(BINARYTAR): release-only
304 rm -rf out/deps out/Release
305 $(PYTHON) ./configure --prefix=/ --without-snapshot --dest-cpu=$(DESTCPU) --tag=$(TAG) $(CONFIG_FLAGS)
306 $(MAKE) install DESTDIR=$(BINARYNAME) V=$(V) PORTABLE=1
307 cp README.md $(BINARYNAME)
308 cp LICENSE $(BINARYNAME)
309 cp ChangeLog $(BINARYNAME)
310 tar -cf $(BINARYNAME).tar $(BINARYNAME)
312 gzip -f -9 $(BINARYNAME).tar
316 dist-upload: $(TARBALL) $(PKG)
317 ssh node@nodejs.org mkdir -p web/nodejs.org/dist/$(VERSION)
318 scp $(TARBALL) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARBALL)
319 scp $(PKG) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARNAME).pkg
322 $(MAKE) -C tools/wrk/ clean
327 $(MAKE) -C tools/wrk/
330 @$(NODE) benchmark/common.js net
333 @$(NODE) benchmark/common.js crypto
336 @$(NODE) benchmark/common.js tls
339 @$(NODE) benchmark/common.js http
342 @$(NODE) benchmark/common.js fs
345 @$(MAKE) -C benchmark/misc/function_call/
346 @$(NODE) benchmark/common.js misc
349 @$(NODE) benchmark/common.js arrays
352 @$(NODE) benchmark/common.js buffers
354 bench-all: bench bench-misc bench-array bench-buffer
356 bench: bench-net bench-http bench-fs bench-tls
359 benchmark/http_simple_bench.sh
362 ./node benchmark/idle_server.js &
364 ./node benchmark/idle_clients.js &
367 PYTHONPATH=tools/closure_linter/ $(PYTHON) tools/closure_linter/closure_linter/fixjsstyle.py --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js
370 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
373 @$(PYTHON) tools/cpplint.py $(wildcard src/*.cc src/*.h src/*.c)
377 .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