Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

build: fix `make test` on darwin and sunos

  • Loading branch information...
commit 62332ea09049b6db94c019856714dcaf10434aee 1 parent f352e40
@bnoordhuis bnoordhuis authored
Showing with 25 additions and 16 deletions.
  1. +5 −3 .gitignore
  2. +8 −2 Makefile
  3. +12 −11 config-unix.mk
View
8 .gitignore
@@ -1,14 +1,16 @@
*.swp
*.[oa]
-*.so
-*.lo
-*.la
+*.l[oa]
*.opensdf
*.orig
*.sdf
*.suo
core
vgcore.*
+
+/libuv.so
+/libuv.dylib
+
/out/
/build/gyp
View
10 Makefile
@@ -26,6 +26,12 @@ endif
CPPFLAGS += -Iinclude -Iinclude/uv-private
+ifeq (Darwin,$(uname_S))
+SOEXT = dylib
+else
+SOEXT = so
+endif
+
ifneq (,$(findstring MINGW,$(uname_S)))
include config-mingw.mk
else
@@ -37,10 +43,10 @@ BENCHMARKS=test/blackhole-server.c test/echo-server.c test/dns-server.c test/ben
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)
-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)
test/echo.o: test/echo.c test/echo.h
View
23 config-unix.mk
@@ -27,6 +27,10 @@ LINKFLAGS=-lm
CPPFLAGS += -D_LARGEFILE_SOURCE
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/core.o
OBJS += src/unix/dl.o
@@ -55,6 +59,8 @@ ifeq (SunOS,$(uname_S))
EV_CONFIG=config_sunos.h
CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
LINKFLAGS+=-lkstat -lnsl -lsendfile -lsocket
+# Library dependencies are not transitive.
+RUNNER_LINKFLAGS += $(LINKFLAGS)
OBJS += src/unix/sunos.o
endif
@@ -68,7 +74,8 @@ endif
ifeq (Darwin,$(uname_S))
EV_CONFIG=config_darwin.h
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/kqueue.o
OBJS += src/unix/fsevents.o
@@ -78,6 +85,7 @@ ifeq (Linux,$(uname_S))
EV_CONFIG=config_linux.h
CSTDFLAG += -D_GNU_SOURCE
LINKFLAGS+=-ldl -lrt
+RUNNER_CFLAGS += -D_GNU_SOURCE
OBJS += src/unix/linux/linux-core.o \
src/unix/linux/inotify.o \
src/unix/linux/syscalls.o
@@ -119,25 +127,18 @@ LINKFLAGS+=
OBJS += src/unix/cygwin.o
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))
RUNNER_LINKFLAGS += -pthreads
else
RUNNER_LINKFLAGS += -pthread
endif
-RUNNER_LIBS=
-RUNNER_SRC=test/runner-unix.c
-
libuv.a: $(OBJS)
$(AR) rcs $@ $^
-libuv.so: CFLAGS += -fPIC
-libuv.so: $(OBJS)
- $(CC) -shared -o $@ $^
+libuv.$(SOEXT): CFLAGS += -fPIC
+libuv.$(SOEXT): $(OBJS)
+ $(CC) -shared -o $@ $^ $(LINKFLAGS)
src/%.o: src/%.c include/uv.h include/uv-private/uv-unix.h
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@

0 comments on commit 62332ea

Please sign in to comment.
Something went wrong with that request. Please try again.