Bring back standalone makefiles for a better transition
This commit is contained in:
parent
58dd01ab58
commit
75c109055d
5
.gitignore
vendored
5
.gitignore
vendored
@ -9,3 +9,8 @@
|
||||
*.suo
|
||||
/out/
|
||||
/build/gyp
|
||||
|
||||
/test/run-tests
|
||||
/test/run-tests.dSYM
|
||||
/test/run-benchmarks
|
||||
/test/run-benchmarks.dSYM
|
||||
|
||||
128
Makefile
128
Makefile
@ -1,27 +1,119 @@
|
||||
BUILDTYPE ?= Release
|
||||
# Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
all: out/Makefile
|
||||
$(MAKE) -C out BUILDTYPE=$(BUILDTYPE)
|
||||
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
||||
|
||||
debug: BUILDTYPE=Debug
|
||||
debug: all
|
||||
ifdef MSVC
|
||||
uname_S := MINGW
|
||||
endif
|
||||
|
||||
out/Makefile: build/gyp
|
||||
build/gyp_uv -f make
|
||||
CPPFLAGS += -Iinclude
|
||||
|
||||
build/gyp:
|
||||
svn co http://gyp.googlecode.com/svn/trunk@983 build/gyp
|
||||
CARES_OBJS =
|
||||
CARES_OBJS += src/ares/ares__close_sockets.o
|
||||
CARES_OBJS += src/ares/ares__get_hostent.o
|
||||
CARES_OBJS += src/ares/ares__read_line.o
|
||||
CARES_OBJS += src/ares/ares__timeval.o
|
||||
CARES_OBJS += src/ares/ares_cancel.o
|
||||
CARES_OBJS += src/ares/ares_data.o
|
||||
CARES_OBJS += src/ares/ares_destroy.o
|
||||
CARES_OBJS += src/ares/ares_expand_name.o
|
||||
CARES_OBJS += src/ares/ares_expand_string.o
|
||||
CARES_OBJS += src/ares/ares_fds.o
|
||||
CARES_OBJS += src/ares/ares_free_hostent.o
|
||||
CARES_OBJS += src/ares/ares_free_string.o
|
||||
CARES_OBJS += src/ares/ares_gethostbyaddr.o
|
||||
CARES_OBJS += src/ares/ares_gethostbyname.o
|
||||
CARES_OBJS += src/ares/ares_getnameinfo.o
|
||||
CARES_OBJS += src/ares/ares_getopt.o
|
||||
CARES_OBJS += src/ares/ares_getsock.o
|
||||
CARES_OBJS += src/ares/ares_init.o
|
||||
CARES_OBJS += src/ares/ares_library_init.o
|
||||
CARES_OBJS += src/ares/ares_llist.o
|
||||
CARES_OBJS += src/ares/ares_mkquery.o
|
||||
CARES_OBJS += src/ares/ares_nowarn.o
|
||||
CARES_OBJS += src/ares/ares_options.o
|
||||
CARES_OBJS += src/ares/ares_parse_a_reply.o
|
||||
CARES_OBJS += src/ares/ares_parse_aaaa_reply.o
|
||||
CARES_OBJS += src/ares/ares_parse_mx_reply.o
|
||||
CARES_OBJS += src/ares/ares_parse_ns_reply.o
|
||||
CARES_OBJS += src/ares/ares_parse_ptr_reply.o
|
||||
CARES_OBJS += src/ares/ares_parse_srv_reply.o
|
||||
CARES_OBJS += src/ares/ares_parse_txt_reply.o
|
||||
CARES_OBJS += src/ares/ares_process.o
|
||||
CARES_OBJS += src/ares/ares_query.o
|
||||
CARES_OBJS += src/ares/ares_search.o
|
||||
CARES_OBJS += src/ares/ares_send.o
|
||||
CARES_OBJS += src/ares/ares_strcasecmp.o
|
||||
CARES_OBJS += src/ares/ares_strdup.o
|
||||
CARES_OBJS += src/ares/ares_strerror.o
|
||||
CARES_OBJS += src/ares/ares_timeout.o
|
||||
CARES_OBJS += src/ares/ares_version.o
|
||||
CARES_OBJS += src/ares/ares_writev.o
|
||||
CARES_OBJS += src/ares/bitncmp.o
|
||||
CARES_OBJS += src/ares/inet_net_pton.o
|
||||
CARES_OBJS += src/ares/inet_ntop.o
|
||||
|
||||
clean:
|
||||
rm -rf out
|
||||
ifneq (,$(findstring MINGW,$(uname_S)))
|
||||
include config-mingw.mk
|
||||
else
|
||||
include config-unix.mk
|
||||
endif
|
||||
|
||||
distclean:
|
||||
rm -rf out
|
||||
TESTS=test/echo-server.c test/test-*.c
|
||||
BENCHMARKS=test/echo-server.c test/dns-server.c test/benchmark-*.c
|
||||
|
||||
test: all
|
||||
./out/$(BUILDTYPE)/run-tests
|
||||
all: uv.a test/run-tests test/run-benchmarks
|
||||
|
||||
bench: all
|
||||
./out/$(BUILDTYPE)/run-benchmarks
|
||||
$(CARES_OBJS): %.o: %.c
|
||||
$(CC) -o $*.o -c $(CFLAGS) $(CPPFLAGS) $< -DHAVE_CONFIG_H
|
||||
|
||||
.PHONY: all clean distclean test bench
|
||||
test/run-tests$(E): test/*.h test/run-tests.c $(RUNNER_SRC) test/runner-unix.c $(TESTS) uv.a
|
||||
$(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) $(RUNNER_LINKFLAGS) -o test/run-tests test/run-tests.c \
|
||||
test/runner.c $(RUNNER_SRC) $(TESTS) uv.a $(RUNNER_LIBS)
|
||||
|
||||
test/run-benchmarks$(E): test/*.h test/run-benchmarks.c test/runner.c $(RUNNER_SRC) $(BENCHMARKS) uv.a
|
||||
$(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) $(RUNNER_LINKFLAGS) -o test/run-benchmarks test/run-benchmarks.c \
|
||||
test/runner.c $(RUNNER_SRC) $(BENCHMARKS) uv.a $(RUNNER_LIBS)
|
||||
|
||||
test/echo.o: test/echo.c test/echo.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c test/echo.c -o test/echo.o
|
||||
|
||||
|
||||
.PHONY: clean clean-platform distclean distclean-platform test bench
|
||||
|
||||
|
||||
test: test/run-tests$(E)
|
||||
test/run-tests
|
||||
|
||||
#test-%: test/run-tests$(E)
|
||||
# test/run-tests $(@:test-%=%)
|
||||
|
||||
bench: test/run-benchmarks$(E)
|
||||
test/run-benchmarks
|
||||
|
||||
#bench-%: test/run-benchmarks$(E)
|
||||
# test/run-benchmarks $(@:bench-%=%)
|
||||
|
||||
clean: clean-platform
|
||||
$(RM) -f src/*.o *.a test/run-tests$(E) test/run-benchmarks$(E)
|
||||
|
||||
distclean: distclean-platform
|
||||
$(RM) -f src/*.o *.a test/run-tests$(E) test/run-benchmarks$(E)
|
||||
|
||||
32
README
32
README
@ -6,24 +6,40 @@ http://nodejs.org/
|
||||
|
||||
= Build Instructions
|
||||
|
||||
The build system requires python and subversion.
|
||||
For GCC (including MinGW) there are two methods building: via normal
|
||||
makefiles or via GYP. GYP is a meta-build system which can generate MSVS,
|
||||
Makefile, and XCode backends. It is best used for integration into other
|
||||
projects. The old (more stable) system is using Makefiles.
|
||||
|
||||
On Unix systems just type
|
||||
To build via Makefile simply execute:
|
||||
|
||||
make
|
||||
|
||||
On Windows you can generate the MSVS solution files by running
|
||||
To build with Visual Studio run the create-msvs-files.bat file which will
|
||||
checkout the GYP code into build/gyp and generate the build/all.sln and
|
||||
related files.
|
||||
|
||||
create-msvs-files.bat
|
||||
To have GYP generate build script for another system you will need to
|
||||
checkout GYP into the project tree manually:
|
||||
|
||||
Open build/all.sln afterwards.
|
||||
svn co http://gyp.googlecode.com/svn/trunk build/gyp
|
||||
|
||||
And then run
|
||||
|
||||
./build/gyp_uv -f make
|
||||
|
||||
or
|
||||
|
||||
./build/gyp_uv -f xcode
|
||||
|
||||
|
||||
= Supported Platforms
|
||||
|
||||
Microsoft Windows operating systems since Windows XP sp2. It can be built
|
||||
with either Visual Studio.
|
||||
Microsoft Windows operating systems since Windows XP SP2. It can be built
|
||||
with either Visual Studio or MinGW.
|
||||
|
||||
Linux 2.6 and MacOS using the GCC toolchain.
|
||||
Linux 2.6 using the GCC toolchain.
|
||||
|
||||
MacOS using the GCC or XCode toolchain.
|
||||
|
||||
Solaris 121 and later using GCC toolchain.
|
||||
|
||||
67
config-mingw.mk
Normal file
67
config-mingw.mk
Normal file
@ -0,0 +1,67 @@
|
||||
# Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
# Use make -f Makefile.gcc PREFIX=i686-w64-mingw32-
|
||||
# for cross compilation
|
||||
CC = $(PREFIX)gcc
|
||||
AR = $(PREFIX)ar
|
||||
E=.exe
|
||||
|
||||
CFLAGS=$(CPPFLAGS) -g --std=gnu89 -D_WIN32_WINNT=0x0501 -Isrc/ares/config_win32
|
||||
LINKFLAGS=-lm
|
||||
|
||||
CARES_OBJS += src/ares/windows_port.o
|
||||
WIN_SRCS=$(wildcard src/win/*.c)
|
||||
WIN_OBJS=$(WIN_SRCS:.c=.o)
|
||||
|
||||
RUNNER_CFLAGS=$(CFLAGS) -D_GNU_SOURCE # Need _GNU_SOURCE for strdup?
|
||||
RUNNER_LINKFLAGS=$(LINKFLAGS)
|
||||
RUNNER_LIBS=-lws2_32
|
||||
RUNNER_SRC=test/runner-win.c
|
||||
|
||||
uv.a: $(WIN_OBJS) src/uv-common.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS)
|
||||
$(AR) rcs uv.a src/win/*.o src/uv-common.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS)
|
||||
|
||||
src/win/%.o: src/win/%.c src/win/internal.h
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
src/uv-common.o: src/uv-common.c include/uv.h include/uv-win.h
|
||||
$(CC) $(CFLAGS) -c src/uv-common.c -o src/uv-common.o
|
||||
|
||||
EIO_CPPFLAGS += $(CPPFLAGS)
|
||||
EIO_CPPFLAGS += -DEIO_CONFIG_H=\"$(EIO_CONFIG)\"
|
||||
EIO_CPPFLAGS += -DEIO_STACKSIZE=65536
|
||||
EIO_CPPFLAGS += -D_GNU_SOURCE
|
||||
|
||||
src/eio/eio.o: src/eio/eio.c
|
||||
$(CC) $(EIO_CPPFLAGS) $(CFLAGS) -c src/eio/eio.c -o src/eio/eio.o
|
||||
|
||||
src/uv-eio.o: src/uv-eio.c
|
||||
$(CC) $(CPPFLAGS) -Isrc/eio/ $(CFLAGS) -c src/uv-eio.c -o src/uv-eio.o
|
||||
|
||||
clean-platform:
|
||||
-rm -f src/ares/*.o
|
||||
-rm -f src/eio/*.o
|
||||
-rm -f src/win/*.o
|
||||
|
||||
distclean-platform:
|
||||
-rm -f src/ares/*.o
|
||||
-rm -f src/eio/*.o
|
||||
-rm -f src/win/*.o
|
||||
121
config-unix.mk
Normal file
121
config-unix.mk
Normal file
@ -0,0 +1,121 @@
|
||||
# Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
CC = $(PREFIX)gcc
|
||||
AR = $(PREFIX)ar
|
||||
E=
|
||||
CSTDFLAG=--std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
|
||||
CFLAGS=-g
|
||||
CPPFLAGS += -Isrc/ev
|
||||
LINKFLAGS=-lm
|
||||
|
||||
CPPFLAGS += -D_LARGEFILE_SOURCE
|
||||
CPPFLAGS += -D_FILE_OFFSET_BITS=64
|
||||
|
||||
ifeq (SunOS,$(uname_S))
|
||||
EV_CONFIG=config_sunos.h
|
||||
EIO_CONFIG=config_sunos.h
|
||||
CPPFLAGS += -Isrc/ares/config_sunos -D__EXTENSIONS__
|
||||
LINKFLAGS+=-lsocket -lnsl
|
||||
UV_OS_FILE=uv-sunos.c
|
||||
endif
|
||||
|
||||
ifeq (Darwin,$(uname_S))
|
||||
EV_CONFIG=config_darwin.h
|
||||
EIO_CONFIG=config_darwin.h
|
||||
CPPFLAGS += -Isrc/ares/config_darwin
|
||||
LINKFLAGS+=-framework CoreServices
|
||||
UV_OS_FILE=uv-darwin.c
|
||||
endif
|
||||
|
||||
ifeq (Linux,$(uname_S))
|
||||
EV_CONFIG=config_linux.h
|
||||
EIO_CONFIG=config_linux.h
|
||||
CSTDFLAG += -D_XOPEN_SOURCE=600
|
||||
CPPFLAGS += -Isrc/ares/config_linux
|
||||
LINKFLAGS+=-lrt
|
||||
UV_OS_FILE=uv-linux.c
|
||||
endif
|
||||
|
||||
ifeq (FreeBSD,$(uname_S))
|
||||
EV_CONFIG=config_freebsd.h
|
||||
EIO_CONFIG=config_freebsd.h
|
||||
CPPFLAGS += -Isrc/ares/config_freebsd
|
||||
LINKFLAGS+=
|
||||
UV_OS_FILE=uv-freebsd.c
|
||||
endif
|
||||
|
||||
ifneq (,$(findstring CYGWIN,$(uname_S)))
|
||||
EV_CONFIG=config_cygwin.h
|
||||
EIO_CONFIG=config_cygwin.h
|
||||
# We drop the --std=c89, it hides CLOCK_MONOTONIC on cygwin
|
||||
CSTDFLAG = -D_GNU_SOURCE
|
||||
CPPFLAGS += -Isrc/ares/config_cygwin
|
||||
LINKFLAGS+=
|
||||
UV_OS_FILE=uv-cygwin.c
|
||||
endif
|
||||
|
||||
# Need _GNU_SOURCE for strdup?
|
||||
RUNNER_CFLAGS=$(CFLAGS) -D_GNU_SOURCE
|
||||
|
||||
RUNNER_LINKFLAGS=$(LINKFLAGS) -pthread
|
||||
RUNNER_LIBS=
|
||||
RUNNER_SRC=test/runner-unix.c
|
||||
|
||||
uv.a: src/uv-unix.o src/uv-common.o src/uv-platform.o src/ev/ev.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS)
|
||||
$(AR) rcs uv.a src/uv-unix.o src/uv-platform.o src/uv-common.o src/uv-eio.o src/ev/ev.o \
|
||||
src/eio/eio.o $(CARES_OBJS)
|
||||
|
||||
src/uv-platform.o: src/$(UV_OS_FILE) include/uv.h include/uv-unix.h
|
||||
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c src/$(UV_OS_FILE) -o src/uv-platform.o
|
||||
|
||||
src/uv-unix.o: src/uv-unix.c include/uv.h include/uv-unix.h
|
||||
$(CC) $(CSTDFLAG) $(CPPFLAGS) -Ieio $(CFLAGS) -c src/uv-unix.c -o src/uv-unix.o
|
||||
|
||||
src/uv-common.o: src/uv-common.c include/uv.h include/uv-unix.h
|
||||
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c src/uv-common.c -o src/uv-common.o
|
||||
|
||||
src/ev/ev.o: src/ev/ev.c
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c src/ev/ev.c -o src/ev/ev.o -DEV_CONFIG_H=\"$(EV_CONFIG)\"
|
||||
|
||||
|
||||
EIO_CPPFLAGS += $(CPPFLAGS)
|
||||
EIO_CPPFLAGS += -DEIO_CONFIG_H=\"$(EIO_CONFIG)\"
|
||||
EIO_CPPFLAGS += -DEIO_STACKSIZE=262144
|
||||
EIO_CPPFLAGS += -D_GNU_SOURCE
|
||||
|
||||
src/eio/eio.o: src/eio/eio.c
|
||||
$(CC) $(EIO_CPPFLAGS) $(CFLAGS) -c src/eio/eio.c -o src/eio/eio.o
|
||||
|
||||
src/uv-eio.o: src/uv-eio.c
|
||||
$(CC) $(CPPFLAGS) -Isrc/eio/ $(CSTDFLAG) $(CFLAGS) -c src/uv-eio.c -o src/uv-eio.o
|
||||
|
||||
|
||||
clean-platform:
|
||||
-rm -f src/ares/*.o
|
||||
-rm -f src/ev/*.o
|
||||
-rm -f src/eio/*.o
|
||||
-rm -rf test/run-tests.dSYM run-benchmarks.dSYM
|
||||
|
||||
distclean-platform:
|
||||
-rm -f src/ares/*.o
|
||||
-rm -f src/ev/*.o
|
||||
-rm -f src/eio/*.o
|
||||
-rm -rf test/run-tests.dSYM run-benchmarks.dSYM
|
||||
Loading…
Reference in New Issue
Block a user