build: fix make test on darwin and sunos
This commit is contained in:
parent
f352e40e00
commit
62332ea090
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,14 +1,16 @@
|
|||||||
*.swp
|
*.swp
|
||||||
*.[oa]
|
*.[oa]
|
||||||
*.so
|
*.l[oa]
|
||||||
*.lo
|
|
||||||
*.la
|
|
||||||
*.opensdf
|
*.opensdf
|
||||||
*.orig
|
*.orig
|
||||||
*.sdf
|
*.sdf
|
||||||
*.suo
|
*.suo
|
||||||
core
|
core
|
||||||
vgcore.*
|
vgcore.*
|
||||||
|
|
||||||
|
/libuv.so
|
||||||
|
/libuv.dylib
|
||||||
|
|
||||||
/out/
|
/out/
|
||||||
/build/gyp
|
/build/gyp
|
||||||
|
|
||||||
|
|||||||
10
Makefile
10
Makefile
@ -26,6 +26,12 @@ endif
|
|||||||
|
|
||||||
CPPFLAGS += -Iinclude -Iinclude/uv-private
|
CPPFLAGS += -Iinclude -Iinclude/uv-private
|
||||||
|
|
||||||
|
ifeq (Darwin,$(uname_S))
|
||||||
|
SOEXT = dylib
|
||||||
|
else
|
||||||
|
SOEXT = so
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq (,$(findstring MINGW,$(uname_S)))
|
ifneq (,$(findstring MINGW,$(uname_S)))
|
||||||
include config-mingw.mk
|
include config-mingw.mk
|
||||||
else
|
else
|
||||||
@ -37,10 +43,10 @@ BENCHMARKS=test/blackhole-server.c test/echo-server.c test/dns-server.c test/ben
|
|||||||
|
|
||||||
all: libuv.a
|
all: libuv.a
|
||||||
|
|
||||||
test/run-tests$(E): test/run-tests.c test/runner.c $(RUNNER_SRC) $(TESTS) libuv.so
|
test/run-tests$(E): test/run-tests.c test/runner.c $(RUNNER_SRC) $(TESTS) libuv.$(SOEXT)
|
||||||
$(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) -o $@ $^ $(RUNNER_LIBS) $(RUNNER_LINKFLAGS)
|
$(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) -o $@ $^ $(RUNNER_LIBS) $(RUNNER_LINKFLAGS)
|
||||||
|
|
||||||
test/run-benchmarks$(E): test/run-benchmarks.c test/runner.c $(RUNNER_SRC) $(BENCHMARKS) libuv.so
|
test/run-benchmarks$(E): test/run-benchmarks.c test/runner.c $(RUNNER_SRC) $(BENCHMARKS) libuv.$(SOEXT)
|
||||||
$(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) -o $@ $^ $(RUNNER_LIBS) $(RUNNER_LINKFLAGS)
|
$(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) -o $@ $^ $(RUNNER_LIBS) $(RUNNER_LINKFLAGS)
|
||||||
|
|
||||||
test/echo.o: test/echo.c test/echo.h
|
test/echo.o: test/echo.c test/echo.h
|
||||||
|
|||||||
@ -27,6 +27,10 @@ LINKFLAGS=-lm
|
|||||||
CPPFLAGS += -D_LARGEFILE_SOURCE
|
CPPFLAGS += -D_LARGEFILE_SOURCE
|
||||||
CPPFLAGS += -D_FILE_OFFSET_BITS=64
|
CPPFLAGS += -D_FILE_OFFSET_BITS=64
|
||||||
|
|
||||||
|
RUNNER_SRC=test/runner-unix.c
|
||||||
|
RUNNER_CFLAGS=$(CFLAGS) -Itest
|
||||||
|
RUNNER_LINKFLAGS=-L"$(PWD)" -luv -Xlinker -rpath -Xlinker "$(PWD)"
|
||||||
|
|
||||||
OBJS += src/unix/async.o
|
OBJS += src/unix/async.o
|
||||||
OBJS += src/unix/core.o
|
OBJS += src/unix/core.o
|
||||||
OBJS += src/unix/dl.o
|
OBJS += src/unix/dl.o
|
||||||
@ -55,6 +59,8 @@ ifeq (SunOS,$(uname_S))
|
|||||||
EV_CONFIG=config_sunos.h
|
EV_CONFIG=config_sunos.h
|
||||||
CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
|
CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
|
||||||
LINKFLAGS+=-lkstat -lnsl -lsendfile -lsocket
|
LINKFLAGS+=-lkstat -lnsl -lsendfile -lsocket
|
||||||
|
# Library dependencies are not transitive.
|
||||||
|
RUNNER_LINKFLAGS += $(LINKFLAGS)
|
||||||
OBJS += src/unix/sunos.o
|
OBJS += src/unix/sunos.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -68,7 +74,8 @@ endif
|
|||||||
ifeq (Darwin,$(uname_S))
|
ifeq (Darwin,$(uname_S))
|
||||||
EV_CONFIG=config_darwin.h
|
EV_CONFIG=config_darwin.h
|
||||||
CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
|
CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
|
||||||
LINKFLAGS+=-framework CoreServices
|
LINKFLAGS+=-framework CoreServices -dynamiclib -install_name "@rpath/libuv.dylib"
|
||||||
|
SOEXT = dylib
|
||||||
OBJS += src/unix/darwin.o
|
OBJS += src/unix/darwin.o
|
||||||
OBJS += src/unix/kqueue.o
|
OBJS += src/unix/kqueue.o
|
||||||
OBJS += src/unix/fsevents.o
|
OBJS += src/unix/fsevents.o
|
||||||
@ -78,6 +85,7 @@ ifeq (Linux,$(uname_S))
|
|||||||
EV_CONFIG=config_linux.h
|
EV_CONFIG=config_linux.h
|
||||||
CSTDFLAG += -D_GNU_SOURCE
|
CSTDFLAG += -D_GNU_SOURCE
|
||||||
LINKFLAGS+=-ldl -lrt
|
LINKFLAGS+=-ldl -lrt
|
||||||
|
RUNNER_CFLAGS += -D_GNU_SOURCE
|
||||||
OBJS += src/unix/linux/linux-core.o \
|
OBJS += src/unix/linux/linux-core.o \
|
||||||
src/unix/linux/inotify.o \
|
src/unix/linux/inotify.o \
|
||||||
src/unix/linux/syscalls.o
|
src/unix/linux/syscalls.o
|
||||||
@ -119,25 +127,18 @@ LINKFLAGS+=
|
|||||||
OBJS += src/unix/cygwin.o
|
OBJS += src/unix/cygwin.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Need _GNU_SOURCE for strdup?
|
|
||||||
RUNNER_CFLAGS=$(CFLAGS) -D_GNU_SOURCE -Itest
|
|
||||||
RUNNER_LINKFLAGS=$(LINKFLAGS) -Wl,-rpath="$(PWD)" -L"$(PWD)" -luv
|
|
||||||
|
|
||||||
ifeq (SunOS,$(uname_S))
|
ifeq (SunOS,$(uname_S))
|
||||||
RUNNER_LINKFLAGS += -pthreads
|
RUNNER_LINKFLAGS += -pthreads
|
||||||
else
|
else
|
||||||
RUNNER_LINKFLAGS += -pthread
|
RUNNER_LINKFLAGS += -pthread
|
||||||
endif
|
endif
|
||||||
|
|
||||||
RUNNER_LIBS=
|
|
||||||
RUNNER_SRC=test/runner-unix.c
|
|
||||||
|
|
||||||
libuv.a: $(OBJS)
|
libuv.a: $(OBJS)
|
||||||
$(AR) rcs $@ $^
|
$(AR) rcs $@ $^
|
||||||
|
|
||||||
libuv.so: CFLAGS += -fPIC
|
libuv.$(SOEXT): CFLAGS += -fPIC
|
||||||
libuv.so: $(OBJS)
|
libuv.$(SOEXT): $(OBJS)
|
||||||
$(CC) -shared -o $@ $^
|
$(CC) -shared -o $@ $^ $(LINKFLAGS)
|
||||||
|
|
||||||
src/%.o: src/%.c include/uv.h include/uv-private/uv-unix.h
|
src/%.o: src/%.c include/uv.h include/uv-private/uv-unix.h
|
||||||
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user