Module: sip-router
Branch: master
Commit: 5e67b01516fd1672e1ed5c25b270eccca4d885a1
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5e67b01…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Aug 30 13:46:33 2010 +0200
doc: rpc_list: parse DEFS from the modules Makefiles
Get all the variable definitions from each module Makefile and
evaluate them to get proper DEFS and INCLUDES (using sed to
extract the variable definitions from the Makefiles, some hack to
preserve the LFs and $(eval) to evaluate them in the current
context).
The DEFS and INCLUDES will be passed to the documentation
generating script (dump_rpcs.pl) as extra arguments for gcc. This
way the proper defines and includes will be used for each module.
Fixes rpc list generation failure for modules with kamailio module
interface or with non-standard include dirs.
---
doc/rpc_list/Makefile | 68 ++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 65 insertions(+), 3 deletions(-)
diff --git a/doc/rpc_list/Makefile b/doc/rpc_list/Makefile
index 80a9783..ac6e31a 100644
--- a/doc/rpc_list/Makefile
+++ b/doc/rpc_list/Makefile
@@ -69,7 +69,23 @@ override force_grp=
endif
# command used for gcc (contains extra includes)
-gcc=gcc -I$(COREPATH)/lib -I/usr/include/libxml2
+gcc=gcc
+#-I$(COREPATH)/lib -I$(COREPATH) -I/usr/include/libxml2
+
+# defines used by gcc
+c_defs=-D__CPU_i386 -D__OS_linux -DSER_VER=2099099 -DPKG_MALLOC -DSHM_MEM \
+ -DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP \
+ -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
+ -DUSE_TLS -DTLS_HOOKS -DFAST_LOCK -DCC_GCC_LIKE_ASM \
+ -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
+ -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
+ -DHAVE_SCHED_SETSCHEDULER -DHAVE_EPOLL -DUSE_SCTP -DNAME='\"ser\"' \
+ -DVERSION='\"2.99.99-pre3\"' -DARCH='\"i386\"' -DOS_QUOTED='\"linux\"'
+
+
+# common makefile vars used in defs
+LOCALBASE=/usr/local
+SYSBASE=/usr
filter_files=$(filter-out $(addsuffix %,$(file_exclude)),\
$(filter-out $(addprefix %:,$(grp_exclude)),$(1)))
@@ -102,21 +118,67 @@ get_grp=$(strip $(if $(grp_f_$(call get_bname,$(1))), \
# get target from file:grp (get_target(file:grp) => rpc_grp.txt)
get_target=rpc_$(call get_grp,$(1))
+
+# $(LF) definition (do not remove)
+define LF
+
+
+endef
+
+# get all the lines containing DEFS or INCLUDES definitions from the Makefile.
+# WARNING: does not work with all sed implementation (tested with GNU sed).
+# It uses a hack to restore the LFs (LFs are removed by $(shell)): LFs are
+# replaced with '^LF^' and then ^LF^ is subst'ed back to a real LF.
+get_make_idefs=$(subst ^LF^,$(LF),$(shell sed \
+ -ne '/^[\t ]*\(DEFS\|INCLUDES\)[\t ]*[+:]\?=.*[^\]$$/H'\
+ -ne '/^[\t ]*\(DEFS\|INCLUDES\)[\t ]*[+:]\?=.*\\$$/,/\(^$$\)\|\([^\]$$\)/H'\
+ -ne '$${g;s/\n/^LF^/g;p}'\
+< $(1)/Makefile ))
+
+
+# get all the lines from the makefile containing variable definitions.
+# WARNING: does not work with all sed implementation (tested with GNU sed).
+# It uses a hack to restore the LFs (LFs are removed by $(shell)): LFs are
+# replaced with '^LF^' and then ^LF^ is subst'ed back to a real LF.
+get_make_vars=$(subst ^LF^,$(LF),$(shell sed \
+ -ne '/^[\t ]*[A-Za-z0-9_-]\+[\t ]*[+:]\?=.*[^\]$$/H'\
+ -ne '/^[\t ]*[A-Za-z0-9_-]\+[\t ]*[+:]\?=.*\\$$/,/\(^$$\)\|\([^\]$$\)/H'\
+ -ne '$${g;s/\n/^LF^/g;p}'\
+< $(1)/Makefile ))
+
+
define mk_rules
$(call check_fname_grp, $(1))
#$$(info generating rpc_$$(call get_grp,$(1)).txt: $$(call get_prereq,$(1)))
+
+DEFS:=
+INCLUDES:=
+# extract all the includes and defs from the module makefile and
+# evaluate them
+$$(eval $$(call get_make_vars,$$(dir $$(call get_prereq,$(1)))))
+# save the result in a per group e_idefs_<grp_name> var
+$$(eval e_idefs_$$(call get_grp,$(1)):=$$(DEFS) $$(INCLUDES))
+
+# debugging:
+#$$(info eval: $$(call get_make_vars,$$(dir $$(call get_prereq,$(1)))))
+#$$(info e_idefs_$$(call get_grp,$(1))=$$(e_idefs_$$(call get_grp,$(1))))
+
$(txt_output_dir)/$$(call get_target,$(1)).txt: \
$$(call get_prereq,$(1)) Makefile $(CFG2TXT)
$(CFG2TXT) --file $$< --$(force_grp)grp=$$(call get_grp,$(1)) \
- --gcc="$(gcc)" --txt > "$$@" || (rm -f "$$@"; exit 1)
+ --gcc="$(gcc)" --txt \
+ --defs="$(c_defs) $$(e_idefs_$$(call get_grp,$(1)))" \
+ > "$$@" || (rm -f "$$@"; exit 1)
$(docbook_output_dir)/$$(call get_target,$(1)).xml: \
$$(call get_prereq,$(1)) Makefile $(CFG2TXT)
$(CFG2DOCBOOK) --file $$< --$(force_grp)grp=$$(call get_grp,$(1)) \
- --gcc="$(gcc)" --docbook > "$$@" || (rm -f "$$@"; exit 1)
+ --gcc="$(gcc)" --docbook \
+ --defs="$(c_defs) $$(e_idefs_$$(call get_grp,$(1)))" \
+ > "$$@" || (rm -f "$$@"; exit 1)
clean_$$(call get_target,$(1)).txt:
Module: sip-router
Branch: master
Commit: b6a87729cb1c2c22095bdd11031d7a199c979b72
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b6a8772…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Aug 30 13:32:18 2010 +0200
doc: select_list: parse DEFS from the modules Makefiles
Get all the variable definitions from each module Makefile and
evaluate them to get proper DEFS and INCLUDES (using sed to
extract the variable definitions, conditionals and filter-out
rules from the Makefiles, some hack to preserve the LFs and
$(eval) to evaluate the extracted stuff in the current context).
The DEFS and INCLUDES will be passed to the documentation
generating script (dump_selects.pl) as extra arguments for gcc.
This way the proper defines and includes will be used for each
module.
Fixes select list generation failure for modules with non-standard
include dirs.
---
doc/select_list/Makefile | 85 +++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 80 insertions(+), 5 deletions(-)
diff --git a/doc/select_list/Makefile b/doc/select_list/Makefile
index e3f510e..7d43356 100644
--- a/doc/select_list/Makefile
+++ b/doc/select_list/Makefile
@@ -62,7 +62,23 @@ override force_grp=
endif
# command used for gcc (contains extra includes)
-gcc=gcc -I$(COREPATH)/lib -I/usr/include/libxml2
+gcc=gcc
+#-I$(COREPATH)/lib -I$(COREPATH) -I/usr/include/libxml2
+
+# defines used by gcc
+c_defs=-D__CPU_i386 -D__OS_linux -DSER_VER=2099099 -DPKG_MALLOC -DSHM_MEM \
+ -DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP \
+ -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
+ -DUSE_TLS -DTLS_HOOKS -DFAST_LOCK -DCC_GCC_LIKE_ASM \
+ -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
+ -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
+ -DHAVE_SCHED_SETSCHEDULER -DHAVE_EPOLL -DUSE_SCTP -DNAME='\"ser\"' \
+ -DVERSION='\"2.99.99-pre3\"' -DARCH='\"i386\"' -DOS_QUOTED='\"linux\"'
+
+
+# common makefile vars used in defs
+LOCALBASE=/usr/local
+SYSBASE=/usr
filter_files=$(subst .h:,.c:, $(filter-out $(addsuffix %,$(file_exclude)),\
$(filter-out $(addprefix %:,$(grp_exclude)),$(1))) )
@@ -95,23 +111,82 @@ get_grp=$(strip $(if $(grp_f_$(call get_bname,$(1))), \
# get target from file:grp (get_target(file:grp) => select_grp)
get_target=select_$(call get_grp,$(1))
+
+# $(LF) definition (do not remove)
+define LF
+
+
+endef
+
+# get all the lines containing DEFS or INCLUDES definitions from the Makefile.
+# WARNING: does not work with all sed implementation (tested with GNU sed).
+# It uses a hack to restore the LFs (LFs are removed by $(shell)): LFs are
+# replaced with '^LF^' and then ^LF^ is subst'ed back to a real LF.
+get_make_idefs=$(subst ^LF^,$(LF),$(shell sed \
+ -ne '/^[\t ]*\(DEFS\|INCLUDES\)[\t ]*[+:]\?=.*[^\]$$/H'\
+ -ne '/^[\t ]*\(DEFS\|INCLUDES\)[\t ]*[+:]\?=.*\\$$/,/\(^$$\)\|\([^\]$$\)/H'\
+ -ne '$${g;s/\n/^LF^/g;p}'\
+< $(1)/Makefile ))
+
+
+# get all the lines from the makefile containing variable definitions.
+# It will also return conditionals and try to filter out possible rules.
+# WARNING: does not work with all sed implementation (tested with GNU sed).
+# It uses a hack to restore the LFs (LFs are removed by $(shell)): LFs are
+# replaced with '^LF^' and then ^LF^ is subst'ed back to a real LF.
+get_make_vars=$(subst ^LF^,$(LF),$(shell sed -n \
+ -e ': start' \
+ -e '/^\(ifeq\|ifneq\|else\|endif\)[\t ]*\($$\|.*[^\]$$\)/{H;d}' \
+ -e '/^\(ifeq\|ifneq\|else\|endif\)[\t ]\+.*[\]$$/,/[^\]$$/{H;d}' \
+ -e '/^[a-zA-Z._/$$][a-zA-Z0-9._()/$$ \t-]*:\([^=]\|$$\)/b eat_rule' \
+ -e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*[^\]$$/{H;d}' \
+ -e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*\\$$/,/\(^$$\)\|\([^\]$$\)/{H;d}' \
+ -e ': end' \
+ -e '$${g;s/\n/^LF^/g;p}'\
+ -e 'b' \
+ -e ': eat_rule' \
+ -e '$$b end' \
+ -e 'n' \
+ -e '/^[a-zA-Z._/$$][a-zA-Z0-9._()/$$ \t-]*:\([^=]\|$$\)/b eat_rule' \
+ -e '/^[\t]/b eat_rule' \
+ -e 'b start' \
+< $(1)/Makefile ))
+
+
define mk_rules
$(call check_fname_grp, $(1))
#$$(info generating select_$$(call get_grp,$(1)).txt: $$(call get_prereq,$(1)))
+
+DEFS:=
+INCLUDES:=
+# extract all the includes and defs from the module makefile and
+# evaluate them
+$$(eval $$(call get_make_vars,$$(dir $$(call get_prereq,$(1)))))
+# override COREPATH (we know better)
+COREPATH=../..
+# save the result in a per group e_idefs_<grp_name> var
+$$(eval e_idefs_$$(call get_grp,$(1)):=$$(DEFS) $$(INCLUDES))
+
+# debugging:
+#$$(info eval: $$(call get_make_vars,$$(dir $$(call get_prereq,$(1)))))
+#$$(info e_idefs_$$(call get_grp,$(1))=$$(e_idefs_$$(call get_grp,$(1))))
+
$(txt_output_dir)/$$(call get_target,$(1)).txt: \
$$(call get_prereq,$(1)) Makefile $(CFG2TXT)
$(CFG2TXT) --file $$< --$(force_grp)grp=$$(call get_grp,$(1)) \
- --gcc="$(gcc)" --txt $(CFG2TXT_EXTRA_OPTS) > "$$@" || \
- (rm -f "$$@"; exit 1)
+ --gcc="$(gcc)" --txt $(CFG2TXT_EXTRA_OPTS) \
+ --defs="$(c_defs) $$(e_idefs_$$(call get_grp,$(1)))" \
+ > "$$@" || (rm -f "$$@"; exit 1)
$(docbook_output_dir)/$$(call get_target,$(1)).xml: \
$$(call get_prereq,$(1)) Makefile $(CFG2TXT)
$(CFG2DOCBOOK) --file $$< --$(force_grp)grp=$$(call get_grp,$(1)) \
- --gcc="$(gcc)" --docbook $(CFG2DOCBOOK_EXTRA_OPTS) > "$$@" || \
- (rm -f "$$@"; exit 1)
+ --gcc="$(gcc)" --docbook $(CFG2DOCBOOK_EXTRA_OPTS) \
+ --defs="$(c_defs) $$(e_idefs_$$(call get_grp,$(1)))" \
+ > "$$@" || (rm -f "$$@"; exit 1)
clean_$$(call get_target,$(1)).txt:
Module: sip-router
Branch: master
Commit: 9dbb14fef6eb0dafff363eb3061e293de45bf7af
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=9dbb14f…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Aug 30 23:02:48 2010 +0200
doc: rpc_list: improve DEFS parsing
When getting all the makefile variables from the Makefiles obey
also the conditionals (ifdef, ifndef) and make sure all the
makefiles rules are filtered out (to avoid miss-interpreting a
shell variable assignment in a rule as a makefile variable).
---
doc/rpc_list/Makefile | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/doc/rpc_list/Makefile b/doc/rpc_list/Makefile
index ac6e31a..bf9f5bf 100644
--- a/doc/rpc_list/Makefile
+++ b/doc/rpc_list/Makefile
@@ -137,13 +137,26 @@ get_make_idefs=$(subst ^LF^,$(LF),$(shell sed \
# get all the lines from the makefile containing variable definitions.
+# It will also return conditionals and try to filter out possible rules.
# WARNING: does not work with all sed implementation (tested with GNU sed).
# It uses a hack to restore the LFs (LFs are removed by $(shell)): LFs are
# replaced with '^LF^' and then ^LF^ is subst'ed back to a real LF.
-get_make_vars=$(subst ^LF^,$(LF),$(shell sed \
- -ne '/^[\t ]*[A-Za-z0-9_-]\+[\t ]*[+:]\?=.*[^\]$$/H'\
- -ne '/^[\t ]*[A-Za-z0-9_-]\+[\t ]*[+:]\?=.*\\$$/,/\(^$$\)\|\([^\]$$\)/H'\
- -ne '$${g;s/\n/^LF^/g;p}'\
+get_make_vars=$(subst ^LF^,$(LF),$(shell sed -n \
+ -e ': start' \
+ -e '/^\(ifeq\|ifneq\|else\|endif\)[\t ]*\($$\|.*[^\]$$\)/{H;d}' \
+ -e '/^\(ifeq\|ifneq\|else\|endif\)[\t ]\+.*[\]$$/,/[^\]$$/{H;d}' \
+ -e '/^[a-zA-Z._/$$][a-zA-Z0-9._()/$$ \t-]*:\([^=]\|$$\)/b eat_rule' \
+ -e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*[^\]$$/{H;d}' \
+ -e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*\\$$/,/\(^$$\)\|\([^\]$$\)/{H;d}' \
+ -e ': end' \
+ -e '$${g;s/\n/^LF^/g;p}'\
+ -e 'b' \
+ -e ': eat_rule' \
+ -e '$$b end' \
+ -e 'n' \
+ -e '/^[a-zA-Z._/$$][a-zA-Z0-9._()/$$ \t-]*:\([^=]\|$$\)/b eat_rule' \
+ -e '/^[\t]/b eat_rule' \
+ -e 'b start' \
< $(1)/Makefile ))
@@ -159,6 +172,8 @@ INCLUDES:=
# extract all the includes and defs from the module makefile and
# evaluate them
$$(eval $$(call get_make_vars,$$(dir $$(call get_prereq,$(1)))))
+# override COREPATH (we know better)
+COREPATH=../..
# save the result in a per group e_idefs_<grp_name> var
$$(eval e_idefs_$$(call get_grp,$(1)):=$$(DEFS) $$(INCLUDES))
Module: sip-router
Branch: master
Commit: ab5e3984b5afe1d31ed67bbb4842184821215228
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ab5e398…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Aug 30 13:32:18 2010 +0200
doc: cfg_list: parse DEFS from the modules Makefiles
Get all the variable definitions from each module Makefile and
evaluate them to get proper DEFS and INCLUDES (using sed to
extract the variable definitions, conditionals and filter-out
rules from the Makefiles, some hack to preserve the LFs and
$(eval) to evaluate the extracted stuff in the current context).
The DEFS and INCLUDES will be passed to the documentation
generating script (dump_cfg_defs.pl) as extra arguments for gcc. This
way the proper defines and includes will be used for each module.
Fixes cfg var. list generation failure for modules with kamailio module
interface or with non-standard include dirs.
---
doc/cfg_list/Makefile | 81 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 78 insertions(+), 3 deletions(-)
diff --git a/doc/cfg_list/Makefile b/doc/cfg_list/Makefile
index 16d645a..a10aaef 100644
--- a/doc/cfg_list/Makefile
+++ b/doc/cfg_list/Makefile
@@ -53,7 +53,23 @@ override force_grp=
endif
# command used for gcc (contains extra includes)
-gcc=gcc -I$(COREPATH)/lib -I/usr/include/libxml2
+gcc=gcc
+#-I$(COREPATH)/lib -I$(COREPATH) -I/usr/include/libxml2
+
+# defines used by gcc
+c_defs=-D__CPU_i386 -D__OS_linux -DSER_VER=2099099 -DPKG_MALLOC -DSHM_MEM \
+ -DSHM_MMAP -DDNS_IP_HACK -DUSE_IPV6 -DUSE_MCAST -DUSE_TCP \
+ -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLACKLIST -DUSE_NAPTR \
+ -DUSE_TLS -DTLS_HOOKS -DFAST_LOCK -DCC_GCC_LIKE_ASM \
+ -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
+ -DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
+ -DHAVE_SCHED_SETSCHEDULER -DHAVE_EPOLL -DUSE_SCTP -DNAME='\"ser\"' \
+ -DVERSION='\"2.99.99-pre3\"' -DARCH='\"i386\"' -DOS_QUOTED='\"linux\"'
+
+
+# common makefile vars used in defs
+LOCALBASE=/usr/local
+SYSBASE=/usr
filter_files=$(filter-out $(addsuffix %,$(file_exclude)),\
$(filter-out $(addprefix %:,$(grp_exclude)),$(1)))
@@ -86,21 +102,80 @@ get_grp=$(strip $(if $(grp_f_$(call get_bname,$(1))), \
# get target from file:grp (get_target(file:grp) => cfg_grp.txt)
get_target=cfg_$(call get_grp,$(1))
+
+# $(LF) definition (do not remove)
+define LF
+
+
+endef
+
+# get all the lines containing DEFS or INCLUDES definitions from the Makefile.
+# WARNING: does not work with all sed implementation (tested with GNU sed).
+# It uses a hack to restore the LFs (LFs are removed by $(shell)): LFs are
+# replaced with '^LF^' and then ^LF^ is subst'ed back to a real LF.
+get_make_idefs=$(subst ^LF^,$(LF),$(shell sed \
+ -ne '/^[\t ]*\(DEFS\|INCLUDES\)[\t ]*[+:]\?=.*[^\]$$/H'\
+ -ne '/^[\t ]*\(DEFS\|INCLUDES\)[\t ]*[+:]\?=.*\\$$/,/\(^$$\)\|\([^\]$$\)/H'\
+ -ne '$${g;s/\n/^LF^/g;p}'\
+< $(1)/Makefile ))
+
+
+# get all the lines from the makefile containing variable definitions.
+# It will also return conditionals and try to filter out possible rules.
+# WARNING: does not work with all sed implementation (tested with GNU sed).
+# It uses a hack to restore the LFs (LFs are removed by $(shell)): LFs are
+# replaced with '^LF^' and then ^LF^ is subst'ed back to a real LF.
+get_make_vars=$(subst ^LF^,$(LF),$(shell sed -n \
+ -e ': start' \
+ -e '/^\(ifeq\|ifneq\|else\|endif\)[\t ]*\($$\|.*[^\]$$\)/{H;d}' \
+ -e '/^\(ifeq\|ifneq\|else\|endif\)[\t ]\+.*[\]$$/,/[^\]$$/{H;d}' \
+ -e '/^[a-zA-Z._/$$][a-zA-Z0-9._()/$$ \t-]*:\([^=]\|$$\)/b eat_rule' \
+ -e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*[^\]$$/{H;d}' \
+ -e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*\\$$/,/\(^$$\)\|\([^\]$$\)/{H;d}' \
+ -e ': end' \
+ -e '$${g;s/\n/^LF^/g;p}'\
+ -e 'b' \
+ -e ': eat_rule' \
+ -e '$$b end' \
+ -e 'n' \
+ -e '/^[a-zA-Z._/$$][a-zA-Z0-9._()/$$ \t-]*:\([^=]\|$$\)/b eat_rule' \
+ -e '/^[\t]/b eat_rule' \
+ -e 'b start' \
+< $(1)/Makefile ))
+
+
define mk_rules
$(call check_fname_grp, $(1))
#$$(info generating cfg_$$(call get_grp,$(1)).txt: $$(call get_prereq,$(1)))
+
+DEFS:=
+INCLUDES:=
+# extract all the includes and defs from the module makefile and
+# evaluate them
+$$(eval $$(call get_make_vars,$$(dir $$(call get_prereq,$(1)))))
+# save the result in a per group e_idefs_<grp_name> var
+$$(eval e_idefs_$$(call get_grp,$(1)):=$$(DEFS) $$(INCLUDES))
+
+# debugging:
+#$$(info eval: $$(call get_make_vars,$$(dir $$(call get_prereq,$(1)))))
+#$$(info e_idefs_$$(call get_grp,$(1))=$$(e_idefs_$$(call get_grp,$(1))))
+
$(txt_output_dir)/$$(call get_target,$(1)).txt: \
$$(call get_prereq,$(1)) Makefile $(CFG2TXT)
$(CFG2TXT) --file $$< --$(force_grp)grp=$$(call get_grp,$(1)) \
- --gcc="$(gcc)" --txt > "$$@" || (rm -f "$$@"; exit 1)
+ --gcc="$(gcc)" --txt \
+ --defs="$(c_defs) $$(e_idefs_$$(call get_grp,$(1)))" \
+ > "$$@" || (rm -f "$$@"; exit 1)
$(docbook_output_dir)/$$(call get_target,$(1)).xml: \
$$(call get_prereq,$(1)) Makefile $(CFG2TXT)
$(CFG2DOCBOOK) --file $$< --$(force_grp)grp=$$(call get_grp,$(1)) \
- --gcc="$(gcc)" --docbook > "$$@" || (rm -f "$$@"; exit 1)
+ --gcc="$(gcc)" --docbook \
+ --defs="$(c_defs) $$(e_idefs_$$(call get_grp,$(1)))" \
+ > "$$@" || (rm -f "$$@"; exit 1)
clean_$$(call get_target,$(1)).txt:
Module: sip-router
Branch: master
Commit: e8b64a9db7487233e6ddea10ea7b504e0a4484f6
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=e8b64a9…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Mon Aug 30 13:28:17 2010 +0200
doc: dump_*.pl: support for gcc 4.5
- support for gcc 4.5 (gcc 4.5 will produce the translation unit
dump file in the same directory as the output file, while older
versions will always write it in the current directory).
- be more verbose on gcc error (display the complete gcc command line)
- cleanup temporary files even in the error case
---
doc/scripts/cdefs2doc/dump_cfg_defs.pl | 17 ++++++++++++++---
doc/scripts/cdefs2doc/dump_rpcs.pl | 17 ++++++++++++++---
doc/scripts/cdefs2doc/dump_selects.pl | 17 ++++++++++++++---
3 files changed, 42 insertions(+), 9 deletions(-)
diff --git a/doc/scripts/cdefs2doc/dump_cfg_defs.pl b/doc/scripts/cdefs2doc/dump_cfg_defs.pl
index 48e199b..ebf14af 100755
--- a/doc/scripts/cdefs2doc/dump_cfg_defs.pl
+++ b/doc/scripts/cdefs2doc/dump_cfg_defs.pl
@@ -228,9 +228,20 @@ if (! defined $opt_is_tu){
# => we have to create one
$src_fname=basename($file);
$tmp_file = "/tmp/" . mktemp ("dump_translation_unit_XXXXXX");
- system("$gcc -fdump-translation-unit $c_defs -c $file -o $tmp_file.o && \
- mv \"$src_fname\".001t.tu $tmp_file") == 0 or
- die "$gcc failed to generate a translation unit dump from $file";
+ # Note: gcc < 4.5 will produce the translation unit dump in a file in
+ # the current directory. gcc 4.5 will write it in the same directory as
+ # the output file.
+ system("$gcc -fdump-translation-unit $c_defs -c $file -o $tmp_file") == 0
+ or die "$gcc -fdump-translation-unit $c_defs -c $file -o $tmp_file" .
+ " failed to generate a translation unit dump from $file";
+ if (system("if [ -f \"$src_fname\".001t.tu ]; then \
+ mv \"$src_fname\".001t.tu $tmp_file; \
+ else mv /tmp/\"$src_fname\".001t.tu $tmp_file; fi ") != 0) {
+ unlink($tmp_file, "$tmp_file.o");
+ die "could not find the gcc translation unit dump file" .
+ " ($src_fname.001t.tu) neither in the current directory" .
+ " or /tmp";
+ };
$tu=GCC::TranslationUnit::Parser->parsefile($tmp_file);
print(STDERR "src name $src_fname\n") if $dbg;
unlink($tmp_file, "$tmp_file.o");
diff --git a/doc/scripts/cdefs2doc/dump_rpcs.pl b/doc/scripts/cdefs2doc/dump_rpcs.pl
index 706ec80..63c222e 100755
--- a/doc/scripts/cdefs2doc/dump_rpcs.pl
+++ b/doc/scripts/cdefs2doc/dump_rpcs.pl
@@ -221,9 +221,20 @@ if (! defined $opt_is_tu){
# => we have to create one
$src_fname=basename($file);
$tmp_file = "/tmp/" . mktemp ("dump_translation_unit_XXXXXX");
- system("$gcc -fdump-translation-unit $c_defs -c $file -o $tmp_file && \
- mv \"$src_fname\".001t.tu $tmp_file") == 0 or
- die "$gcc failed to generate a translation unit dump from $file";
+ # Note: gcc < 4.5 will produce the translation unit dump in a file in
+ # the current directory. gcc 4.5 will write it in the same directory as
+ # the output file.
+ system("$gcc -fdump-translation-unit $c_defs -c $file -o $tmp_file") == 0
+ or die "$gcc -fdump-translation-unit $c_defs -c $file -o $tmp_file" .
+ " failed to generate a translation unit dump from $file";
+ if (system("if [ -f \"$src_fname\".001t.tu ]; then \
+ mv \"$src_fname\".001t.tu $tmp_file; \
+ else mv /tmp/\"$src_fname\".001t.tu $tmp_file; fi ") != 0) {
+ unlink($tmp_file, "$tmp_file.o");
+ die "could not find the gcc translation unit dump file" .
+ " ($src_fname.001t.tu) neither in the current directory" .
+ " or /tmp";
+ };
$tu=GCC::TranslationUnit::Parser->parsefile($tmp_file);
print(STDERR "src name $src_fname\n") if $dbg;
unlink($tmp_file, "$tmp_file.o");
diff --git a/doc/scripts/cdefs2doc/dump_selects.pl b/doc/scripts/cdefs2doc/dump_selects.pl
index aea0018..76aa5d9 100755
--- a/doc/scripts/cdefs2doc/dump_selects.pl
+++ b/doc/scripts/cdefs2doc/dump_selects.pl
@@ -391,9 +391,20 @@ sub process_file
# => we have to create one
$src_fname=basename($file);
$tmp_file = "/tmp/" . mktemp ("dump_translation_unit_XXXXXX");
- system("$gcc -fdump-translation-unit $c_defs -c $file -o $tmp_file && \
- mv \"$src_fname\".001t.tu $tmp_file") == 0 or
- die "$gcc failed to generate a translation unit dump from $file";
+ # Note: gcc < 4.5 will produce the translation unit dump in a file in
+ # the current directory. gcc 4.5 will write it in the same directory as
+ # the output file.
+ system("$gcc -fdump-translation-unit $c_defs -c $file -o $tmp_file") == 0
+ or die "$gcc -fdump-translation-unit $c_defs -c $file -o $tmp_file" .
+ " failed to generate a translation unit dump from $file";
+ if (system("if [ -f \"$src_fname\".001t.tu ]; then \
+ mv \"$src_fname\".001t.tu $tmp_file; \
+ else mv /tmp/\"$src_fname\".001t.tu $tmp_file; fi ") != 0) {
+ unlink($tmp_file, "$tmp_file.o");
+ die "could not find the gcc translation unit dump file" .
+ " ($src_fname.001t.tu) neither in the current directory" .
+ " or /tmp";
+ };
$tu=GCC::TranslationUnit::Parser->parsefile($tmp_file);
print(STDERR "src name $src_fname\n") if $dbg;
unlink($tmp_file, "$tmp_file.o");
when i build master on debian squeeze, i get an error
docbook2x-man -s ../../doc/stylesheets/serdoc2man.xsl auth.xml
make[2]: docbook2x-man: Command not found
make[2]: *** [auth.7] Error 127
make[1]: [modules-man] Error 1 (ignored)
should docbook2x be listed in build dependencies?
-- juha