9 # Default to verbose builds.
10 # To do quiet/pretty builds, run `make V=` to set V to an empty string,
11 # or set the V environment variable to an empty string.
14 # BUILDTYPE=Debug builds both release and debug builds. If you want to compile
15 # just the debug build, run `make -C out BUILDTYPE=Debug` instead.
16 ifeq ($(BUILDTYPE),Release)
17 all: out/Makefile node
19 all: out/Makefile node node_g
22 # The .PHONY is needed to ensure that we recursively use the out/Makefile
23 # to check for changes.
28 $(NINJA) -C out/Release/
29 ln -fs out/Release/node node
32 $(NINJA) -C out/Debug/
33 ln -fs out/Debug/node $@
35 node: config.gypi out/Makefile
36 $(MAKE) -C out BUILDTYPE=Release V=$(V)
37 ln -fs out/Release/node node
39 node_g: config.gypi out/Makefile
40 $(MAKE) -C out BUILDTYPE=Debug V=$(V)
41 ln -fs out/Debug/node $@
44 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
47 $(PYTHON) tools/gyp_node -f ninja
49 $(PYTHON) tools/gyp_node -f make
52 config.gypi: configure
56 $(PYTHON) tools/install.py $@ $(DESTDIR)
59 $(PYTHON) tools/install.py $@ $(DESTDIR)
62 -rm -rf out/Makefile node node_g out/$(BUILDTYPE)/node blog.html email.md
63 -find out/ -name '*.o' -o -name '*.a' | xargs rm -rf
70 -rm -rf node node_g blog.html email.md
74 $(PYTHON) tools/test.py --mode=release simple message
78 $(PYTHON) tools/test.py --mode=release --use-http1 simple message
81 $(PYTHON) tools/test.py --mode=release --valgrind simple message
83 test/gc/node_modules/weak/build:
84 @if [ ! -f node ]; then make all; fi
85 ./node deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
86 --directory="$(shell pwd)/test/gc/node_modules/weak" \
87 --nodedir="$(shell pwd)"
89 test-gc: all test/gc/node_modules/weak/build
90 $(PYTHON) tools/test.py --mode=release gc
92 test-all: all test/gc/node_modules/weak/build
93 $(PYTHON) tools/test.py --mode=debug,release
97 $(PYTHON) tools/test.py --mode=debug,release --use-http1
99 test-all-valgrind: all
100 $(PYTHON) tools/test.py --mode=debug,release --valgrind
103 $(PYTHON) tools/test.py --mode=release
106 $(PYTHON) tools/test.py --mode=debug
109 $(PYTHON) tools/test.py message
112 $(PYTHON) tools/test.py simple
115 $(PYTHON) tools/test.py pummel
118 $(PYTHON) tools/test.py internet
121 ./node deps/npm/test/run.js
123 test-npm-publish: node
124 npm_package_config_publishtest=true ./node deps/npm/test/run.js
126 apidoc_sources = $(wildcard doc/api/*.markdown)
127 apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \
128 $(addprefix out/,$(apidoc_sources:.markdown=.json))
130 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
132 apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
134 doc_images = $(addprefix out/,$(wildcard doc/images/* doc/*.jpg doc/*.png))
138 out/doc/v0.4_announcement.html \
141 out/doc/sh_javascript.min.js \
142 out/doc/sh_vim-dark.css \
144 out/doc/favicon.ico \
146 out/doc/about/index.html \
147 out/doc/community/index.html \
148 out/doc/download/index.html \
149 out/doc/logos/index.html \
150 out/doc/changelog.html \
153 doc: $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs) tools/doc/ blog node
158 blog: doc/blog out/Release/node tools/blog
159 out/Release/node tools/blog/generate.js doc/blog/ out/blog/ doc/blog.html doc/rss.xml
164 out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets/
167 out/doc/changelog.html: ChangeLog doc/changelog-head.html doc/changelog-foot.html tools/build-changelog.sh node
168 bash tools/build-changelog.sh
170 out/doc/%.html: doc/%.html node
171 cat $< | sed -e 's|__VERSION__|'$(VERSION)'|g' > $@
176 out/doc/api/%.json: doc/api/%.markdown node
177 out/Release/node tools/doc/generate.js --format=json $< > $@
179 out/doc/api/%.html: doc/api/%.markdown node
180 out/Release/node tools/doc/generate.js --format=html --template=doc/template.html $< > $@
182 email.md: ChangeLog tools/email-footer.md
183 bash tools/changelog-head.sh | sed 's|^\* #|* \\#|g' > $@
184 cat tools/email-footer.md | sed -e 's|__VERSION__|'$(VERSION)'|g' >> $@
187 cat $< | ./node tools/doc/node_modules/.bin/marked > $@
190 rsync -r out/blog/ node@nodejs.org:~/web/nodejs.org/blog/
193 rsync -r out/doc/ node@nodejs.org:~/web/nodejs.org/
194 ssh node@nodejs.org '\
195 rm -f ~/web/nodejs.org/dist/latest &&\
196 ln -s $(VERSION) ~/web/nodejs.org/dist/latest &&\
197 rm -f ~/web/nodejs.org/docs/latest &&\
198 ln -s $(VERSION) ~/web/nodejs.org/docs/latest &&\
199 rm -f ~/web/nodejs.org/dist/node-latest.tar.gz &&\
200 ln -s $(VERSION)/node-$(VERSION).tar.gz ~/web/nodejs.org/dist/node-latest.tar.gz'
202 docopen: out/doc/api/all.html
203 -google-chrome out/doc/api/all.html
208 VERSION=v$(shell $(PYTHON) tools/getnodeversion.py)
209 RELEASE=$(shell $(PYTHON) tools/getnodeisrelease.py)
210 PLATFORM=$(shell uname | tr '[:upper:]' '[:lower:]')
211 ifeq ($(findstring x86_64,$(shell uname -m)),x86_64)
216 ifeq ($(DESTCPU),x64)
221 TARNAME=node-$(VERSION)
222 TARBALL=$(TARNAME).tar.gz
223 BINARYNAME=$(TARNAME)-$(PLATFORM)-$(ARCH)
224 BINARYTAR=$(BINARYNAME).tar.gz
225 PKG=out/$(TARNAME).pkg
226 packagemaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
228 dist: doc $(TARBALL) $(PKG)
233 @if [ "$(shell git status --porcelain | egrep -v '^\?\? ')" = "" ]; then \
237 echo "The git repository is not clean." >&2 ; \
238 echo "Please commit changes before building release tarball." >&2 ; \
240 git status --porcelain | egrep -v '^\?\?' >&2 ; \
244 @if [ "$(RELEASE)" = "1" ]; then \
248 echo "#NODE_VERSION_IS_RELEASE is set to $(RELEASE)." >&2 ; \
249 echo "Did you remember to update src/node_version.cc?" >&2 ; \
258 rm -rf out/deps out/Release
259 ./configure --prefix=$(PKGDIR)/32/usr/local --without-snapshot --dest-cpu=ia32
260 $(MAKE) install V=$(V)
261 rm -rf out/deps out/Release
262 ./configure --prefix=$(PKGDIR)/usr/local --without-snapshot --dest-cpu=x64
263 $(MAKE) install V=$(V)
264 SIGN="$(SIGN)" PKGDIR="$(PKGDIR)" bash tools/osx-codesign.sh
265 lipo $(PKGDIR)/32/usr/local/bin/node \
266 $(PKGDIR)/usr/local/bin/node \
267 -output $(PKGDIR)/usr/local/bin/node-universal \
269 mv $(PKGDIR)/usr/local/bin/node-universal $(PKGDIR)/usr/local/bin/node
272 --id "org.nodejs.Node" \
273 --doc tools/osx-pkg.pmdoc \
275 SIGN="$(SIGN)" PKG="$(PKG)" bash tools/osx-productsign.sh
277 $(TARBALL): release-only node doc
278 git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
279 mkdir -p $(TARNAME)/doc/api
280 cp doc/node.1 $(TARNAME)/doc/node.1
281 cp -r out/doc/api/* $(TARNAME)/doc/api/
282 rm -rf $(TARNAME)/deps/v8/test # too big
283 rm -rf $(TARNAME)/doc/images # too big
284 find $(TARNAME)/ -type l | xargs rm # annoying on windows
285 tar -cf $(TARNAME).tar $(TARNAME)
287 gzip -f -9 $(TARNAME).tar
291 $(BINARYTAR): release-only
293 rm -rf out/deps out/Release
294 ./configure --prefix=/ --without-snapshot --dest-cpu=$(DESTCPU)
295 $(MAKE) install DESTDIR=$(BINARYNAME) V=$(V) PORTABLE=1
296 cp README.md $(BINARYNAME)
297 cp LICENSE $(BINARYNAME)
298 cp ChangeLog $(BINARYNAME)
299 tar -cf $(BINARYNAME).tar $(BINARYNAME)
301 gzip -f -9 $(BINARYNAME).tar
305 dist-upload: $(TARBALL) $(PKG)
306 ssh node@nodejs.org mkdir -p web/nodejs.org/dist/$(VERSION)
307 scp $(TARBALL) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARBALL)
308 scp $(PKG) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARNAME).pkg
311 benchmark/http_simple_bench.sh
314 ./node benchmark/idle_server.js &
316 ./node benchmark/idle_clients.js &
319 PYTHONPATH=tools/closure_linter/ $(PYTHON) tools/closure_linter/closure_linter/fixjsstyle.py --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js
322 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
325 @$(PYTHON) tools/cpplint.py $(wildcard src/*.cc src/*.h src/*.c)
329 .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