Index: pjproject/trunk/pjlib-util/build/Makefile
===================================================================
--- pjproject/trunk/pjlib-util/build/Makefile	(revision 4630)
+++ pjproject/trunk/pjlib-util/build/Makefile	(revision 4632)
@@ -71,10 +71,14 @@
 distclean: realclean
 
-.PHONY: dep depend pjlib pjlib-test clean realclean distclean
+.PHONY: dep depend clean realclean distclean
+.PHONY: $(TARGETS)
+.PHONY: $(PJLIB_UTIL_LIB) $(UTIL_TEST_EXE)
 
-pjlib-util:
+pjlib-util: $(PJLIB_UTIL_LIB)
+$(PJLIB_UTIL_LIB):
 	$(MAKE) -f $(RULES_MAK) APP=PJLIB_UTIL app=pjlib-util $(PJLIB_UTIL_LIB)
 
-pjlib-util-test: pjlib-util
+pjlib-util-test: $(UTIL_TEST_EXE)
+$(UTIL_TEST_EXE): $(PJLIB_UTIL_LIB)
 	$(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $(UTIL_TEST_EXE)
 
Index: pjproject/trunk/pjlib/build/Makefile
===================================================================
--- pjproject/trunk/pjlib/build/Makefile	(revision 4630)
+++ pjproject/trunk/pjlib/build/Makefile	(revision 4632)
@@ -78,15 +78,19 @@
 
 
-.PHONY: dep depend pjlib pjlib-test clean realclean distclean
+.PHONY: dep depend clean realclean distclean
+.PHONY: $(TARGETS)
+.PHONY: $(PJLIB_LIB) $(TEST_EXE)
 
 dep: depend
 
-pjlib: ../include/pj/config_site.h
+pjlib: $(PJLIB_LIB)
+$(PJLIB_LIB): ../include/pj/config_site.h
 	$(MAKE) -f $(RULES_MAK) APP=PJLIB app=pjlib $(PJLIB_LIB)
 
 ../include/pj/config_site.h:
 	touch ../include/pj/config_site.h
-	
-pjlib-test: pjlib
+
+pjlib-test: $(TEST_EXE)
+$(TEST_EXE): $(PJLIB_LIB)
 	$(MAKE) -f $(RULES_MAK) APP=TEST app=pjlib-test $(TEST_EXE)
 
Index: pjproject/trunk/pjmedia/build/Makefile
===================================================================
--- pjproject/trunk/pjmedia/build/Makefile	(revision 4630)
+++ pjproject/trunk/pjmedia/build/Makefile	(revision 4632)
@@ -158,24 +158,30 @@
 distclean: realclean
 
-.PHONY: dep depend pjmedia pjmedia-codec pjmedia-videodev pjmedia-audiodev pjmedia-test clean realclean distclean
-
-pjmedia:
+.PHONY: dep depend clean realclean distclean
+.PHONY: $(TARGETS)
+.PHONY: $(PJMEDIA_LIB) $(PJMEDIA_CODEC_LIB) $(PJMEDIA_VIDEODEV_LIB) $(PJMEDIA_AUDIODEV_LIB) $(PJSDP_LIB) $(PJMEDIA_TEST_EXE)
+
+pjmedia: $(PJMEDIA_LIB)
+$(PJMEDIA_LIB):
 	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia $(PJMEDIA_LIB)
 
-pjmedia-codec:
+pjmedia-codec: $(PJMEDIA_CODEC_LIB)
+$(PJMEDIA_CODEC_LIB):
 	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA_CODEC app=pjmedia-codec $(PJMEDIA_CODEC_LIB)
 
-pjmedia-videodev:
+pjmedia-videodev: $(PJMEDIA_VIDEODEV_LIB)
+$(PJMEDIA_VIDEODEV_LIB):
 	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA_VIDEODEV app=pjmedia-videodev $(PJMEDIA_VIDEODEV_LIB)
 
-pjmedia-audiodev:
+pjmedia-audiodev: $(PJMEDIA_AUDIODEV_LIB)
+$(PJMEDIA_AUDIODEV_LIB):
 	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA_AUDIODEV app=pjmedia-audiodev $(PJMEDIA_AUDIODEV_LIB)
 
-pjsdp:
+pjsdp: $(PJSDP_LIB)
+$(PJSDP_LIB):
 	$(MAKE) -f $(RULES_MAK) APP=PJSDP app=pjsdp $(PJSDP_LIB)
 
-$(PJMEDIA_LIB): pjmedia
-
-pjmedia-test: $(PJMEDIA_LIB) pjmedia
+pjmedia-test: $(PJMEDIA_TEST_EXE)
+$(PJMEDIA_TEST_EXE): $(PJMEDIA_LIB) $(PJMEDIA_CODEC_LIB)
 	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $(PJMEDIA_TEST_EXE)
 
Index: pjproject/trunk/pjnath/build/Makefile
===================================================================
--- pjproject/trunk/pjnath/build/Makefile	(revision 4630)
+++ pjproject/trunk/pjnath/build/Makefile	(revision 4632)
@@ -93,18 +93,22 @@
 distclean: realclean
 
-.PHONY: dep depend pjlib pjlib-test clean realclean distclean
+.PHONY: dep depend clean realclean distclean
+.PHONY: $(TARGETS)
+.PHONY: $(PJNATH_LIB) $(PJNATH_TEST_EXE) $(PJTURN_CLIENT_EXE) $(PJTURN_SRV_EXE)
 
-pjnath:
+pjnath: $(PJNATH_LIB)
+$(PJNATH_LIB):
 	$(MAKE) -f $(RULES_MAK) APP=PJNATH app=pjnath $(PJNATH_LIB)
 
-$$(PJNATH_LIB): pjnath
-
-pjnath-test: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB)
+pjnath-test: $(PJNATH_TEST_EXE)
+$(PJNATH_TEST_EXE): $(PJNATH_LIB)
 	$(MAKE) -f $(RULES_MAK) APP=PJNATH_TEST app=pjnath-test $(PJNATH_TEST_EXE)
 
-pjturn-client: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB)
+pjturn-client: $(PJTURN_CLIENT_EXE)
+$(PJTURN_CLIENT_EXE): $(PJNATH_LIB)
 	$(MAKE) -f $(RULES_MAK) APP=PJTURN_CLIENT app=pjturn-client $(PJTURN_CLIENT_EXE)
 
-pjturn-srv: $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJNATH_LIB)
+pjturn-srv: $(PJTURN_SRV_EXE)
+$(PJTURN_SRV_EXE): $(PJNATH_LIB)
 	$(MAKE) -f $(RULES_MAK) APP=PJTURN_SRV app=pjturn-srv $(PJTURN_SRV_EXE)
 
Index: pjproject/trunk/pjsip-apps/build/Makefile
===================================================================
--- pjproject/trunk/pjsip-apps/build/Makefile	(revision 4630)
+++ pjproject/trunk/pjsip-apps/build/Makefile	(revision 4632)
@@ -59,6 +59,4 @@
 TARGETS := pjsua pjsystest samples
 
-.PHONY: $(TARGETS)
-
 all: $(TARGETS)
 
@@ -68,10 +66,14 @@
 distclean: realclean
 
-.PHONY: dep depend pjsua clean realclean distclean
+.PHONY: dep depend clean realclean distclean
+.PHONY: $(TARGETS)
+.PHONY: $(PJSUA_EXE) $(PJSYSTEST_EXE)
 
-pjsua:
+pjsua: $(PJSUA_EXE)
+$(PJSUA_EXE):
 	$(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $(PJSUA_EXE)
 
-pjsystest:
+pjsystest: $(PJSYSTEST_EXE)
+$(PJSYSTEST_EXE):
 	$(MAKE) -f $(RULES_MAK) APP=PJSYSTEST app=pjsystest $(PJSYSTEST_EXE)
 
Index: pjproject/trunk/pjsip/build/Makefile
===================================================================
--- pjproject/trunk/pjsip/build/Makefile	(revision 4630)
+++ pjproject/trunk/pjsip/build/Makefile	(revision 4632)
@@ -107,6 +107,4 @@
 TARGETS := pjsip pjsip-ua pjsip-simple pjsua-lib pjsip-test
 
-.PHONY: $(TARGETS)
-
 all: $(TARGETS)
 
@@ -125,19 +123,26 @@
 distclean: realclean
 
-.PHONY: dep depend pjsip pjsip-ua pjsua-lib clean realclean distclean
+.PHONY: dep depend clean realclean distclean
+.PHONY: $(TARGETS)
+.PHONY: $(PJSIP_LIB) $(PJSIP_UA_LIB) $(PJSIP_SIMPLE_LIB) $(PJSUA_LIB_LIB) $(TEST_EXE)
 
-pjsip:
+pjsip: $(PJSIP_LIB)
+$(PJSIP_LIB):
 	$(MAKE) -f $(RULES_MAK) APP=PJSIP app=pjsip $(PJSIP_LIB)
 
-pjsip-ua:
+pjsip-ua: $(PJSIP_UA_LIB)
+$(PJSIP_UA_LIB):
 	$(MAKE) -f $(RULES_MAK) APP=PJSIP_UA app=pjsip-ua $(PJSIP_UA_LIB)
 
-pjsip-simple:
+pjsip-simple: $(PJSIP_SIMPLE_LIB)
+$(PJSIP_SIMPLE_LIB):
 	$(MAKE) -f $(RULES_MAK) APP=PJSIP_SIMPLE app=pjsip-simple $(PJSIP_SIMPLE_LIB)
 
-pjsua-lib: 
+pjsua-lib: $(PJSUA_LIB_LIB)
+$(PJSUA_LIB_LIB): 
 	$(MAKE) -f $(RULES_MAK) APP=PJSUA_LIB app=pjsua-lib $(PJSUA_LIB_LIB)
 
-pjsip-test: pjsip
+pjsip-test: $(TEST_EXE)
+$(TEST_EXE): $(PJSUA_LIB_LIB) $(PJSIP_SIMPLE_LIB) $(PJSIP_UA_LIB) $(PJSIP_LIB)
 	$(MAKE) -f $(RULES_MAK) APP=TEST app=pjsip-test $(TEST_EXE)
 
