build: make make test link against .a again

Commit 3eb6eb3 links the .so with -Wl,-soname which breaks the
`make test` target: run-tests is linked against (for example)
libuv.so.0.11 while the actual file name is libuv.so.

That's relatively easy to fix by getting creative with rpaths but it's
even easier to fix by simply linking statically.

It also means I no longer have to remember to set LD_BIND_NOW when
profiling the benchmarks.
This commit is contained in:
Ben Noordhuis 2013-05-12 16:42:30 +02:00
parent 3eb6eb35cc
commit a11d16d8f5
2 changed files with 6 additions and 6 deletions

View File

@ -144,10 +144,10 @@ TESTS= \
all: libuv.a
run-tests$(E): test/run-tests.o test/runner.o $(RUNNER_SRC) $(TESTS) libuv.$(SOEXT)
run-tests$(E): test/run-tests.o test/runner.o $(RUNNER_SRC) $(TESTS) libuv.a
$(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) -o $@ $^ $(RUNNER_LIBS) $(RUNNER_LDFLAGS)
run-benchmarks$(E): test/run-benchmarks.o test/runner.o $(RUNNER_SRC) $(BENCHMARKS) libuv.$(SOEXT)
run-benchmarks$(E): test/run-benchmarks.o test/runner.o $(RUNNER_SRC) $(BENCHMARKS) libuv.a
$(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) -o $@ $^ $(RUNNER_LIBS) $(RUNNER_LDFLAGS)
test/echo.o: test/echo.c test/echo.h

View File

@ -29,7 +29,7 @@ CPPFLAGS += -D_FILE_OFFSET_BITS=64
RUNNER_SRC=test/runner-unix.c
RUNNER_CFLAGS=$(CFLAGS) -I$(SRCDIR)/test
RUNNER_LDFLAGS=-L"$(CURDIR)" -luv -Xlinker -rpath -Xlinker "$(CURDIR)"
RUNNER_LDFLAGS=-L"$(CURDIR)" -luv
HAVE_DTRACE=
DTRACE_OBJS=
@ -64,7 +64,6 @@ HAVE_DTRACE=1
CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
LDFLAGS+=-lkstat -lnsl -lsendfile -lsocket
# Library dependencies are not transitive.
RUNNER_LDFLAGS += $(LDFLAGS)
OBJS += src/unix/sunos.o
OBJS += src/unix/dtrace.o
DTRACE_OBJS += src/unix/core.o
@ -87,8 +86,7 @@ endif
CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
LDFLAGS += -framework Foundation \
-framework CoreServices \
-framework ApplicationServices \
-dynamiclib -install_name "@rpath/libuv.dylib"
-framework ApplicationServices
SOEXT = dylib
OBJS += src/unix/darwin.o
OBJS += src/unix/kqueue.o
@ -156,6 +154,8 @@ ifneq (darwin,$(PLATFORM))
LDFLAGS += -Wl,-soname,libuv.so.0.10
endif
RUNNER_LDFLAGS += $(LDFLAGS)
libuv.a: $(OBJS)
$(AR) rcs $@ $^