Module: sip-router
Branch: master
Commit: 5a9014ee4977c6afbc4b0cf65a9fad6237c2e2a6
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5a9014e…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Mar 10 09:25:13 2010 +0100
make: on-the-fly dependency generation
- support on-the-fly dependency file generation with gcc >=3.0
(the dependency files are generated while compiling the object
file, eliminating another gcc+sed invocation)
- support for using makedepend -f- for generating dependencies
E.g.: make cfg MKDEP="makedepend -f-". In general gcc should be
preferred if available (use this if you don't have gcc and your
compiler doesn't generate good deps).
---
Makefile.defs | 12 ++++++++++--
Makefile.rules | 22 +++++++++++++++++++---
2 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/Makefile.defs b/Makefile.defs
index d334f24..a775bd9 100644
--- a/Makefile.defs
+++ b/Makefile.defs
@@ -74,6 +74,9 @@
# from the host (andrei)
# 2009-10-01 use -fsigned-char for gcc on ppc, ppc64, arm and arm6
# (on those archs char is unsigned by default) (andrei)
+# 2010-03-10 added CC_MKDEP_OPTS, which contains to the list of options
+# needed to generate dependencies on-the-fly while compiling
+# or is empty if the compiler doesn't support it (andrei)
quiet?=$(if $(filter 1 yes on,$(Q)),silent,verbose)
@@ -351,7 +354,7 @@ ifneq (,$(findstring gcc, $(CC_LONGVER)))
# -e 's/^[^0-9].*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/')
# sed with POSIX.1 regex doesn't support |, + or ?
# (darwin, solaris ...) => this complicated expression
- MKDEP=$(CC) -MM
+ MKDEP=$(CC) -MM -MG
#transform gcc version into 2.9x or 3.0
CC_SHORTVER:=$(shell echo "$(CC_VER)" | cut -d" " -f 2| \
sed -e 's/[^0-9]*-\(.*\)/\1/'| \
@@ -360,7 +363,11 @@ ifneq (,$(findstring gcc, $(CC_LONGVER)))
's/3\.[4-9]/3.4/' -e 's/4\.[0-1]\..*/4.x/' -e \
's/4\.[0-1]/4.x/' -e 's/4\.[2-9]\..*/4.2+/' -e \
's/4\.[2-9]$$/4.2+/')
-endif
+ifeq (,$(strip $(filter-out 3.0 3.4 4.x 4.2+,$(CC_SHORTVER))))
+ # dependencies can be generated on-the-fly while compiling *.c
+ CC_MKDEP_OPTS=-MMD -MP
+endif # 3.0 <= $(CC_SHORTVER) <= 4.x
+endif # gcc
ifneq (, $(findstring Sun, $(CC_LONGVER)))
CC_NAME=suncc
@@ -1947,6 +1954,7 @@ export exported_vars
saved_fixed_vars:= MAIN_NAME CFG_NAME SCR_NAME FLAVOUR INSTALL_FLAVOUR \
SRC_NAME RELEASE OS ARCH \
C_DEFS DEFS_RM PROFILE CC LD MKDEP MKTAGS LDFLAGS C_INCLUDES \
+ CC_MKDEP_OPTS \
MOD_LDFLAGS LIB_LDFLAGS UTILS_LDFLAGS LIB_SONAME LD_RPATH \
LIB_SUFFIX LIB_PREFIX \
LIBS \
diff --git a/Makefile.rules b/Makefile.rules
index 9fbf02b..f816f8b 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -25,6 +25,11 @@
# used only for "temporary" defines/includes inside modules or
# libs, C_DEFS and C_INCLUDES are used for the common stuff)
# (andrei)
+# 2010-03-09 generate dependencies when compiling .o instead of on
+# include .d and fix build errors when a .h is moved
+# support for using MKDEP="makedepend-f-" (andrei)
+# 2010-03-10 support for on the-fly dependency generation (while compiling,
+# see CC_MKDEP_OPTS) (andrei)
# check if the saved cfg corresponds with the current one
@@ -59,6 +64,19 @@ cmd_CC=$(CC) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) -c $< -o $@
cmd_LD=$(LD) $(LDFLAGS) $(objs) $(extra_objs) $(ALL_LIBS) $(SER_RPATH) \
-o $(NAME)
+ifeq (,$(CC_MKDEP_OPTS))
+# if CCC_MKDEP_OPTS is empty => CC cannot generate dependencies on the fly
+cmd_MKDEP=$(MKDEP) $(filter -D% -I%,$(CFLAGS)) $(C_INCLUDES) $(INCLUDES) \
+ $(C_DEFS) $(DEFS) $< \
+ | sed -e 's/\#.*//' -e '/:[ ]*$$/d' -e '/^[ ]*$$/d' \
+ -e 's|.*:|$@: $$(wildcard |' -e 's/\([^\\]\)$$/\1)/'> $*.d
+else
+# deps can be generated on the fly by cmd_CC
+cmd_CC+=$(CC_MKDEP_OPTS)
+# no MKDEP command any more
+cmd_MKDEP=
+endif # CC_MKDEP_OPTS
+
# what will be displayed if quiet==silent
silent_cmd_CC=CC ($(CC)) [$(strip $(crt_type) $(NAME))] $@
silent_cmd_LD=LD ($(LD)) [$(strip $(crt_type) $(NAME))] $@
@@ -94,9 +112,7 @@ exec_cmd= $(if $($(quiet)_cmd_$(1)),\
#implicit rules
%.o:%.c $(ALLDEP)
$(call exec_cmd,CC)
- @$(MKDEP) $(CFLAGS) $(C_INCLUDES) $(INCLUDES) $(C_DEFS) $(DEFS) $< \
- | sed -e 's/#.*//' -e '/:[ ]*$$/d' -e '/^[ ]*$$/d' \
- -e 's#.*:#$@: $$(wildcard #g' -e 's/\([^\\]\)$$/\1)/'> $*.d
+ @$(call cmd_MKDEP)
# use RPATH and SER_LIBS if needed (make install and the module depends
# on some ser libs)
i made a test where user agent registered over tcp. then i killed
it and made a call to it from another ua. here is what i got to
syslog:
Mar 9 07:48:49 localhost /usr/sbin/sip-proxy[26634]: INFO: Setting set_forward_no_connect()
Mar 9 07:48:49 localhost /usr/sbin/sip-proxy[26634]: ERROR: tm [../../forward.h:169]: msg_send: ERROR: tcp_send failed
Mar 9 07:48:49 localhost /usr/sbin/sip-proxy[26634]: ERROR: tm [t_fwd.c:1235]: ERROR: t_send_branch: sending request on branch 0 failed
wireshark didn't show any tcp connection attempts so looks like
set_forward_no_connect() works as expected.
i verified this by uncommenting set_forward_no_connect() and got to
syslog:
Mar 9 07:56:18 localhost /usr/sbin/sip-proxy[26944]: INFO: Skipping set_forward_no_connect()
Mar 9 07:56:18 localhost /usr/sbin/sip-proxy[26944]: ERROR: <core> [tcp_main.c:1914]: connect 192.98.102.10:47690 failed (RST) Connection refused
Mar 9 07:56:18 localhost /usr/sbin/sip-proxy[26944]: ERROR: <core> [tcp_main.c:1925]: ERROR: tcp_send 192.98.102.10:47690: connect & send for 0xb560f1c8 failed: Connection refused (111)
Mar 9 07:56:18 localhost /usr/sbin/sip-proxy[26944]: ERROR: tm [../../forward.h:169]: msg_send: ERROR: tcp_send failed
Mar 9 07:56:18 localhost /usr/sbin/sip-proxy[26944]: ERROR: tm [t_fwd.c:1235]: ERROR: t_send_branch: sending request on branch 0 failed
then also wireshark showed tcp syn request.
so otherwise fine, i would like to get rid of the error messages at
least in the first case, since there is really no error happening here.
-- juha
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task is now closed:
FS#39 - display name without quotes and uac_replace_from
User who did this - Andrei Pelinescu-Onciul (andrei)
Reason for closing: Fixed
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=39
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
Hello,
the first patch release for 3.0 series is out as version 3.0.1. It
includes the fixes to issues discovered since 3.0.0. Database structure
and configuration file compatibility are preserved so the upgrade from
3.0.0 is straightforward.
Links and more details are available at:
http://www.kamailio.org/w/2010/03/kamailio-v3-0-1-released/
Cheers,
Daniel
--
Daniel-Constantin Mierla
Kamailio SIP Router Masterclass, Berlin, March 22-26, 2010
* http://www.asipto.com/index.php/sip-router-masterclass/