Permalink
Browse files

Replace WAF with make/autoconf

  • Loading branch information...
1 parent bb85e77 commit 15594eaf87066abc8cf36520a1ad95e0c52da517 @ry ry committed Oct 4, 2010
View
@@ -15,3 +15,9 @@ node
node_g
*.swp
.benchmark_reports
+
+autom4te.cache/
+config.log
+config.mak.autogen
+config.status
+configure
View
312 Makefile
@@ -1,39 +1,305 @@
-WAF=python tools/waf-light
+#config
-all:
- @$(WAF) build
+# define DEBUG=1 to build node_g
-all-progress:
- @$(WAF) -p build
+WANT_OPENSSL=1
+PREFIX=/usr
+SHELL=/bin/sh
+INSTALL = install
-install:
- @$(WAF) install
-uninstall:
- @$(WAF) uninstall
+-include config.mak.autogen
+-include config.mak
-test: all
+
+platform := $(shell python -c 'import sys; print sys.platform')
+
+
+ifeq ($(platform),linux2)
+ platform := linux
+endif
+
+# fix me
+arch = x86_64
+
+
+ifeq ($(platform),darwin)
+ LINKFLAGS += -framework Carbon
+endif
+
+ifeq ($(platform),linux)
+ LINKFLAGS += -pthread -lrt
+endif
+
+ifdef WANT_OPENSSL
+ HAVE_OPENSSL = 1
+ HAVE_CRYPTO = 1
+ ifdef OPENSSL_DIR
+ OPENSSL_LINKFLAGS += -L$(OPENSSL_DIR)/lib
+ OPENSSL_CPPFLAGS += -I$(OPENSSL_DIR)/include
+ endif
+ OPENSSL_LINKFLAGS += -lssl -lcrypto
+endif
+
+cflags += -pedantic
+
+
+
+
+debug_CPPDEFINES = -DDEBUG $(CFLAGS)
+debug_CFLAGS = -Wall -O0 -ggdb $(CFLAGS)
+debug_CXXFLAGS = $(debug_CFLAGS)
+debug_LINKFLAGS = $(LINKFLAGS)
+
+release_CPPDEFINES = -DNODEBUG
+release_CFLAGS = -Wall -O2
+release_CXXFLAGS = $(release_CFLAGS)
+release_LINKFLAGS = $(LINKFLAGS)
+
+builddir = build
+
+
+libev_sources = deps/libev/ev.c
+# Note: -I$(builddir)/deps/libev contains config.h which is generated from
+# deps/libev/config.h.in during the configure script
+libev_CPPFLAGS = -Ideps/libev -I$(builddir)/deps/libev
+libev_release_objects = $(builddir)/release/deps/libev/ev.o
+libev_debug_objects = $(builddir)/debug/deps/libev/ev.o
+
+libeio_sources = deps/libeio/eio.c
+libeio_release_objects = $(builddir)/release/deps/libeio/eio.o
+libeio_debug_objects = $(builddir)/debug/deps/libeio/eio.o
+# Note: -I$(builddir)/deps/libeio contains config.h which is generated from
+# deps/libeio/config.h.in during the configure script
+libeio_CPPFLAGS = -D_GNU_SOURCE -Ideps/libeio -I$(builddir)/deps/libeio
+
+http_parser_sources = deps/http_parser/http_parser.c
+http_parser_release_objects = $(builddir)/release/deps/http_parser/http_parser.o
+http_parser_debug_objects = $(builddir)/debug/deps/http_parser/http_parser.o
+http_parser_CPPFLAGS = -Ideps/http_parser
+
+cares_sources = $(wildcard deps/c-ares/*.c)
+cares_release_objects = $(addprefix $(builddir)/release/,$(cares_sources:.c=.o))
+cares_debug_objects = $(addprefix $(builddir)/debug/,$(cares_sources:.c=.o))
+cares_CPPFLAGS = -DHAVE_CONFIG_H=1 -Ideps/c-ares -Ideps/c-ares/$(platform)-$(arch)
+
+node_sources = src/node.cc \
+ src/platform_$(platform).cc \
+ src/node_buffer.cc \
+ src/node_cares.cc \
+ src/node_child_process.cc \
+ src/node_constants.cc \
+ src/node_crypto.cc \
+ src/node_events.cc \
+ src/node_extensions.cc \
+ src/node_file.cc \
+ src/node_http_parser.cc \
+ src/node_idle_watcher.cc \
+ src/node_io_watcher.cc \
+ src/node_main.cc \
+ src/node_net.cc \
+ src/node_script.cc \
+ src/node_signal_watcher.cc \
+ src/node_stat_watcher.cc \
+ src/node_stdio.cc \
+ src/node_timer.cc \
+ src/node_javascript.cc \
+
+node_debug_objects = $(addprefix $(builddir)/debug/,$(node_sources:.cc=.o))
+node_release_objects = $(addprefix $(builddir)/release/,$(node_sources:.cc=.o))
+
+# TODO HAVE_FDATASYNC should be set in configure.
+
+node_CPPFLAGS = -Isrc/ -Ideps/libeio/ -Ideps/libev/ -Ideps/http_parser/ \
+ -Ideps/libev/include/ -Ideps/v8/include -DPLATFORM=\"$(platform)\" \
+ -DX_STACKSIZE=65536 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 \
+ -DHAVE_FDATASYNC=0 -I$(builddir)/release/src $(cares_CPPFLAGS)
+node_debug_CPPFLAGS = $(subst release,debug,$(NODE_CPPFLAGS))
+
+libv8 = $(builddir)/libv8.a
+libv8_g = $(builddir)/libv8_g.a
+
+dirs = $(builddir)/release/src \
+ $(builddir)/release/deps/libev \
+ $(builddir)/release/deps/libeio \
+ $(builddir)/release/deps/c-ares \
+ $(builddir)/release/deps/http_parser \
+ $(builddir)/release/deps/v8 \
+ $(builddir)/release/lib/pkgconfig
+debug_dirs = $(subst release,debug,$(dirs))
+
+
+
+
+# Rules
+
+all: $(dirs) node
+
+ifdef DEBUG
+all: $(debug_dirs) node_g
+endif
+
+
+node: $(builddir)/node
+ ln -fs $< $@
+
+node_g: $(builddir)/node_g
+ ln -fs $< $@
+
+
+
+$(dirs) $(debug_dirs):
+ mkdir -p $@
+
+
+# libev
+
+$(builddir)/release/deps/libev/%.o: deps/libev/%.c
+ $(CC) -c $(release_CFLAGS) $(release_CPPFLAGS) $(libev_CFLAGS) \
+ $(libev_CPPFLAGS) $< -o $@
+
+$(builddir)/debug/deps/libev/%.o: deps/libev/%.c
+ $(CC) -c $(debug_CFLAGS) $(debug_CPPFLAGS) $(libev_CFLAGS) \
+ $(libev_CPPFLAGS) $< -o $@
+
+
+# libeio
+
+$(builddir)/release/deps/libeio/%.o: deps/libeio/%.c
+ $(CC) -c $(release_CFLAGS) $(release_CPPFLAGS) $(libeio_CFLAGS) \
+ $(libeio_CPPFLAGS) $< -o $@
+
+$(builddir)/debug/deps/libeio/%.o: deps/libeio/%.c
+ $(CC) -c $(debug_CFLAGS) $(debug_CPPFLAGS) $(libeio_CFLAGS) \
+ $(libeio_CPPFLAGS) $< -o $@
+
+
+# http-parser
+
+$(builddir)/release/deps/http_parser/%.o: deps/http_parser/%.c
+ $(CC) -c $(release_CFLAGS) $(release_CPPFLAGS) $(http_parser_CFLAGS) \
+ $(http_parser_CPPFLAGS) $< -o $@
+
+$(builddir)/debug/deps/http_parser/%.o: deps/http_parser/%.c
+ $(CC) -c $(debug_CFLAGS) $(debug_CPPFLAGS) $(http_parser_CFLAGS) \
+ $(http_parser_CPPFLAGS) $< -o $@
+
+
+# c-ares
+
+$(builddir)/release/deps/c-ares/%.o: deps/c-ares/%.c
+ $(CC) -c $(release_CFLAGS) $(release_CPPFLAGS) $(cares_CFLAGS) \
+ $(cares_CPPFLAGS) $< -o $@
+
+$(builddir)/debug/deps/c-ares/%.o: deps/c-ares/%.c
+ $(CC) -c $(debug_CFLAGS) $(debug_CPPFLAGS) $(cares_CFLAGS) \
+ $(cares_CPPFLAGS) $< -o $@
+
+
+# node
+
+$(builddir)/release/src/%.o: src/%.cc
+ $(CXX) -c $(release_CXXFLAGS) $(release_CPPFLAGS) $(node_CXXFLAGS) \
+ $(node_CPPFLAGS) $(OPENSSL_CPPFLAGS) $< -o $@
+
+$(builddir)/debug/src/%.o: src/%.cc
+ $(CXX) -c $(debug_CXXFLAGS) $(debug_CPPFLAGS) $(node_CXXFLAGS) \
+ $(node_CPPFLAGS) $(OPENSSL_CPPFLAGS) $< -o $@
+
+
+# node.o
+
+$(builddir)/release/src/node.o: src/node.cc $(builddir)/release/src/node_natives.h
+ $(CXX) -c $(release_CXXFLAGS) $(release_CPPFLAGS) $(node_CFLAGS) \
+ $(node_CPPFLAGS) $(OPENSSL_CPPFLAGS) $< -o $@
+
+$(builddir)/debug/src/node.o: src/node.cc $(builddir)/debug/src/node_natives.h
+ $(CXX) -c $(debug_CXXFLAGS) $(debug_CPPFLAGS) $(node_CFLAGS) \
+ $(node_CPPFLAGS) $(OPENSSL_CPPFLAGS) $< -o $@
+
+
+# node executable
+
+$(builddir)/node: $(node_release_objects) $(libev_release_objects) \
+ $(libeio_release_objects) $(http_parser_release_objects) \
+ $(cares_release_objects) $(libv8)
+ $(CXX) -o $@ $^ $(release_LINKFLAGS) $(node_LINKFLAGS) $(OPENSSL_LINKFLAGS)
+
+$(builddir)/node_g: $(node_debug_objects) $(libev_debug_objects) \
+ $(libeio_debug_objects) $(http_parser_debug_objects) \
+ $(cares_debug_objects) $(libv8_g)
+ $(CXX) -o $@ $^ $(debug_LINKFLAGS) $(node_LINKFLAGS) $(OPENSSL_LINKFLAGS)
+
+
+
+$(builddir)/release/src/node_natives.h: src/node.js lib/*.js
+ python tools/js2c.py $^ > $@
+
+$(builddir)/debug/src/node_natives.h: src/node.js lib/*.js
+ python tools/js2c.py $^ > $@
+ # TODO a debug flag for the macros ?
+
+
+
+$(builddir)/release/src/node_config.h: src/node_config.h.in
+ sed -e "s#@PREFIX@#$(PREFIX)#" \
+ -e "s#@CCFLAGS@#$(release_CFLAGS)#" \
+ -e "s#@CPPFLAGS@#$(release_CPPFLAGS)#" $< > $@ || rm $@
+
+$(builddir)/debug/src/node_config.h: src/node_config.h.in
+ sed -e "s#@PREFIX@#$(PREFIX)#" \
+ -e "s#@CCFLAGS@#$(debug_CFLAGS)#" \
+ -e "s#@CPPFLAGS@#$(debug_CPPFLAGS)#" $< > $@ || rm $@
+
+
+# FIXME convert to a generalized *.in preprocessor
+$(builddir)/release/lib/pkgconfig/nodejs.pc: tools/nodejs.pc.in
+ sed \
+ -e "s#@PREFIX@#$(PREFIX)#" \
+ -e "s#@VERSION@#$(VERSION)#" \
+ -e "s#@CCFLAGS@#$(CFLAGS)#" \
+ -e "s#@CPPFLAGS@#$(CPPFLAGS)#" $< > $@ || rm $@
+
+# v8 does its own debug and release version, so we don't put it in the
+# profile_builddir but rather just the builddir.
+$(libv8):
+ python tools/scons/scons.py -C $(builddir) -Y `pwd`/deps/v8 \
+ visibility=default mode=release arch=x64 library=static snapshot=on
+
+$(libv8_g):
+ python tools/scons/scons.py -C $(builddir) -Y `pwd`/deps/v8 \
+ visibility=default mode=debug arch=x64 library=static snapshot=on
+
+
+# header deps
+$(builddir)/release/src/node.o: $(builddir)/release/src/node_config.h
+$(builddir)/debug/src/node.o: $(builddir)/debug/src/node_config.h
+
+
+# TODO install
+
+test: $(builddir)/node
python tools/test.py --mode=release simple message
-test-all: all
+test-all: $(builddir)/node $(builddir)/node_g
python tools/test.py --mode=debug,release
-test-release: all
+test-release: $(builddir)/node
python tools/test.py --mode=release
-test-debug: all
+test-debug: $(builddir)/node_g
python tools/test.py --mode=debug
-test-message: all
+test-message: $(builddir)/node
python tools/test.py message
-test-simple: all
+test-simple: $(builddir)/node
python tools/test.py simple
-test-pummel: all
+test-pummel: $(builddir)/node
python tools/test.py pummel
-test-internet: all
+test-internet: $(builddir)/node
python tools/test.py internet
# http://rtomayko.github.com/ronn
@@ -59,15 +325,15 @@ docclean:
@-rm -f doc/node.1 doc/api.html doc/changelog.html
clean:
- @$(WAF) clean
- @-find tools -name "*.pyc" | xargs rm -f
+ -rm -f node node_g $(builddir)/node $(builddir)/node_g
+ -find $(builddir) -name "*.o" | xargs rm -f
+ -find . -name "*.pyc" | xargs rm -f
distclean: docclean
- @-find tools -name "*.pyc" | xargs rm -f
- @-rm -rf build/ node node_g
+ -find tools -name "*.pyc" | xargs rm -f
+ -rm -rf build/ node node_g
+ -rm -rf configure config.mak.autogen config.log autom4te.cache config.status
-check:
- @tools/waf-light check
VERSION=$(shell git describe)
TARNAME=node-$(VERSION)
View
@@ -0,0 +1,26 @@
+# git Makefile configuration, included in main Makefile
+# @configure_input@
+
+CC = @CC@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+AR = @AR@
+TAR = @TAR@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+datarootdir = @datarootdir@
+
+mandir=@mandir@
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+export exec_prefix mandir
+export srcdir VPATH
+
+
+
+WANT_OPENSSL=@WANT_OPENSSL@
Oops, something went wrong.

10 comments on commit 15594ea

tj replied Oct 25, 2010

node-waf will be no more right?

Build failed on debian x64:

deps/libev/ev.c:49:22: error: config.h: No such file or directory
deps/libev/ev.c: In function ‘ev_feed_event’:
deps/libev/ev.c:870: warning: unused variable ‘ocur_’
deps/libev/ev.c: In function ‘feed_reverse’:
deps/libev/ev.c:879: warning: unused variable ‘ocur_’
deps/libev/ev.c: In function ‘fd_change’:
deps/libev/ev.c:990: warning: unused variable ‘ocur_’
deps/libev/ev.c: In function ‘evpipe_init’:
deps/libev/ev.c:1240: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c: In function ‘loop_init’:
deps/libev/ev.c:1689: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:1689: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:1689: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:1692: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:1692: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:1692: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:1693: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c: In function ‘loop_destroy’:
deps/libev/ev.c:1704: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c: In function ‘loop_fork’:
deps/libev/ev.c:1799: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c: In function ‘verify_watcher’:
deps/libev/ev.c:1866: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c:1869: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c: In function ‘verify_heap’:
deps/libev/ev.c:1879: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c:1880: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c:1881: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c: In function ‘array_verify’:
deps/libev/ev.c:1892: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c: In function ‘ev_verify’:
deps/libev/ev.c:1910: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c:1917: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c:1918: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c: In function ‘ev_default_loop_init’:
deps/libev/ev.c:1990: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:1990: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:1990: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:1991: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c: In function ‘timers_reify’:
deps/libev/ev.c:2115: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c: In function ‘periodics_reify’:
deps/libev/ev.c:2154: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c:2141: warning: unused variable ‘feed_count’
deps/libev/ev.c: In function ‘ev_run’:
deps/libev/ev.c:2303: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c: In function ‘ev_io_start’:
deps/libev/ev.c:2576: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c:2577: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c:2585: warning: suggest parentheses around arithmetic in operand of ‘|’
deps/libev/ev.c: In function ‘ev_io_stop’:
deps/libev/ev.c:2598: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c: In function ‘ev_timer_start’:
deps/libev/ev.c:2618: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c:2624: warning: unused variable ‘ocur_’
deps/libev/ev.c: In function ‘ev_timer_stop’:
deps/libev/ev.c:2646: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c: In function ‘ev_periodic_start’:
deps/libev/ev.c:2706: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c:2717: warning: unused variable ‘ocur_’
deps/libev/ev.c: In function ‘ev_periodic_stop’:
deps/libev/ev.c:2739: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c: In function ‘ev_signal_start’:
deps/libev/ev.c:2776: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c:2779: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c: In function ‘ev_child_start’:
deps/libev/ev.c:2893: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c: In function ‘ev_stat_start’:
deps/libev/ev.c:3260: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3260: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3260: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3260: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3261: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c: In function ‘ev_stat_stop’:
deps/libev/ev.c:3293: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c: In function ‘ev_idle_start’:
deps/libev/ev.c:3322: warning: unused variable ‘ocur_’
deps/libev/ev.c: In function ‘ev_prepare_start’:
deps/libev/ev.c:3362: warning: unused variable ‘ocur_’
deps/libev/ev.c: In function ‘ev_check_start’:
deps/libev/ev.c:3400: warning: unused variable ‘ocur_’
deps/libev/ev.c: In function ‘ev_embed_start’:
deps/libev/ev.c:3495: warning: left-hand operand of comma expression has no effect
deps/libev/ev.c:3496: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3496: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3496: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3501: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3504: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3504: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3504: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3505: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3508: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3508: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3508: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c: In function ‘ev_fork_start’:
deps/libev/ev.c:3547: warning: unused variable ‘ocur_’
deps/libev/ev.c: In function ‘ev_async_start’:
deps/libev/ev.c:3589: warning: unused variable ‘ocur_’
deps/libev/ev.c: In function ‘ev_once’:
deps/libev/ev.c:3677: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3677: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3677: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3684: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3684: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3684: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3687: warning: dereferencing type-punned pointer will break strict-aliasing rules
deps/libev/ev.c:3803:27: warning: "/*" within comment
deps/libev/ev.c:3804:27: warning: "/*" within comment
make: *** [build/release/deps/libev/ev.o] Error 1

ry replied Oct 25, 2010

@visionmedia - node-waf will be around for a long time. This is for node's build system.

ry replied Oct 25, 2010

@akaspin - I'm sure this broke most builds. Sorry - it's probably going to take some time before we're back up to speed.

Maybe then revert this commit and and complete migration to new build system in branch?

ry replied Oct 25, 2010

no. this is already the result of a branch merge - something as central as the build system need to be in the mainline as soon as possible. this is a development branch - where development occurs.

Thanks for your answer. Do you need any info? I like to work with developer branch.

ry replied Oct 25, 2010

have you run

autoconf
./configure
make

?

autoconf... I'm stupid. All builds fine.All tests passed. Maybe add autoconf in readme?

no make install?

Please sign in to comment.