-WAF = $(PYTHON) tools/waf-light
+BUILDTYPE ?= Release
+ PYTHON ?= python
-web_root = node@nodejs.org:~/web/nodejs.org/
+ifeq ($(BUILDTYPE),Release)
+all: out/Makefile node
+else
+all: out/Makefile node_g
+endif
-#
-# Because we recursively call make from waf we need to make sure that we are
-# using the correct make. Not all makes are GNU Make, but this likely only
-# works with gnu make. To deal with this we remember how the user invoked us
-# via a make builtin variable and use that in all subsequent operations
-#
-export NODE_MAKE := $(MAKE)
+# The .PHONY is needed to ensure that we recursively use the out/Makefile
+# to check for changes.
+.PHONY: node node_g
-all: program
- @-[ -f out/Release/node ] && ls -lh out/Release/node
+node:
+ $(MAKE) -C out BUILDTYPE=Release
+ ln -fs out/Release/node node
-all-progress:
- @$(WAF) -p build
+node_g:
+ $(MAKE) -C out BUILDTYPE=Debug
+ ln -fs out/Debug/node node_g
-program:
- @$(WAF) --product-type=program build
+out/Debug/node:
+ $(MAKE) -C out BUILDTYPE=Debug
-staticlib:
- @$(WAF) --product-type=cstaticlib build
+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
+ tools/gyp_node -f make
-dynamiclib:
- @$(WAF) --product-type=cshlib build
-
-install:
- @$(WAF) install
+install: all
+ out/Release/node tools/installer.js ./config.gypi install
uninstall:
- @$(WAF) uninstall
+ out/Release/node tools/installer.js ./config.gypi uninstall
+
+clean:
+ -rm -rf out/Makefile node node_g out/**/*.o out/**/*.a out/$(BUILDTYPE)/node
+
+distclean:
+ -rm -rf out
+ -rm config.gypi
test: all
- python tools/test.py --mode=release simple message
+ $(PYTHON) tools/test.py --mode=release simple message
test-http1: all
- python tools/test.py --mode=release --use-http1 simple message
+ $(PYTHON) tools/test.py --mode=release --use-http1 simple message
test-valgrind: all
- python tools/test.py --mode=release --valgrind simple message
+ $(PYTHON) tools/test.py --mode=release --valgrind simple message
test-all: all
- $(PYTHON) tools/test.py --mode=debug,release
- make test-npm
+ python tools/test.py --mode=debug,release
+ $(MAKE) test-npm
test-all-http1: all
- python tools/test.py --mode=debug,release --use-http1
+ $(PYTHON) tools/test.py --mode=debug,release --use-http1
test-all-valgrind: all
- python tools/test.py --mode=debug,release --valgrind
+ $(PYTHON) tools/test.py --mode=debug,release --valgrind
test-release: all
- python tools/test.py --mode=release
+ $(PYTHON) tools/test.py --mode=release
test-debug: all
- python tools/test.py --mode=debug
+ $(PYTHON) tools/test.py --mode=debug
test-message: all
- python tools/test.py message
+ $(PYTHON) tools/test.py message
test-simple: all
- python tools/test.py simple
+ $(PYTHON) tools/test.py simple
test-pummel: all
- python tools/test.py pummel
+ $(PYTHON) tools/test.py pummel
test-internet: all
- python tools/test.py internet
+ $(PYTHON) tools/test.py internet
-test-npm: all
+test-npm: node
./node deps/npm/test/run.js
-test-npm-publish: all
+test-npm-publish: node
npm_package_config_publishtest=true ./node deps/npm/test/run.js
-out/Release/node: all
-
apidoc_sources = $(wildcard doc/api/*.markdown)
apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html))
docclean:
-rm -rf out/doc
- VERSION=$(shell git describe)
-clean:
- $(WAF) clean
- -find tools -name "*.pyc" | xargs rm -f
-
-distclean: docclean
- -find tools -name "*.pyc" | xargs rm -f
- -rm -rf dist-osx
- -rm -rf out/ node node_g
-
-check:
- @tools/waf-light check
-
+ VERSION=v$(shell $(PYTHON) tools/getnodeversion.py)
TARNAME=node-$(VERSION)
-TARBALL=$(TARNAME).tar.gz
-PKG=out/$(TARNAME).pkg
-packagemaker=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
-
--#dist: doc/node.1 doc/api
- dist: doc
+ dist: $(TARBALL) $(PKG)
+
+ PKGDIR=out/dist-osx
+
+ pkg: $(PKG)
+
+ $(PKG):
+ -rm -rf $(PKGDIR)
+ $(WAF) configure --prefix=/usr/local --without-snapshot
+ DESTDIR=$(PKGDIR) $(WAF) install
+ $(packagemaker) \
+ --id "org.nodejs.NodeJS-$(VERSION)" \
+ --doc tools/osx-pkg.pmdoc \
+ --out $(PKG)
+
+ $(TARBALL): out/doc
git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
mkdir -p $(TARNAME)/doc
cp doc/node.1 $(TARNAME)/doc/node.1
// allocations.
-namespace node {
-
-using namespace v8;
-
-static Persistent<String> on_headers_sym;
-static Persistent<String> on_headers_complete_sym;
-static Persistent<String> on_body_sym;
-static Persistent<String> on_message_complete_sym;
+#include <node_vars.h>
+// We do the following to minimize the detal between v0.6 branch. We want to
+// use the variables as they were being used before.
+#define on_headers_sym NODE_VAR(on_headers_sym)
+#define on_headers_complete_sym NODE_VAR(on_headers_complete_sym)
+#define on_body_sym NODE_VAR(on_body_sym)
+#define on_message_complete_sym NODE_VAR(on_message_complete_sym)
+#define delete_sym NODE_VAR(delete_sym)
+#define get_sym NODE_VAR(get_sym)
+#define head_sym NODE_VAR(head_sym)
+#define post_sym NODE_VAR(post_sym)
+#define put_sym NODE_VAR(put_sym)
+#define connect_sym NODE_VAR(connect_sym)
+#define options_sym NODE_VAR(options_sym)
+#define trace_sym NODE_VAR(trace_sym)
+#define patch_sym NODE_VAR(patch_sym)
+#define copy_sym NODE_VAR(copy_sym)
+#define lock_sym NODE_VAR(lock_sym)
+#define mkcol_sym NODE_VAR(mkcol_sym)
+#define move_sym NODE_VAR(move_sym)
+#define propfind_sym NODE_VAR(propfind_sym)
+#define proppatch_sym NODE_VAR(proppatch_sym)
+#define unlock_sym NODE_VAR(unlock_sym)
+#define report_sym NODE_VAR(report_sym)
+#define mkactivity_sym NODE_VAR(mkactivity_sym)
+#define checkout_sym NODE_VAR(checkout_sym)
+#define merge_sym NODE_VAR(merge_sym)
+#define msearch_sym NODE_VAR(msearch_sym)
+#define notify_sym NODE_VAR(notify_sym)
+#define subscribe_sym NODE_VAR(subscribe_sym)
+#define unsubscribe_sym NODE_VAR(unsubscribe_sym)
+#define unknown_method_sym NODE_VAR(unknown_method_sym)
+#define method_sym NODE_VAR(method_sym)
+#define status_code_sym NODE_VAR(status_code_sym)
+#define http_version_sym NODE_VAR(http_version_sym)
+#define version_major_sym NODE_VAR(version_major_sym)
+#define version_minor_sym NODE_VAR(version_minor_sym)
+#define should_keep_alive_sym NODE_VAR(should_keep_alive_sym)
+#define upgrade_sym NODE_VAR(upgrade_sym)
+#define headers_sym NODE_VAR(headers_sym)
+#define url_sym NODE_VAR(url_sym)
+#define settings NODE_VAR(settings)
+#define current_buffer NODE_VAR(current_buffer)
+#define current_buffer_data NODE_VAR(current_buffer_data)
+#define current_buffer_len NODE_VAR(current_buffer_len)
-static Persistent<String> delete_sym;
-static Persistent<String> get_sym;
-static Persistent<String> head_sym;
-static Persistent<String> post_sym;
-static Persistent<String> put_sym;
-static Persistent<String> connect_sym;
-static Persistent<String> options_sym;
-static Persistent<String> trace_sym;
-static Persistent<String> patch_sym;
-static Persistent<String> copy_sym;
-static Persistent<String> lock_sym;
-static Persistent<String> mkcol_sym;
-static Persistent<String> move_sym;
-static Persistent<String> propfind_sym;
-static Persistent<String> proppatch_sym;
-static Persistent<String> unlock_sym;
-static Persistent<String> report_sym;
-static Persistent<String> mkactivity_sym;
-static Persistent<String> checkout_sym;
-static Persistent<String> merge_sym;
-static Persistent<String> msearch_sym;
-static Persistent<String> notify_sym;
-static Persistent<String> subscribe_sym;
-static Persistent<String> unsubscribe_sym;
-static Persistent<String> unknown_method_sym;
-
-static Persistent<String> method_sym;
-static Persistent<String> status_code_sym;
-static Persistent<String> http_version_sym;
-static Persistent<String> version_major_sym;
-static Persistent<String> version_minor_sym;
-static Persistent<String> should_keep_alive_sym;
-static Persistent<String> upgrade_sym;
-static Persistent<String> headers_sym;
-static Persistent<String> url_sym;
-
-static struct http_parser_settings settings;
+namespace node {
-// This is a hack to get the current_buffer to the callbacks with the least
-// amount of overhead. Nothing else will run while http_parser_execute()
-// runs, therefore this pointer can be set and used for the execution.
-static Local<Value>* current_buffer;
-static char* current_buffer_data;
-static size_t current_buffer_len;
+using namespace v8;
- // gcc 3.x knows the always_inline attribute but fails at build time with a
- // "sorry, unimplemented: inlining failed" error when compiling at -O0
- #if defined(__GNUC__)
- # if __GNUC__ >= 4
- # define always_inline __attribute__((always_inline))
- # else
- # define always_inline inline
- # endif
- #elif defined(_MSC_VER)
- # define always_inline __forceinline
- #else
- # define always_inline
- #endif
-
-
#define HTTP_CB(name) \
static int name(http_parser* p_) { \
Parser* self = container_of(p_, Parser, parser_); \