Fix test/ jslint failures (by not linting tests)
[platform/upstream/nodejs.git] / Makefile
1 -include config.mk
2
3 BUILDTYPE ?= Release
4 PYTHON ?= python
5
6 # BUILDTYPE=Debug builds both release and debug builds. If you want to compile
7 # just the debug build, run `make -C out BUILDTYPE=Debug` instead.
8 ifeq ($(BUILDTYPE),Release)
9 all: out/Makefile node
10 else
11 all: out/Makefile node node_g
12 endif
13
14 # The .PHONY is needed to ensure that we recursively use the out/Makefile
15 # to check for changes.
16 .PHONY: node node_g
17
18 node: config.gypi
19         $(MAKE) -C out BUILDTYPE=Release
20         ln -fs out/Release/node node
21
22 node_g: config.gypi
23         $(MAKE) -C out BUILDTYPE=Debug
24         ln -fs out/Debug/node node_g
25
26 config.gypi: configure
27         ./configure
28
29 out/Debug/node:
30         $(MAKE) -C out BUILDTYPE=Debug
31
32 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
33         tools/gyp_node -f make
34
35 install: all
36         out/Release/node tools/installer.js install
37
38 uninstall:
39         out/Release/node tools/installer.js uninstall
40
41 clean:
42         -rm -rf out/Makefile node node_g out/$(BUILDTYPE)/node blog.html email.md
43         -find out/ -name '*.o' -o -name '*.a' | xargs rm -rf
44
45 distclean:
46         -rm -rf out
47         -rm -f config.gypi
48         -rm -f config.mk
49         -rm -rf node node_g blog.html email.md
50
51 test: all
52         $(PYTHON) tools/test.py --mode=release simple message
53         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
54
55 test-http1: all
56         $(PYTHON) tools/test.py --mode=release --use-http1 simple message
57
58 test-valgrind: all
59         $(PYTHON) tools/test.py --mode=release --valgrind simple message
60
61 test-all: all
62         python tools/test.py --mode=debug,release
63         $(MAKE) test-npm
64
65 test-all-http1: all
66         $(PYTHON) tools/test.py --mode=debug,release --use-http1
67
68 test-all-valgrind: all
69         $(PYTHON) tools/test.py --mode=debug,release --valgrind
70
71 test-release: all
72         $(PYTHON) tools/test.py --mode=release
73
74 test-debug: all
75         $(PYTHON) tools/test.py --mode=debug
76
77 test-message: all
78         $(PYTHON) tools/test.py message
79
80 test-simple: all
81         $(PYTHON) tools/test.py simple
82
83 test-pummel: all
84         $(PYTHON) tools/test.py pummel
85
86 test-internet: all
87         $(PYTHON) tools/test.py internet
88
89 test-npm: node
90         ./node deps/npm/test/run.js
91
92 test-npm-publish: node
93         npm_package_config_publishtest=true ./node deps/npm/test/run.js
94
95 apidoc_sources = $(wildcard doc/api/*.markdown)
96 apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \
97           $(addprefix out/,$(apidoc_sources:.markdown=.json))
98
99 apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets out/doc/about out/doc/community out/doc/logos out/doc/images
100
101 apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
102
103 doc_images = $(addprefix out/,$(wildcard doc/images/* doc/*.jpg doc/*.png))
104
105 website_files = \
106         out/doc/index.html    \
107         out/doc/v0.4_announcement.html   \
108         out/doc/cla.html      \
109         out/doc/sh_main.js    \
110         out/doc/sh_javascript.min.js \
111         out/doc/sh_vim-dark.css \
112         out/doc/sh.css \
113         out/doc/favicon.ico   \
114         out/doc/pipe.css \
115         out/doc/about/index.html \
116         out/doc/community/index.html \
117         out/doc/logos/index.html \
118         out/doc/changelog.html \
119         $(doc_images)
120
121 doc: program $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs) tools/doc/
122
123 $(apidoc_dirs):
124         mkdir -p $@
125
126 out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets/
127         cp $< $@
128
129 out/doc/changelog.html: ChangeLog doc/changelog-head.html doc/changelog-foot.html tools/build-changelog.sh
130         bash tools/build-changelog.sh
131
132 out/doc/%.html: doc/%.html
133         cat $< | sed -e 's|__VERSION__|'$(VERSION)'|g' > $@
134
135 out/doc/%: doc/%
136         cp -r $< $@
137
138 out/doc/api/%.json: doc/api/%.markdown
139         out/Release/node tools/doc/generate.js --format=json $< > $@
140
141 out/doc/api/%.html: doc/api/%.markdown
142         out/Release/node tools/doc/generate.js --format=html --template=doc/template.html $< > $@
143
144 email.md: ChangeLog tools/email-footer.md
145         bash tools/changelog-head.sh > $@
146         cat tools/email-footer.md | sed -e 's|__VERSION__|'$(VERSION)'|g' >> $@
147
148 blog.html: email.md
149         cat $< | ./node tools/doc/node_modules/.bin/marked > $@
150
151 website-upload: doc
152         rsync -r out/doc/ node@nodejs.org:~/web/nodejs.org/
153         ssh node@nodejs.org '\
154     rm -f ~/web/nodejs.org/dist/latest &&\
155     ln -s $(VERSION) ~/web/nodejs.org/dist/latest &&\
156     rm -f ~/web/nodejs.org/docs/latest &&\
157     ln -s $(VERSION) ~/web/nodejs.org/docs/latest &&\
158     rm -f ~/web/nodejs.org/dist/node-latest.tar.gz &&\
159     ln -s $(VERSION)/node-$(VERSION).tar.gz ~/web/nodejs.org/dist/node-latest.tar.gz'
160
161 docopen: out/doc/api/all.html
162         -google-chrome out/doc/api/all.html
163
164 docclean:
165         -rm -rf out/doc
166
167 VERSION=v$(shell $(PYTHON) tools/getnodeversion.py)
168 TARNAME=node-$(VERSION)
169 TARBALL=$(TARNAME).tar.gz
170 PKG=out/$(TARNAME).pkg
171 packagemaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
172
173 dist: doc $(TARBALL) $(PKG)
174
175 PKGDIR=out/dist-osx
176
177 pkg: $(PKG)
178
179 $(PKG):
180         rm -rf $(PKGDIR)
181         rm -rf out/deps out/Release
182         ./configure --prefix=$(PKGDIR)/32/usr/local --without-snapshot --dest-cpu=ia32
183         $(MAKE) install
184         rm -rf out/deps out/Release
185         ./configure --prefix=$(PKGDIR)/usr/local --without-snapshot --dest-cpu=x64
186         $(MAKE) install
187         lipo $(PKGDIR)/32/usr/local/bin/node \
188                 $(PKGDIR)/usr/local/bin/node \
189                 -output $(PKGDIR)/usr/local/bin/node-universal \
190                 -create
191         mv $(PKGDIR)/usr/local/bin/node-universal $(PKGDIR)/usr/local/bin/node
192         rm -rf $(PKGDIR)/32
193         $(packagemaker) \
194                 --id "org.nodejs.NodeJS-$(VERSION)" \
195                 --doc tools/osx-pkg.pmdoc \
196                 --out $(PKG)
197
198 $(TARBALL): node out/doc
199         @if [ $(shell ./node --version) = "$(VERSION)" ]; then \
200                 exit 0; \
201         else \
202           echo "" >&2 ; \
203                 echo "$(shell ./node --version) doesn't match $(VERSION)." >&2 ; \
204           echo "Did you remember to update src/node_version.cc?" >&2 ; \
205           echo "" >&2 ; \
206                 exit 1 ; \
207         fi
208         git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
209         mkdir -p $(TARNAME)/doc
210         cp doc/node.1 $(TARNAME)/doc/node.1
211         cp -r out/doc/api $(TARNAME)/doc/api
212         rm -rf $(TARNAME)/deps/v8/test # too big
213         rm -rf $(TARNAME)/doc/images # too big
214         tar -cf $(TARNAME).tar $(TARNAME)
215         rm -rf $(TARNAME)
216         gzip -f -9 $(TARNAME).tar
217
218 dist-upload: $(TARBALL) $(PKG)
219         ssh node@nodejs.org mkdir -p web/nodejs.org/dist/$(VERSION)
220         scp $(TARBALL) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARBALL)
221         scp $(PKG) node@nodejs.org:~/web/nodejs.org/dist/$(VERSION)/$(TARNAME).pkg
222
223 bench:
224          benchmark/http_simple_bench.sh
225
226 bench-idle:
227         ./node benchmark/idle_server.js &
228         sleep 1
229         ./node benchmark/idle_clients.js &
230
231 jslint:
232         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
233
234 cpplint:
235         @$(PYTHON) tools/cpplint.py $(wildcard src/*.cc src/*.h src/*.c)
236
237 lint: jslint cpplint
238
239 .PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean check uninstall install install-includes install-bin all program staticlib dynamiclib test test-all website-upload pkg