diff --git a/Makefile b/Makefile
index 72c8bef..26cb6df 100644
--- a/Makefile
+++ b/Makefile
@@ -235,6 +235,11 @@ TARGETS_A = $(filter %.a,$(TARGETS))
all: config.mk $(filter-out $(WV_EXCLUDES), $(TARGETS))
TESTS += wvtestmain
+TESTS_DEPS = $(LIBWVSTREAMS)
+ifneq ("$(with_dbus)", "no")
+ TESTS_DEPS += libwvdbus.so
+endif
+$(TESTS): $(TESTS_DEPS)
REAL_TESTS = $(filter-out $(TEST_SKIP_OBJS), $(TESTS))
$(addsuffix .o,$(REAL_TESTS)):
diff --git a/wvrules.mk b/wvrules.mk
index 877f700..921c41b 100644
--- a/wvrules.mk
+++ b/wvrules.mk
@@ -158,18 +158,18 @@ endif
../%.o:; @echo "Object $@ does not exist!"; exit 1
/%.a:; @echo "Library $@ does not exist!"; exit 1
-%.o: %.c; $(call wvcc ,$@,$<,$*)
-%.fpic.o: %.c; $(call wvcc ,$@,$<,$*,-fPIC)
-%.o: %.cc; $(call wvcxx,$@,$<,$*)
-%.fpic.o: %.cc; $(call wvcxx,$@,$<,$*,-fPIC)
-%.o: %.cpp; $(call wvcxx,$@,$<,$*)
-%.fpic.o:%.cpp; $(call wvcxx,$@,$<,$*,-fPIC)
-%.s: %.c; $(call wvcc ,$@,$<,$*,,-S)
-%.s: %.cc; $(call wvcxx,$@,$<,$*,,-S)
-%.s: %.cpp; $(call wvcxx,$@,$<,$*,,-S)
-%.E: %.c; $(call wvcc,$@,$<,$*,,-E)
-%.E: %.cc; $(call wvcxx,$@,$<,$*,,-E)
-%.E: %.cpp; $(call wvcxx,$@,$<,$*,,-E)
+%.o: CC %.c; $(call wvcc ,$@,$<,$*)
+%.fpic.o: CC %.c; $(call wvcc ,$@,$<,$*,-fPIC)
+%.o: CXX %.cc; $(call wvcxx,$@,$<,$*)
+%.fpic.o: CXX %.cc; $(call wvcxx,$@,$<,$*,-fPIC)
+%.o: CXX %.cpp; $(call wvcxx,$@,$<,$*)
+%.fpic.o: CXX %.cpp; $(call wvcxx,$@,$<,$*,-fPIC)
+%.s: CC %.c; $(call wvcc ,$@,$<,$*,,-S)
+%.s: CXX %.cc; $(call wvcxx,$@,$<,$*,,-S)
+%.s: CXX %.cpp; $(call wvcxx,$@,$<,$*,,-S)
+%.E: CC %.c; $(call wvcc,$@,$<,$*,,-E)
+%.E: CXX %.cc; $(call wvcxx,$@,$<,$*,,-E)
+%.E: CXX %.cpp; $(call wvcxx,$@,$<,$*,,-E)
%.moc: %.h; $(MOC) -o $@ $<