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

Fixes #659.
This commit is contained in:
Vlad Tudose 2012-12-18 20:13:10 +02:00 committed by Ben Noordhuis
parent 6fb31493d7
commit 4b115f89bf
2 changed files with 15 additions and 8 deletions

View File

@ -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 File

@ -123,6 +123,13 @@ else
RUNNER_LDFLAGS += -pthread
endif
OBJDIR := out
ifeq ($(MAKECMDGOALS), test)
OBJDIR := $(OBJDIR)/test
endif
OBJS := $(addprefix $(OBJDIR)/,$(OBJS))
libuv.a: $(OBJS)
$(AR) rcs $@ $^
@ -130,18 +137,18 @@ 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