Permalink
Browse files

build: build libuv.a and libuv.so in different dirs

Fixes #659.
  • Loading branch information...
1 parent 6fb3149 commit 4b115f89bf54275ea695df2b872f34567b993ff3 Vlad Tudose committed with Dec 18, 2012
Showing with 15 additions and 8 deletions.
  1. +2 −2 Makefile
  2. +13 −6 config-unix.mk
View
@@ -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)
View
@@ -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.