Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
build: build libuv.a and libuv.so in different dirs
Browse files Browse the repository at this point in the history
Fixes #659.
  • Loading branch information
Vlad Tudose authored and bnoordhuis committed Dec 19, 2012
1 parent 6fb3149 commit 4b115f8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ bench: test/run-benchmarks$(E)
$<

clean: clean-platform
$(RM) -f src/*.o *.a test/run-tests$(E) test/run-benchmarks$(E)
$(RM) -f *.a *.so test/run-tests$(E) test/run-benchmarks$(E)

distclean: distclean-platform
$(RM) -f src/*.o *.a test/run-tests$(E) test/run-benchmarks$(E)
$(RM) -f *.a *.so test/run-tests$(E) test/run-benchmarks$(E)
19 changes: 13 additions & 6 deletions config-unix.mk
Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,32 @@ else
RUNNER_LDFLAGS += -pthread
endif

OBJDIR := out
ifeq ($(MAKECMDGOALS), test)
OBJDIR := $(OBJDIR)/test
endif

OBJS := $(addprefix $(OBJDIR)/,$(OBJS))

libuv.a: $(OBJS)
$(AR) rcs $@ $^

libuv.$(SOEXT): override CFLAGS += -fPIC
libuv.$(SOEXT): $(OBJS)
$(CC) -shared -o $@ $^ $(LDFLAGS)

src/%.o: src/%.c include/uv.h include/uv-private/uv-unix.h
$(OBJDIR)/src/unix/%.o: src/unix/%.c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h
@mkdir -p $(dir $@)
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@

src/unix/%.o: src/unix/%.c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h
$(OBJDIR)/src/%.o: src/%.c include/uv.h include/uv-private/uv-unix.h
@mkdir -p $(dir $@)
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@

clean-platform:
-rm -f src/unix/*.o
-rm -f src/unix/linux/*.o
-rm -rf $(OBJDIR)
-rm -rf test/run-tests.dSYM run-benchmarks.dSYM

distclean-platform:
-rm -f src/unix/*.o
-rm -f src/unix/linux/*.o
-rm -rf $(OBJDIR)
-rm -rf test/run-tests.dSYM run-benchmarks.dSYM

0 comments on commit 4b115f8

Please sign in to comment.