Index: /pjproject/trunk/README-RTEMS
===================================================================
--- /pjproject/trunk/README-RTEMS	(revision 477)
+++ /pjproject/trunk/README-RTEMS	(revision 477)
@@ -0,0 +1,87 @@
+
+
+
+              Build Instructions for PJLIB/PJMEDIA/PJSIP RTEMS Port
+
+
+
+The RTEMS port uses the POSIX abstraction layer at the moment, and has been 
+tested with RTEMS 4.6 on i386 target.
+
+
+Building RTEMS
+---------------
+I use RTEMS 4.6 on a cygwin host with i386/pc386 as target, but I think it 
+should work with different RTEMS versions/hosts/targets. 
+
+RTEMS was built with the following commands:
+
+  $ /opt/src/rtems-4.6.6/configure --enable-cxx --enable-posix --enable-networking --enable-rdbg --enable-tests --enable-rtemsbsp=pc386 --target=i386-rtems
+  $ make
+  $ make install
+
+
+Supported Targets
+-----------------
+At the moment, pjlib supports i386 and mpc860 CPU target. For other targets, 
+you would need to create/tweak the appropriate "m-xxx.mak" in "build" directory
+and the corresponding "m_xxx.h" header file in "pj/compat" directory.
+
+Please refer to pjlib porting guide about how to port PJLIB to new CPU target.
+
+
+Building PJLIB/PJMEDIA/PJSIP
+----------------------------
+Use the following steps to build the libraries:
+
+
+1. Set RTEMS_LIBRARY_PATH environment variable to point to your BSP directory 
+   (which is <RTEMS INSTALLATION POINT>/<BOARD SUPPORT PACKAGE>). 
+
+   For example (with sh):
+ 
+   $ export RTEMS_LIBRARY_PATH=/opt/rtems-4.6/i386-rtems/pc386
+
+
+2. Unfortunately pjproject's configure script is unable to create "build.mak" 
+   for cross compilation (but this may change in the future), so we need to 
+   create "build.mak" manually.
+
+   The file "README-configure" has some info about the variables in "build.mak".
+
+   For example, the "build.mak" for i386 target:
+
+   export MACHINE_NAME := i386
+   export OS_NAME := rtems
+   export HOST_NAME := mingw
+   export CC_NAME := gcc
+   export TARGET_NAME := i386-rtems
+   export CROSS_COMPILE := i386-rtems-
+
+
+3. Put additional CFLAGS or LDFLAGS that are specific to your target in 
+   "user.mak".
+
+   For example, my "user.mak" looks like this:
+
+   export CFLAGS += 
+   export LDFLAGS += -Wl,-Ttext,0x00100000 -Wl,--defsym -Wl,HeapSize=0x400000
+
+
+4. Build the libraries:
+
+   $ make dep && make distclean && make
+
+
+5. That should be it. The libraries should be in "lib" directory and 
+   applications in "bin" directory.
+
+
+
+Acknowledgements
+----------------
+Many thanks for Phil Torre <ptorre at zetron dot com>, who did most of the 
+initial porting and testing with pjlib etc. All credits go to him.
+
+
+
Index: project/trunk/RELNOTES.txt
===================================================================
--- /pjproject/trunk/RELNOTES.txt	(revision 476)
+++ 	(revision )
@@ -1,171 +1,0 @@
-RELEASE NOTES
-
-Version 0.3-pre4
-Nov 13th, 2005
-====================================
-
-PJLIB
- - Correct error reporting in the whole library. No more vague -1 errors!
- - New super portable socket abstraction.
- - Other headers were made super portable too.
- - Ioqueue supports multiple pending operations in a single socket!
- - No more floating point.
- - Ported to new platforms:
-    - i386/linux kernel (!)
-    - Sparc/Solaris
-    - Alpha/Linux
-
-PJSIP
-  - Correct error reporting in the whole library. No more -1 errors!
-  - Rewrote event, now much more readable.
-  - Per object tracing.
-
-
-Version 0.2.9 - 2005/06/19
-====================================
-Core:
-  - Moved authentication stuff to core.
-SIMPLE:
-  - Initial implementation of Event framework (SUBSCRIBE/NOTIFY)
-  - Initial implementation of Presence
-  - Tidying up here and there.
- 
-Version 0.2.8.5 - 2005/06/05
-====================================
-Core:
-  - Tidying up sip_msg.h (no need to export clone/shallow_clone/print API
-    for headers).
-  - Endpoint now can respond with 501/Not Supported if incoming request is
-    not handled by any modules.
-  - Endpoint also supports Allow header now.
-  - Changed transport names to capital letters (thanks ...)
-  - Fixed bug with locking in select() ioqueue.
-  - Add status phrase for >= 700 status codes.
-  
-pjsua:
-  - Verify URL in arguments to prevent crash.
-  - Can read commands from config file.
-  - Now has buddy list and can send IM!
-
-SIMPLE:
-  - Instant Messaging support!
- 
-MEDIA:
-  - CLOSING SEQUENCE IS NOT PROPER!!! SOMETIMES THREAD IS DEADLOCKED,
-    OR DSOUND IS NOT CLOSED PROPERLY!!!
-   
-Version 0.2.8 - 2005/05/28
-====================================
-- Simple STUN client support
-  SIP UDP port and media RTP/RTCP ports are now STUN aware. 
-- Major changed in I/O queue, now callback is used.
-  Callback is better because multiple libraries can register to single I/O queue.
-  It was not possible with previous implementation, because the function which does
-  polling needs to understand what to do when a key is signalled. The changes was
-  initially needed to support STUN, but then the STUN client implementation uses the
-  simpler select() (in stun_client.c).
-- Merge SDP library into PJMEDIA (no more PJSDP).
-  PJSDP only has couple of files (sdp.[hc]), not worth maintaining a library.
-- Fixed bug in select() I/O queue (not thread safe).
-
-
-Version 0.2.7 - 2005/05/14
-====================================
-PJLIB:
-- Major reorganization in pool, introducing pool factory and policy.
-  All libraries now can be completely agnostic about memory management 
-  choosen by application.
-- Fixed bug in GUID generation on mingw
-- Fixed bug in scanner if ASCII > 127 is fed into the input
-- More doxygen documentation
-
-PJMEDIA:
-- Renamed some functions/structs/etc.
-
-UA library:
-- Registration client completed (including authentication).
-- Fixed a crash condition when tsx has not received any response.
-
-PJSUA:
-- Use getopt.c
-
-
-Version 0.2.6 - 2005/04/17
-====================================
-All:
-- tidying up header files.
-
-Core library:
-- Removed PJSIP_HAS_DUMP macro (now automatically calculated based on log level)
-- Added pjsip_tx_data_invalidate_msg()
-
-UA library:
-- big modification in dialog API to better support injecting custom header
-  in outgoing message and to make it more flexible for future features (such
-  as caching the outgoing message):
-    - sending messages is now done in two steps: (1)create the msg transmit
-      buffer (pjsip_dlg_tx_data), (2)send the msg transmit buffer.
-    - dialog state won't change in step (1); it will change only
-      when the message is actually sent in step (2).
-      What won't change:
-	- the dialog state
-	- outgoing CSeq
-    - outgoing message transmit buffer (pjsip_dlg_tx_data) will be deleted 
-      when sent in step (2). Application MAY save request messages for 
-      future transmission, even after the request has been sent. To do so,
-      it must increment the reference counter and remember that each time
-      the request is sent, the reference counter will be decremented. Also
-      application CAN NOT re-send the message while the transaction that
-      sends the message has not terminated.
-- changed API names: pjsip_dlg_answer_invitation() --> pjsip_dlg_answer(), etc.
-- initial sip_reg.h for SIP registration.
-
-Auth library:
-- the digest authentication should work, however it has not been tested
-  with any SIP servers because we don't have REGISTER support yet.
-*Note*:
-  authentication in pjsua still uses hardcoded user/pass: hello/world.
-
-
-Version 0.2.5.2 - 2005/03/25
-====================================
-UA library:
-- Major modification in dialog callbacks, now high level callbacks such as
-  on_calling(), on_incoming(), on_provisional(), on_established(), and
-  on_disconnected() are provided instead of just one callback (on_event()).
-- Added pjsip_dlg_disconnect() which should handle all cases of disconnection
-  such as sending CANCEL, sending BYE, or sending final response to INVITE.
-- Added and updated doxygen comments.
-- Changed: pjsip_dialog_xxx --> pjsip_dlg_xxx
-
-New:
-- PJSIP Auth library, which supports digest scheme.
-- Only client functionality is present at the moment.
-
-PJSUA:
-- Remove callgen feature, as it makes the application complicated.
-  Will move it to different application, to make way for more sophisticated
-  call generator.
-- Support the new callback framework.
-- Support the new digest authentication (UAC only).
-
-SIP core:
-- Added PJSIP_EVENT_BEFORE_TX, triggered by transaction before sending
-  outgoing message (including retransmission). Application can use this event
-  (via dialog callback) to modify the message before transmission (such as
-  adding authorization headers).
-- Added general purpose function to print text body.
-- Move constant strings in parser to public/extern, just in case other
-  part of the library need to use them.
-
-PJMEDIA:
-- Protect against NULL in destroy session.
-
-Misc:
-- Rename build output directory x_Win32_x --> x_vc7_x or x_vc6_x, also
-  library naming includes _vc7_ or _vc6_ now.
-- Renamed pjsip_test_core --> pjsip_core_test.
-- Renamed pjaudio_tool --> pjmedia_audio_tool.
-- Renamed sdp_test --> pjsdp_test
-- PJLIB test: added second pool test after new/malloc test.
-- Renamed README.txt --> INSTALL.txt
Index: /pjproject/trunk/build/rules.mak
===================================================================
--- /pjproject/trunk/build/rules.mak	(revision 476)
+++ /pjproject/trunk/build/rules.mak	(revision 477)
@@ -155,5 +155,5 @@
 	   if test -f $$F; then \
 	     echo "$(OBJDIR)/" | tr -d '\n' >> $(DEP_FILE); \
-	     if $(CC_NAME) -M $(DEPFLAGS) $$F | sed '/^#/d' >> $(DEP_FILE); then \
+	     if $(CC) -M $(DEPFLAGS) $$F | sed '/^#/d' >> $(DEP_FILE); then \
 		true; \
 	     else \
Index: /pjproject/trunk/pjlib-util/build/Makefile
===================================================================
--- /pjproject/trunk/pjlib-util/build/Makefile	(revision 476)
+++ /pjproject/trunk/pjlib-util/build/Makefile	(revision 477)
@@ -70,10 +70,18 @@
 	$(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $@
 
-clean depend realclean:
+clean:
 	$(MAKE) -f $(RULES_MAK) APP=PJLIB_UTIL app=pjlib-util $@
 	$(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $@
-	@if test "$@" = "depend"; then \
-	  echo '$(TEST_EXE): $(PJLIB_UTIL_LIB)' >> .pjlib-util-test-$(TARGET_NAME).depend; \
-	fi
+
+realclean:
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjlib-util-$(TARGET_NAME).depend),$(HOST_RMR))
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjlib-util-test-$(TARGET_NAME).depend),$(HOST_RMR))
+	$(MAKE) -f $(RULES_MAK) APP=PJLIB_UTIL app=pjlib-util $@
+	$(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $@
+
+depend:
+	$(MAKE) -f $(RULES_MAK) APP=PJLIB_UTIL app=pjlib-util $@
+	$(MAKE) -f $(RULES_MAK) APP=UTIL_TEST app=pjlib-util-test $@
+	echo '$(TEST_EXE): $(PJLIB_UTIL_LIB)' >> .pjlib-util-test-$(TARGET_NAME).depend; \
 
 
Index: /pjproject/trunk/pjlib/build/Makefile
===================================================================
--- /pjproject/trunk/pjlib/build/Makefile	(revision 476)
+++ /pjproject/trunk/pjlib/build/Makefile	(revision 477)
@@ -95,4 +95,6 @@
 
 realclean:
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjlib-$(TARGET_NAME).depend),$(HOST_RMR))
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjlib-test-$(TARGET_NAME).depend),$(HOST_RMR))
 	$(MAKE) -f $(RULES_MAK) APP=PJLIB app=pjlib realclean
 	$(MAKE) -f $(RULES_MAK) APP=TEST app=pjlib-test realclean
Index: /pjproject/trunk/pjmedia/build/Makefile
===================================================================
--- /pjproject/trunk/pjmedia/build/Makefile	(revision 476)
+++ /pjproject/trunk/pjmedia/build/Makefile	(revision 477)
@@ -164,14 +164,25 @@
 	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $@
 
-clean depend realclean:
+clean:
 	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia $@
 	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA_CODEC app=pjmedia-codec $@
 	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $@
+
+realclean:
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjmedia-$(TARGET_NAME).depend),$(HOST_RMR))
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjmedia-codec-$(TARGET_NAME).depend),$(HOST_RMR))
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjmedia-test-$(TARGET_NAME).depend),$(HOST_RMR))
+	
+	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia $@
 	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA_CODEC app=pjmedia-codec $@
-	@if test "$@" = "depend"; then \
-	  echo '$(PJMEDIA_LIB): .pjmedia-$(TARGET_NAME).depend' >> .pjmedia-$(TARGET_NAME).depend; \
-	  echo '$(PJMEDIA_CODEC_LIB): .pjmedia-codec-$(TARGET_NAME).depend' >> .pjmedia-codec-$(TARGET_NAME).depend; \
-	  echo '$(PJMEDIA_TEST_EXE): $(PJMEDIA_LIB) $(PJMEDIA_CODEC_LIB)' >> .pjmedia-test-$(TARGET_NAME).depend; \
-	fi
+	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $@
+
+depend:
+	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA app=pjmedia $@
+	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA_CODEC app=pjmedia-codec $@
+	$(MAKE) -f $(RULES_MAK) APP=PJMEDIA_TEST app=pjmedia-test $@
+	echo '$(PJMEDIA_LIB): .pjmedia-$(TARGET_NAME).depend' >> .pjmedia-$(TARGET_NAME).depend; \
+	echo '$(PJMEDIA_CODEC_LIB): .pjmedia-codec-$(TARGET_NAME).depend' >> .pjmedia-codec-$(TARGET_NAME).depend; \
+	echo '$(PJMEDIA_TEST_EXE): $(PJMEDIA_LIB) $(PJMEDIA_CODEC_LIB)' >> .pjmedia-test-$(TARGET_NAME).depend; \
 
 
Index: /pjproject/trunk/pjsip/build/Makefile
===================================================================
--- /pjproject/trunk/pjsip/build/Makefile	(revision 476)
+++ /pjproject/trunk/pjsip/build/Makefile	(revision 477)
@@ -134,4 +134,14 @@
 	$(MAKE) -f $(RULES_MAK) APP=PJSUA_LIB app=pjsua-lib $@
 
+realclean:
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjsip-$(TARGET_NAME).depend),$(HOST_RMR))
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjsip-ua-$(TARGET_NAME).depend),$(HOST_RMR))
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjsip-simple-$(TARGET_NAME).depend),$(HOST_RMR))
+	$(subst @@,$(subst /,$(HOST_PSEP),.pjsua-lib-$(TARGET_NAME).depend),$(HOST_RMR))
+	$(MAKE) -f $(RULES_MAK) APP=PJSIP app=pjsip $@
+	$(MAKE) -f $(RULES_MAK) APP=PJSIP_UA app=pjsip-ua $@
+	$(MAKE) -f $(RULES_MAK) APP=PJSIP_SIMPLE app=pjsip-simple $@
+	$(MAKE) -f $(RULES_MAK) APP=PJSUA_LIB app=pjsua-lib $@
 
 
+
