doc: make: Remove of Makefiles

- tutorials do nt have CMake equivalent
This commit is contained in:
Xenofon Karamanos 2026-02-03 17:01:42 +00:00
parent a0236b3673
commit 8320a324a4
18 changed files with 0 additions and 1784 deletions

View file

@ -1,204 +0,0 @@
# This variable contains a list of docbook sources separated by white space to
# be processed by the docbook build system if the user did not specify any
# document on the command line. Documents configure here are processed one
# after another, each of them will be treated as a standalone documentation
# file.
docs ?= index.xml
# Here you can specify the name of the file that will be used to generate a
# module README file. You can override it in a module Makefile. This is
# useful, for example, if you want to use a different docbook file to generate
# README and a different docbook file to generate documentation in other
# formats (HTML, TXT). If you omit this variable in your Makefile then the
# first document specified in DOCS is used to generate module README file.
readme_docs ?= $(docs)
# This is the list of docbook files to be used to generate HTML
# documentation. You can use this variable in your Makefile if you have
# docbook documents that should be processed only when HTML documentation is
# being generated (i.e. you want them to be ignored when plain-text
# documentation is being generated). Multiple documents separated by white
# space can be configured here and they will be processed one after
# another. If you omit this variable then the documents specified in DOCS
# variable will be converted to HTML when HTML documentation is being built.
html_docs ?= $(docs)
# This is the list of docbook files to be used to generate plain-text
# documentation. You can use this variable in your Makefile if you have
# docbook documents that should be processed only when plain-textdocumentation
# is being generated (i.e. you want them to be ignored when HTML documentation
# is being generated). Multiple documents separated by white space can be
# configured here and they will be processed one after another. If you omit
# this variable then the documents specified in DOCS variable will be
# converted to plain-text when plain-text documentation is being built.
txt_docs ?= $(docs)
# Output directory where files produced by XSL stylesheets should be stored,
# by default we output to the same directory, documents that are chunked may
# choose to override this to write all chunks in a subdirectory instead.
output_dir ?= .
# Here you can configure the path to the directory which contains all
# auxiliary files that are needed to convert docbook documentation to other
# formats. You should not need to use this variable under normal
# circumstances.
docbook_dir ?= ../../../doc/docbook
COREPATH ?= $(docbook_dir)/../../src
# This is the stylesheet used to generate a list of dependencies for a docbook
# source file. The stylesheet walks through the document and prints all files
# that are included in the document. The list of files is then written in a
# standalone file by this Makefile and the file can be included by the
# Makefile.
dep_xsl ?= $(docbook_dir)/dep.xsl
# This is the stylesheet that is used to produce a single HTML file for every
# docbook document being processed. This stylesheet contains configuration for
# docbook XSL scripts that only applies when the build system generates a
# single HTML file.
single_html_xsl ?= $(docbook_dir)/html.xsl
# This stylesheet is used to produce chunked HTML documention, the output will
# be a set of HTML files. This stylesheet contains configuration for docbook
# XSL scripts that only applies when multiple-file HTML documentation is being
# generated.
chunked_html_xsl ?= $(chunked_html_xls)/html.chunked.xsl
# This stylesheet is used to produce plain-text documentation. Internally this
# stylesheet includes the docbook XSL stylesheet used to produce single-file
# HTML documentation and the output is then converted by lynx to a plain-text
# file.
txt_xsl ?= $(docbook_dir)/txt.xsl
# This stylesheet is used when the docbook build system generates a module
# README. The process is similar to the process of generating plain-text file,
# but we use a separate stylesheet here because the configuration of docbook
# XSL stylesheets can be a bit different for READMEs (i.e. we do not want to
# have list of examples in READMES, etc.)
readme_xsl ?= $(docbook_dir)/readme.xsl
# Use this configuration variable to enable or disable docbook document
# validation before the build system converts the document into another
# format.
validate ?= 0
# A list of CSS stylesheets separated by whitespace to be included in HTML
# files.
html_css ?= /css/sr-doc.css
# This is the catalog file used by xsltproc to locate docbook schema files
# needed to validate docbook documents and docbook XSL stylesheets needed
# convert docbook documents to other formats. All docbook documents in the
# sip-router projects refer to schema files using public
# identifiers. Similarly customization stylesheets refer to docbook XSL
# stylesheets using public URIs. The catalog file is then used to convert
# public identifiers and public URIs to files on local filesystem. The default
# version of the catalog file only refers to file /etc/xml/catalog, this is
# the site-wide catalog file present in Debian and possibly other systems
# too. This file is updated by the package manager whenever docbook schema
# file or docbook xsl stylesheets are being installed.
catalog ?= $(docbook_dir)/catalog.xml
# Use standard catalog from OS, set it to no to use the above path to a
# custom catalog file.
nocatalog ?= yes
lynx ?= lynx
dia ?= dia
xsltproc ?= xsltproc
xmllint ?= xmllint
lynx_flags ?= -nolist
dia_args ?=
xsltproc_flags ?=
xmllint_flags ?= --xinclude --postvalid --noout
ifeq ($(validate), 0)
override xsltproc_flags := $(xsltproc_flags) --novalid
endif
ifeq ($(nocatalog),yes)
XMLCATALOGX=
else
XMLCATALOGX=XML_CATALOG_FILES=$(catalog)
endif
all_deps = Makefile $(docbook_dir)/Makefile $(docbook_dir)/entities.xml \
$(dep_xsl) $(catalog) $(extra_deps)
all: txt
html_files = $(addprefix $(output_dir)/, $(addsuffix .html,\
$(basename $(html_docs))))
html_deps = $(addsuffix .d, $(basename $(html_docs)))
txt_files = $(addprefix $(output_dir)/, $(addsuffix .txt,\
$(basename $(txt_docs))))
txt_deps = $(addsuffix .d, $(basename $(txt_docs)))
readme_deps = $(addsuffix .d, $(basename $(readme_docs)))
html xhtml single_html single_xhtml: $(html_files)
txt text plaintext: $(txt_files)
readme README: ../README
../README: $(readme_docs) $(readme_deps) $(readme_xsl) $(all_deps)
$(XMLCATALOGX) $(xsltproc) $(xsltproc_flags) \
--xinclude \
$(readme_xsl) $< | $(lynx) $(lynx_flags) -stdin -dump > $@
$(output_dir)/%.html: %.xml %.d $(single_html_xsl) $(all_deps)
$(XMLCATALOGX) $(xsltproc) $(xsltproc_flags) \
--xinclude \
--stringparam base.dir "$(output_dir)/" \
--stringparam root.filename "$(basename $<)" \
--stringparam html.stylesheet "$(html_css)" \
--stringparam html.ext ".html" \
$(single_html_xsl) $<
$(output_dir)/%.txt: %.xml %.d $(txt_xsl) $(all_deps)
$(XMLCATALOGX) $(xsltproc) $(xsltproc_flags) \
--xinclude \
$(txt_xsl) $< | $(lynx) $(lynx_flags) -stdin -dump > $@
%.png: %.dia $(all_dep)
$(dia) $(dia_flags) -t png -e $@ $<
%.d: %.xml $(all_dep)
$(xsltproc) $(xsltproc_flags) \
--nonet \
--novalid \
--stringparam output "$@" \
$(dep_xsl) $<
.PHONY: check
check: $(docs) $(html_docs) $(txt_docs) $(readme_docs)
$(XMLCATALOGX) $(xmllint) $(xmllint_flags) $<
.PHONY: clean
clean:
-@rm -f $(html_files) $(txt_files)
.PHONY: proper realclean distclean maintainer-clean
proper realclean distclean maintainer-clean: clean
-rm -f $(html_deps) $(txt_deps) $(readme_deps) *~
maintainer-clean: clean-tmp
.PHONY: clean-tmp
clean-tmp:
-rm -f TAGS tags *.dbg .*.swp
ifeq (,$(MAKECMDGOALS))
include $(html_deps) $(txt_deps) $(readme_deps)
else
ifeq (,$(strip $(nodep_targets)))
include $(COREPATH)/Makefile.targets
endif
ifneq (,$(filter-out $(nodep_targets) check, $(MAKECMDGOALS)))
include $(html_deps) $(txt_deps) $(readme_deps)
endif
endif

View file

@ -1,4 +0,0 @@
# This is the future home for module specific targets,
# nothing here yet
include $(docbook_dir)/Makefile

View file

@ -1,352 +0,0 @@
COREPATH=../../../src
#include $(COREPATH)/Makefile.defs
CFG2TXT=../../scripts/cdefs2doc/dump_cfg_defs.pl
CFG2DOCBOOK=../../scripts/cdefs2doc/dump_cfg_defs.pl
# output directory for generated txt files
txt_output_dir=.
# output directory for generated docbook xml files
docbook_output_dir=docbook
# list of files containing cfg defs in the following format:
# <filename>:<cfg_grp_name>
# can be easily updated by adding the output of:
# make diff-list (which obeys grp_exclude and file_exclude)
# or completely regenerated by replacing files_list with the output of:
# make gen-files-list
files_list= \
$(COREPATH)/core/cfg_core.c:core \
$(COREPATH)/core/tcp_options.c:tcp \
$(COREPATH)/modules/carrierroute/config.c:carrierroute \
$(COREPATH)/modules/debugger/debugger_config.c:debugger \
$(COREPATH)/modules/dispatcher/config.c:dispatcher \
$(COREPATH)/modules/ims_registrar_scscf/config.c:ims_registrar_scscf \
$(COREPATH)/modules/malloc_test/malloc_test.c:malloc_test \
$(COREPATH)/modules/maxfwd/maxfwd.c:maxfwd \
$(COREPATH)/modules/outbound/config.c:outbound \
$(COREPATH)/modules/registrar/config.c:registrar \
$(COREPATH)/modules/rtpengine/config.c:rtpengine \
$(COREPATH)/modules/sctp/sctp_options.c:sctp \
$(COREPATH)/modules/siputils/config.c:siputils \
$(COREPATH)/modules/stun/config.c:stun \
$(COREPATH)/modules/tls/tls_cfg.c:tls \
$(COREPATH)/modules/tm/config.c:tm \
$(COREPATH)/modules/websocket/config.c:websocket \
$(COREPATH)/modules/xlog/xlog.c:xlog
# list of excluded groups
grp_exclude=pa
# list of file prefixes to exclude (full path needed)
file_exclude= $(COREPATH)/obsolete/
# special per file group overrides
# format= grp_filename=... ,where filename does not contain the extension
# e.g.:
# grp_f_tcp_options=tcp
# grp_f_sctp_options=sctp
# special per group group name overrides
# e.g.:
# grp_g_maxfwd=mf
# override auto-detected group if set to 1 (else the group is used inside the
# file only if it cannot be aut-odetected)
ifeq ($(group_override),1)
override force_grp=force-
else
override force_grp=
endif
# command used for gcc (contains extra includes)
gcc=gcc
#-I$(COREPATH)/lib -I$(COREPATH) -I/usr/include/libxml2
# defines used by gcc
c_defs=-DNAME='\"kamailio\"' -DVERSION='\"5.1.0-dev3\"' -DARCH='\"x86_64\"' \
-DOS='linux_' -DOS_QUOTED='\"linux\"' -DCOMPILER='\"gcc 4.9.2\"' \
-D__CPU_x86_64 -D__OS_linux -DSER_VER=5001000 \
-DCFG_DIR='\"/usr/local/etc/kamailio/\"' \
-DRUN_DIR='\"/run/kamailio/\"' -DPKG_MALLOC -DSHM_MEM -DSHM_MMAP \
-DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE -DHAVE_RESOLV_RES \
-DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLOCKLIST -DUSE_NAPTR \
-DMEM_JOIN_FREE -DF_MALLOC -DQ_MALLOC -DTLSF_MALLOC \
-DDBG_SR_MEMORY -DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS \
-DMALLOC_STATS -DWITH_AS_SUPPORT -DUSE_SCTP -DFAST_LOCK -DADAPTIVE_WAIT \
-DADAPTIVE_WAIT_LOOPS=1024 -DCC_GCC_LIKE_ASM -DHAVE_GETHOSTBYNAME2 \
-DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL \
-DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM \
-DHAVE_SCHED_SETSCHEDULER -DHAVE_IP_MREQN -DHAVE_EPOLL -DHAVE_SIGIO_RT \
-DSIGINFO64_WORKAROUND -DUSE_FUTEX -DHAVE_SELECT
# common makefile vars used in defs
LOCALBASE=/usr/local
SYSBASE=/usr
filter_files=$(filter-out $(addsuffix %,$(file_exclude)),\
$(filter-out $(addprefix %:,$(grp_exclude)),$(1)))
#filtered files list
flist=$(call filter_files,$(files_list))
# throws an error if input is not in the format filename:grp
check_fname_grp=$(if $(filter-out 2,$(words $(subst :, ,$(1)))),\
$(error bad format "$(1)", it should be filename:grp))
# get prereq from file:grp (get_prereq(file:grp) => file)
get_prereq=$(firstword $(subst :, ,$(1)))
# get grp from file:grp (get_grp(file:grp) => grp)
get_listed_grp=$(word 2, $(subst :, ,$(1)))
# get base file name from file:grp: get_bname(file:grp)
# => basename(file) without extension (e.g. get_bname(foo/bar.c:x) => bar)
#
get_bname=$(basename $(notdir $(call get_prereq,$(1))))
#get grp from file:grp, using the overrides
get_grp=$(strip $(if $(grp_f_$(call get_bname,$(1))), \
$(grp_f_$(call get_bname,$(1))),\
$(if $(grp_g_$(call get_listed_grp,$(1))),\
$(grp_g_$(call get_listed_grp,$(1))),\
$(call get_listed_grp,$(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;b end}' \
-e '/^\(ifeq\|ifneq\|else\|endif\)[\t ]\+.*[\]$$/,/[^\]$$/{H;b end}' \
-e '/^[a-zA-Z._/$$][a-zA-Z0-9._()/$$ \t-]*:\([^=]\|$$\)/b eat_rule' \
-e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*[^\]$$/{H;b end}' \
-e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*\\$$/,/\(^$$\)\|\([^\]$$\)/{H;b end}' \
-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)))))
# override COREPATH (we know better)
COREPATH=../../../src
# 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 \
--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 \
--defs="$(c_defs) $$(e_idefs_$$(call get_grp,$(1)))" \
> "$$@" || (rm -f "$$@"; exit 1)
clean_$$(call get_target,$(1)).txt:
rm -f "$(txt_output_dir)/$$(call get_target,$(1)).txt"
clean_$$(call get_target,$(1)).xml:
rm -f "$(docbook_output_dir)/$$(call get_target,$(1)).xml"
txt: $(txt_output_dir)/$$(call get_target,$(1)).txt
docbook: $(docbook_output_dir)/$$(call get_target,$(1)).xml
clean_txt: clean_$$(call get_target,$(1)).txt
clean_docbook: clean_$$(call get_target,$(1)).xml
endef
find_cfg_files_cmd= find $(COREPATH) -type f -name "*.c" \
-exec grep "cfg_def_t[ ][a-zA-Z0-9_]*\[\][ ]*=" /dev/null {} \; \
| cut -d: -f1
# shell command to generate a file:grp list from a list of files
# grp will be the modulename if the file is in a module directory or
# the file name with the extension and _cfg, cfg_ or _options stripped out of
# it.
# output: list of " "filename":"grpname
gen_file_grp_cmd=\
sed -e "s!\(.*/modules[^/]*/\([^/][^/]*\)/.*\)! \1:\2!" \
-e "s!^\([^ ].*/\([^/.]*\)[^/]*$$\)!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)_cfg[_]*!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)cfg[_]*!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)_options[_]*!\1:\2!"
# special vars for generating the list of files or updates
found_lst=$(shell $(find_cfg_files_cmd) | $(gen_file_grp_cmd))
# filtered found lst
f_found_lst=$(call filter_files,$(found_lst))
diff_lst=$(filter-out $(flist),$(f_found_lst))
get_core_files=$(filter-out $(COREPATH)/modules% $(COREPATH)/lib%,$(1))
sort_files=$(sort $(call get_core_files,$(1))) \
$(sort $(filter-out $(call get_core_files,$(1)),$(1)))
# replace $(COREPATH) with the text "$(COREPATH)"
subst_corepath=$(patsubst $(patsubst %/,%,$(COREPATH))/%,\$$(COREPATH)/%,$(1))
# help will be the default rule (on-purpose since without having a patched
# GCC:TranslationUnit module, make all won't work)
.PHONY: help
help:
@echo "To regenerate $(foreach f,$(flist),$(call get_target,$f).{txt,xml})"
@echo "type: $(MAKE) all ."
@echo "or to regenerate all the cfg documentation by searching all"
@echo " the source files for definitions, type: $(MAKE) autogen ."
@echo "NOTE: you need the GCC:TranslationUnit perl module with an "
@echo "extra patch applied (see $(CFG2TXT) --patch)."
.PHONY: txt
txt:
.PHONY: docbook
docbook:
.PHONY: clean_txt
clean_txt:
.PHONY: clean_docbook
clean_docbook:
.PHONY: all
all: txt $(docbook_output_dir)/cfg_var_list.xml
.PHONY: clean
clean: clean_txt clean_docbook
@rm -f $(docbook_output_dir)/cfg_var_list.xml
.PHONY: proper
proper:
@rm -f $(txt_output_dir)/cfg_*.txt
@rm -f $(docbook_output_dir)/cfg_*.xml
repo_ver="kamailio"\
"git-$(shell git rev-parse --verify --short=6 HEAD 2>/dev/null)"
ifeq ($(repo_ver),git-)
repo_ver="kamailio unknown"
endif
$(docbook_output_dir)/cfg_var_list.xml: Makefile \
$(foreach f,$(flist),$(docbook_output_dir)/$(call get_target,$f).xml)
@echo '<?xml version="1.0" encoding="UTF-8"?>' >$@
@echo '<!-- this file is autogenerated, do not edit! -->' >>$@
@echo '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"' >>$@
@echo ' "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"' >>$@
@echo ' [ <!ENTITY % local.common.attrib' >>$@
@echo " \"xmlns:xi CDATA #FIXED 'http://www.w3.org/2001/XInclude'\">]">>$@
@echo '>' >>$@
@echo '<book id="cfg_var_list"'\
'xmlns:xi="http://www.w3.org/2001/XInclude">' >>$@
@echo ' <title>Runtime Configuration Variables List</title>' >>$@
@echo ' <bookinfo>' >>$@
@echo ' <productname class="trade">kamailio.org</productname>' >>$@
@echo ' <authorgroup>' >>$@
@echo ' <author>' >>$@
@echo ' <firstname>Kamailio</firstname>' >>$@
@echo ' <surname>Development Team</surname>' >>$@
@echo ' <affiliation><orgname>https://www.kamailio.org</orgname></affiliation>' >>$@
@echo ' <address>sr-dev@lists.kamailio.org</address>' >>$@
@echo ' </author>' >>$@
@echo ' </authorgroup>' >>$@
@echo ' <copyright>' >>$@
@echo ' <year>2008-2017</year>' >>$@
@echo ' <holder>Kamailio Project</holder>' >>$@
@echo ' </copyright>' >>$@
@echo ' </bookinfo>' >>$@
@$(foreach f,$(flist),\
echo ' <xi:include'\
'href="'$(call get_target,$f).xml'"/>' \
>>$@ ; )
@echo '</book>' >>$@
# finds all the files containing cfg defs
.PHONY: find
find:
@$(find_cfg_files_cmd)
# print the list of the autogenerated files
.PHONY: print-lst
print-lst:
@$(find_cfg_files_cmd) | $(gen_file_grp_cmd)
#
.PHONY: gen-file-list
.PHONY: gen-files_list
.PHONY: gen_files_list
gen-file-list gen-files-list gen_files_list:
@$(foreach f,$(call subst_corepath,$(call sort_files,$(f_found_lst))),\
echo "$f \\";)
.PHONY: check-list
.PHONY: update-list
.PHONY: diff-list
check-list update-list diff-list:
@$(foreach f,$(call subst_corepath,$(call sort_files,$(diff_lst))),\
echo "$f \\";)
# try to generate the docs from all the sources
.PHONY: autogen
autogen:
@$(MAKE) all files_list="$(call sort_files,$(f_found_lst))"
$(foreach f,$(flist),$(eval $(call mk_rules,$(f))))

View file

@ -1,15 +0,0 @@
docs = cfg_var_list.xml
docbook_dir = ../../../docbook
# no subsection listed in the main TOC
xsltproc_flags+= --stringparam toc.section.depth 0
xsltproc_flags+= --stringparam section.autolabel 1
xsltproc_flags+= --stringparam section.label.includes.component.label 1
include $(docbook_dir)/Makefile
# updates to the html generated file
.PHONY: html-update
html-update:
# strip first to lines (xml and doctype constraints)
sed -i '1,2d' $(basename $(docs)).html

View file

@ -1,348 +0,0 @@
COREPATH=../../../src
#include $(COREPATH)/Makefile.defs
CFG2TXT=../../scripts/cdefs2doc/dump_counters.pl
CFG2DOCBOOK=../../scripts/cdefs2doc/dump_counters.pl
# output directory for generated txt files
txt_output_dir=.
# output directory for generated docbook xml files
docbook_output_dir=docbook
# list of files containing counter defs in the following format:
# <filename>:<cfg_grp_name>
# can be easily updated by adding the output of:
# make diff-list (which obeys grp_exclude and file_exclude)
# or completely regenerated by replacing files_list with the output of:
# make gen-files-list
files_list= \
$(COREPATH)/core/resolve.c:resolve \
$(COREPATH)/core/tcp_stats.c:tcp \
$(COREPATH)/modules/cdp/cdp_stats.c:cdp \
$(COREPATH)/modules/db_mysql/db_mysql.c:db_mysql \
$(COREPATH)/modules/ims_charging/ims_charging_stats.c:ims_charging \
$(COREPATH)/modules/ims_dialog/dlg_ng_stats.c:ims_dialog \
$(COREPATH)/modules/ims_qos/ims_qos_stats.c:ims_qos \
$(COREPATH)/modules/ims_usrloc_scscf/ul_scscf_stats.c:ims_usrloc_scscf \
$(COREPATH)/modules/sctp/sctp_stats.c:sctp
# list of excluded groups
grp_exclude=
# list of file prefixes to exclude (full path needed)
file_exclude=$(COREPATH)/obsolete
# special per file group overrides
# format= grp_filename=... ,where filename does not contain the extension
# e.g.:
# grp_f_tcp_stats=tcp
# grp_f_sctp_stats=sctp
# special per group group name overrides
# e.g.:
# grp_g_maxfwd=mf
grp_g_resolve=dns
grp_g_db_mysql=mysql
# override auto-detected group if set to 1 (else the group is used inside the
# file only if it cannot be autodetected)
ifeq ($(group_override),1)
override force_grp=force-
else
override force_grp=
endif
# command used for gcc (contains extra includes)
gcc=gcc
#-I$(COREPATH)/lib -I$(COREPATH) -I/usr/include/libxml2
# defines used by gcc
c_defs=-DNAME='\"kamailio\"' -DVERSION='\"5.1.0-dev3\"' -DARCH='\"x86_64\"' \
-DOS='linux_' -DOS_QUOTED='\"linux\"' -DCOMPILER='\"gcc 4.9.2\"' \
-D__CPU_x86_64 -D__OS_linux -DSER_VER=5001000 \
-DCFG_DIR='\"/usr/local/etc/kamailio/\"' \
-DRUN_DIR='\"/run/kamailio/\"' -DPKG_MALLOC -DSHM_MEM -DSHM_MMAP \
-DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE -DHAVE_RESOLV_RES \
-DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLOCKLIST -DUSE_NAPTR \
-DMEM_JOIN_FREE -DF_MALLOC -DQ_MALLOC -DTLSF_MALLOC \
-DDBG_SR_MEMORY -DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS \
-DMALLOC_STATS -DWITH_AS_SUPPORT -DUSE_SCTP -DFAST_LOCK -DADAPTIVE_WAIT \
-DADAPTIVE_WAIT_LOOPS=1024 -DCC_GCC_LIKE_ASM -DHAVE_GETHOSTBYNAME2 \
-DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL \
-DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM \
-DHAVE_SCHED_SETSCHEDULER -DHAVE_IP_MREQN -DHAVE_EPOLL -DHAVE_SIGIO_RT \
-DSIGINFO64_WORKAROUND -DUSE_FUTEX -DHAVE_SELECT
# common makefile vars used in defs
LOCALBASE=/usr/local
SYSBASE=/usr
filter_files=$(filter-out $(addsuffix %,$(file_exclude)),\
$(filter-out $(addprefix %:,$(grp_exclude)),$(1)))
#filtered files list
flist=$(call filter_files,$(files_list))
# throws an error if input is not in the format filename:grp
check_fname_grp=$(if $(filter-out 2,$(words $(subst :, ,$(1)))),\
$(error bad format "$(1)", it should be filename:grp))
# get prereq from file:grp (get_prereq(file:grp) => file)
get_prereq=$(firstword $(subst :, ,$(1)))
# get grp from file:grp (get_grp(file:grp) => grp)
get_listed_grp=$(word 2, $(subst :, ,$(1)))
# get base file name from file:grp: get_bname(file:grp)
# => basename(file) without extension (e.g. get_bname(foo/bar.c:x) => bar)
#
get_bname=$(basename $(notdir $(call get_prereq,$(1))))
#get grp from file:grp, using the overrides
get_grp=$(strip $(if $(grp_f_$(call get_bname,$(1))), \
$(grp_f_$(call get_bname,$(1))),\
$(if $(grp_g_$(call get_listed_grp,$(1))),\
$(grp_g_$(call get_listed_grp,$(1))),\
$(call get_listed_grp,$(1))) ) )
# get target from file:grp (get_target(file:grp) => counter_grp.txt)
get_target=counters_$(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;b end}' \
-e '/^\(ifeq\|ifneq\|else\|endif\)[\t ]\+.*[\]$$/,/[^\]$$/{H;b end}' \
-e '/^[a-zA-Z._/$$][a-zA-Z0-9._()/$$ \t-]*:\([^=]\|$$\)/b eat_rule' \
-e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*[^\]$$/{H;b end}' \
-e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*\\$$/,/\(^$$\)\|\([^\]$$\)/{H;b end}' \
-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 counter_$$(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=../../../src
# 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 \
--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 \
--defs="$(c_defs) $$(e_idefs_$$(call get_grp,$(1)))" \
> "$$@" || (rm -f "$$@"; exit 1)
clean_$$(call get_target,$(1)).txt:
rm -f "$(txt_output_dir)/$$(call get_target,$(1)).txt"
clean_$$(call get_target,$(1)).xml:
rm -f "$(docbook_output_dir)/$$(call get_target,$(1)).xml"
txt: $(txt_output_dir)/$$(call get_target,$(1)).txt
docbook: $(docbook_output_dir)/$$(call get_target,$(1)).xml
clean_txt: clean_$$(call get_target,$(1)).txt
clean_docbook: clean_$$(call get_target,$(1)).xml
endef
find_counter_files_cmd= find $(COREPATH) -type f -name "*.c" \
-exec grep "counter_def_t[ ][ ]*[a-zA-Z0-9_][a-zA-Z0-9_]*\[\][ ]*=" /dev/null {} \; \
| cut -d: -f1
# shell command to generate a file:grp list from a list of files
# grp will be the modulename if the file is in a module directory or
# the file name with the extension and _cnt, cnt_, _stats, stats_,
# _cnts, or cnts_ stripped out of
# it.
# output: list of " "filename":"grpname
gen_file_grp_cmd=\
sed -e "s!\(.*/modules[^/]*/\([^/][^/]*\)/.*\)! \1:\2!" \
-e "s!^\([^ ].*/\([^/.]*\)[^/]*$$\)!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)_cnts\?[_]*!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)cnts\?[_]*!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)_stats[_]*!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)stats[_]*!\1:\2!"
# special vars for generating the list of files or updates
found_lst=$(shell $(find_counter_files_cmd) | $(gen_file_grp_cmd))
# filtered found lst
f_found_lst=$(call filter_files,$(found_lst))
diff_lst=$(filter-out $(flist),$(f_found_lst))
get_core_files=$(filter-out $(COREPATH)/modules% $(COREPATH)/lib%,$(1))
sort_files=$(sort $(call get_core_files,$(1)))\
$(sort $(filter-out $(call get_core_files,$(1)),$(1)))
# replace $(COREPATH) with the text "$(COREPATH)"
subst_corepath=$(patsubst $(patsubst %/,%,$(COREPATH))/%,\$$(COREPATH)/%,$(1))
# help will be the default rule (on-purpose since without having a patched
# GCC:TranslationUnit module, make all won't work)
.PHONY: help
help:
@echo "To regenerate $(foreach f,$(flist),$(call get_target,$f).{txt,xml})"
@echo "type: $(MAKE) all ."
@echo "or to regenerate all the counter lists by searching all"
@echo " the source files for definitions, type: $(MAKE) autogen ."
@echo "NOTE: you need the GCC:TranslationUnit perl module with an "
@echo "extra patch applied (see $(CFG2TXT) --patch)."
.PHONY: txt
txt:
.PHONY: docbook
docbook:
.PHONY: clean_txt
clean_txt:
.PHONY: clean_docbook
clean_docbook:
.PHONY: all
all: txt $(docbook_output_dir)/counter_list.xml
.PHONY: clean
clean: clean_txt clean_docbook
@rm -f $(docbook_output_dir)/counter_list.xml
.PHONY: proper
proper:
@rm -f $(txt_output_dir)/counters_*.txt
@rm -f $(docbook_output_dir)/counters_*.xml
repo_ver="sip-router"\
"git-$(shell git rev-parse --verify --short=6 HEAD 2>/dev/null)"
ifeq ($(repo_ver),git-)
repo_ver="sip-router unknown"
endif
$(docbook_output_dir)/counter_list.xml: Makefile \
$(foreach f,$(flist),$(docbook_output_dir)/$(call get_target,$f).xml)
@echo '<?xml version="1.0" encoding="UTF-8"?>' >$@
@echo '<!-- this file is autogenerated, do not edit! -->' >>$@
@echo '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"' >>$@
@echo ' "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"' >>$@
@echo ' [ <!ENTITY % local.common.attrib' >>$@
@echo " \"xmlns:xi CDATA #FIXED 'http://www.w3.org/2001/XInclude'\">]">>$@
@echo '>' >>$@
@echo '<book id="counter_list"'\
'xmlns:xi="http://www.w3.org/2001/XInclude">' >>$@
@echo ' <title>Counter List</title>' >>$@
@echo ' <bookinfo>' >>$@
@echo ' <productname class="trade">kamailio.org</productname>' >>$@
@echo ' <authorgroup>' >>$@
@echo ' <author>' >>$@
@echo ' <firstname>Kamailio</firstname>' >>$@
@echo ' <surname>Development Team</surname>' >>$@
@echo ' <affiliation><orgname>https://www.kamailio.org</orgname></affiliation>' >>$@
@echo ' <address>sr-dev@lists.kamailio.org</address>' >>$@
@echo ' </author>' >>$@
@echo ' </authorgroup>' >>$@
@echo ' <copyright>' >>$@
@echo ' <year>2008-2017</year>' >>$@
@echo ' <holder>Kamailio Project</holder>' >>$@
@echo ' </copyright>' >>$@
@echo ' </bookinfo>' >>$@
@$(foreach f,$(flist),\
echo ' <xi:include'\
'href="'$(call get_target,$f).xml'"/>' \
>>$@ ; )
@echo '</book>' >>$@
# finds all the files containing cfg defs
.PHONY: find
find:
@$(find_counter_files_cmd)
# print the list of the autogenerated files
.PHONY: print-lst
print-lst:
@$(find_counter_files_cmd) | $(gen_file_grp_cmd)
#
.PHONY: gen-file-list
.PHONY: gen-files_list
.PHONY: gen_files_list
gen-file-list gen-files-list gen_files_list:
@$(foreach f,$(call subst_corepath,$(call sort_files,$(f_found_lst))),\
echo "$f \\";)
.PHONY: check-list
.PHONY: update-list
.PHONY: diff-list
check-list update-list diff-list:
@$(foreach f,$(call subst_corepath,$(call sort_files,$(diff_lst))),\
echo "$f \\";)
# try to generate the docs from all the sources
.PHONY: autogen
autogen:
@$(MAKE) all files_list="$(call sort_files,$(f_found_lst))"
$(foreach f,$(flist),$(eval $(call mk_rules,$(f))))

View file

@ -1,15 +0,0 @@
docs = counter_list.xml
docbook_dir = ../../../docbook
# no subsection listed in the main TOC
xsltproc_flags+= --stringparam toc.section.depth 0
xsltproc_flags+= --stringparam section.autolabel 1
xsltproc_flags+= --stringparam section.label.includes.component.label 1
include $(docbook_dir)/Makefile
# updates to the html generated file
.PHONY: html-update
html-update:
# strip first to lines (xml and doctype constraints)
sed -i '1,2d' $(basename $(docs)).html

View file

@ -1,4 +0,0 @@
docs = presence_book.xml
docbook_dir = ../../docbook
include $(docbook_dir)/Makefile

View file

@ -1,4 +0,0 @@
docs = kamailio_rpc.xml
docbook_dir = ../../docbook
include $(docbook_dir)/Makefile

View file

@ -1,431 +0,0 @@
COREPATH=../../../src
#include $(COREPATH)/Makefile.defs
CFG2TXT=../../scripts/cdefs2doc/dump_rpcs.pl
CFG2DOCBOOK=../../scripts/cdefs2doc/dump_rpcs.pl
# output directory for generated txt files
txt_output_dir=.
# output directory for generated docbook xml files
docbook_output_dir=docbook
# list of files containing rpc defs in the following format:
# <filename>:<cfg_grp_name>
# can be easily updated by adding the output of:
# make diff-list (which obeys grp_exclude and file_exclude)
# or completely regenerated by replacing files_list with the output of:
# make gen-files-list
# NOTE: suffix duplicated modules located in modules_s with '_s' to
# avoid file naming conflicts
#
files_list= \
$(COREPATH)/core/core_cmd.c:core \
$(COREPATH)/modules/app_jsdt/app_jsdt_api.c:app_jsdt \
$(COREPATH)/modules/app_lua/app_lua_mod.c:app_lua \
$(COREPATH)/modules/app_perl/app_perl_mod.c:app_perl \
$(COREPATH)/modules/app_sqlang/app_sqlang_api.c:app_sqlang \
$(COREPATH)/modules/auth_ephemeral/auth_ephemeral_mod.c:auth_ephemeral \
$(COREPATH)/modules/auth_xkeys/auth_xkeys.c:auth_xkeys \
$(COREPATH)/modules/benchmark/benchmark.c:benchmark \
$(COREPATH)/modules/call_obj/call_obj_mod.c:call_obj \
$(COREPATH)/modules/carrierroute/carrierroute.c:carrierroute \
$(COREPATH)/modules/cdp/cdp_rpc.c:cdp \
$(COREPATH)/modules/cfg_rpc/cfg_rpc.c:cfg_rpc \
$(COREPATH)/modules/cfgt/cfgt_int.c:cfgt \
$(COREPATH)/modules/cfgutils/cfgutils.c:cfgutils \
$(COREPATH)/modules/cnxcc/cnxcc_mod.c:cnxcc \
$(COREPATH)/modules/corex/corex_rpc.c:corex \
$(COREPATH)/modules/counters/counters.c:counters \
$(COREPATH)/modules/cplc/cpl_loader.c:cplc \
$(COREPATH)/modules/ctl/ctl.c:ctl \
$(COREPATH)/modules/db_flatstore/flat_rpc.c:db_flatstore \
$(COREPATH)/modules/db_flatstore/km_flatstore_mod.c:db_flatstore \
$(COREPATH)/modules/db_text/db_text.c:db_text \
$(COREPATH)/modules/debugger/debugger_api.c:debugger \
$(COREPATH)/modules/dialog/dialog.c:dialog \
$(COREPATH)/modules/dialplan/dialplan.c:dialplan \
$(COREPATH)/modules/dispatcher/dispatcher.c:dispatcher \
$(COREPATH)/modules/dmq/dmq.c:dmq \
$(COREPATH)/modules/domain/domain_mod.c:domain \
$(COREPATH)/modules/drouting/drouting.c:drouting \
$(COREPATH)/modules/htable/htable.c:htable \
$(COREPATH)/modules/http_client/curlrpc.c:http_client \
$(COREPATH)/modules/imc/imc.c:imc \
$(COREPATH)/modules/ims_dialog/ims_dialog.c:ims_dialog \
$(COREPATH)/modules/ims_registrar_scscf/reg_rpc.c:ims_registrar_scscf \
$(COREPATH)/modules/ims_usrloc_pcscf/ul_rpc.c:ims_usrloc_pcscf \
$(COREPATH)/modules/ims_usrloc_scscf/ul_rpc.c:ims_usrloc_scscf \
$(COREPATH)/modules/jsonrpcs/jsonrpcs_mod.c:jsonrpcs \
$(COREPATH)/modules/keepalive/keepalive_rpc.c:keepalive \
$(COREPATH)/modules/kex/core_stats.c:kex \
$(COREPATH)/modules/kex/mod_stats.c:kex \
$(COREPATH)/modules/kex/pkg_stats.c:kex \
$(COREPATH)/modules/lcr/lcr_rpc.c:lcr \
$(COREPATH)/modules/malloc_test/malloc_test.c:malloc_test \
$(COREPATH)/modules/matrix/matrix.c:matrix \
$(COREPATH)/modules/mqueue/mqueue_mod.c:mqueue \
$(COREPATH)/modules/msrp/msrp_cmap.c:msrp \
$(COREPATH)/modules/mtree/mtree_mod.c:mtree \
$(COREPATH)/modules/nathelper/nathelper.c:nathelper \
$(COREPATH)/modules/pdb/pdb.c:pdb \
$(COREPATH)/modules/pdt/pdt.c:pdt \
$(COREPATH)/modules/permissions/permissions.c:permissions \
$(COREPATH)/modules/pike/pike_rpc.c:pike \
$(COREPATH)/modules/pipelimit/pipelimit.c:pipelimit \
$(COREPATH)/modules/prefix_route/pr_rpc.c:prefix_route \
$(COREPATH)/modules/presence/presence.c:presence \
$(COREPATH)/modules/pua/pua.c:pua \
$(COREPATH)/modules/pua_rpc/pua_rpc.c:pua_rpc \
$(COREPATH)/modules/pv/pv.c:pv \
$(COREPATH)/modules/ratelimit/ratelimit.c:ratelimit \
$(COREPATH)/modules/regex/regex_mod.c:regex \
$(COREPATH)/modules/rls/rls.c:rls \
$(COREPATH)/modules/rtpengine/rtpengine.c:rtpengine \
$(COREPATH)/modules/rtpproxy/rtpproxy.c:rtpproxy \
$(COREPATH)/modules/sca/sca.c:sca \
$(COREPATH)/modules/sctp/sctp_rpc.c:sctp \
$(COREPATH)/modules/sipcapture/sipcapture.c:sipcapture \
$(COREPATH)/modules/siptrace/siptrace.c:siptrace \
$(COREPATH)/modules/sl/sl_stats.c:sl \
$(COREPATH)/modules/statsc/statsc_mod.c:statsc \
$(COREPATH)/modules/tls/tls_rpc.c:tls \
$(COREPATH)/modules/tm/tm.c:tm \
$(COREPATH)/modules/tsilo/ts_rpc.c:tsilo \
$(COREPATH)/modules/uac/uac_reg.c:uac \
$(COREPATH)/modules/uid_domain/domain_rpc.c:uid_domain \
$(COREPATH)/modules/uid_gflags/uid_gflags.c:uid_gflags \
$(COREPATH)/modules/userblacklist/userblacklist.c:userblacklist \
$(COREPATH)/modules/usrloc/ul_rpc.c:usrloc \
$(COREPATH)/modules/websocket/websocket.c:websocket \
$(COREPATH)/modules/xcap_client/xcap_client.c:xcap_client \
$(COREPATH)/modules/xhttp_pi/xhttp_pi.c:xhttp_pi
# list of excluded groups
grp_exclude=pa
# list of file prefixes to exclude (full path needed)
file_exclude=$(COREPATH)/obsolete
# special per file group overrides
# format= grp_filename=... ,where filename does not contain the extension
# e.g.:
# grp_f_tcp_options=tcp
# grp_f_sctp_options=sctp
# special per group group name overrides
# e.g.:
# grp_g_maxfwd=mf
# override auto-detected group if set to 1 (else the group is used inside the
# file only if it cannot be aut-odetected)
ifeq ($(group_override),1)
override force_grp=force-
else
override force_grp=
endif
# command used for gcc (contains extra includes)
gcc=gcc
#-I$(COREPATH)/lib -I$(COREPATH) -I/usr/include/libxml2
# defines used by gcc
c_defsX=-DNAME='\"kamailio\"' -DVERSION='\"5.1.0-dev3\"' -DARCH='\"x86_64\"' \
-DOS='linux_' -DOS_QUOTED='\"linux\"' -DCOMPILER='\"gcc 4.9.2\"' \
-D__CPU_x86_64 -D__OS_linux -DSER_VER=5001000 \
-DCFG_DIR='\"/usr/local/etc/kamailio/\"' \
-DRUN_DIR='\"/run/kamailio/\"' -DPKG_MALLOC -DSHM_MEM -DSHM_MMAP \
-DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE -DHAVE_RESOLV_RES \
-DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLOCKLIST -DUSE_NAPTR \
-DMEM_JOIN_FREE -DF_MALLOC -DQ_MALLOC -DTLSF_MALLOC \
-DDBG_SR_MEMORY -DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS \
-DMALLOC_STATS -DWITH_AS_SUPPORT -DUSE_SCTP -DFAST_LOCK -DADAPTIVE_WAIT \
-DADAPTIVE_WAIT_LOOPS=1024 -DCC_GCC_LIKE_ASM -DHAVE_GETHOSTBYNAME2 \
-DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL \
-DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM \
-DHAVE_SCHED_SETSCHEDULER -DHAVE_IP_MREQN -DHAVE_EPOLL -DHAVE_SIGIO_RT \
-DSIGINFO64_WORKAROUND -DUSE_FUTEX -DHAVE_SELECT
c_defs=$(subst ^^,='\",$(subst ",\"',$(subst =",^^,$(shell $(MAKE) -s -C ../../../src printcdefs))))
c_defs+= -DMOD_NAME='\"rpcgen\"'
c_defs+= -I$(COREPATH)/modules/app_sqlang/squirrel/include
# common makefile vars used in defs
LOCALBASE=/usr/local
SYSBASE=/usr
filter_files=$(filter-out $(addsuffix %,$(file_exclude)),\
$(filter-out $(addprefix %:,$(grp_exclude)),$(1)))
#filtered files list
flist=$(call filter_files,$(files_list))
# throws an error if input is not in the format filename:grp
check_fname_grp=$(if $(filter-out 2,$(words $(subst :, ,$(1)))),\
$(error bad format "$(1)", it should be filename:grp))
# get prereq from file:grp (get_prereq(file:grp) => file)
get_prereq=$(firstword $(subst :, ,$(1)))
# get grp from file:grp (get_grp(file:grp) => grp)
get_listed_grp=$(word 2, $(subst :, ,$(1)))
# get module interface define
get_modiface=$(word 3, $(subst :, ,$(1)))
find_modiface=$(if $(findstring modules,$(1)),$(shell $(MAKE) -s -C $(dir $(1)) printmiface),-DNONE)
# get base file name from file:grp: get_bname(file:grp)
# => basename(file) without extension (e.g. get_bname(foo/bar.c:x) => bar)
#
get_bname=$(basename $(notdir $(call get_prereq,$(1))))
#get grp from file:grp, using the overrides
get_grp=$(strip $(if $(grp_f_$(call get_bname,$(1))), \
$(grp_f_$(call get_bname,$(1))),\
$(if $(grp_g_$(call get_listed_grp,$(1))),\
$(grp_g_$(call get_listed_grp,$(1))),\
$(call get_listed_grp,$(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.
# 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;b end}' \
-e '/^\(ifeq\|ifneq\|else\|endif\)[\t ]\+.*[\]$$/,/[^\]$$/{H;b end}' \
-e '/^[a-zA-Z._/$$][a-zA-Z0-9._()/$$ \t-]*:\([^=]\|$$\)/b eat_rule' \
-e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*[^\]$$/{H;b end}' \
-e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*\\$$/,/\(^$$\)\|\([^\]$$\)/{H;b end}' \
-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 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)))))
# override COREPATH (we know better)
COREPATH=../../../src
# 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 \
--defs="$(c_defs) $$(call get_modiface,$(1)) $$(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 \
--defs="$(c_defs) $$(e_idefs_$$(call get_grp,$(1)))" \
> "$$@" || (rm -f "$$@"; exit 1)
clean_$$(call get_target,$(1)).txt:
rm -f "$(txt_output_dir)/$$(call get_target,$(1)).txt"
clean_$$(call get_target,$(1)).xml:
rm -f "$(docbook_output_dir)/$$(call get_target,$(1)).xml"
txt: $(txt_output_dir)/$$(call get_target,$(1)).txt
docbook: $(docbook_output_dir)/$$(call get_target,$(1)).xml
clean_txt: clean_$$(call get_target,$(1)).txt
clean_docbook: clean_$$(call get_target,$(1)).xml
endef
find_rpc_files_cmd= find $(COREPATH) -type f -name "*.c" \
-exec grep "rpc_export_t[ ][a-zA-Z0-9_]*\[\][ ]*=" /dev/null {} \; \
| cut -d: -f1
# shell command to generate a file:grp list from a list of files
# grp will be the modulename if the file is in a module directory or
# the file name with the extension and _cmd, cmd_ or _rpc stripped out of
# it.
# output: list of " "filename":"grpname
gen_file_grp_cmd=\
sed -e "s!\(.*/modules[^/]*/\([^/][^/]*\)/.*\)! \1:\2!" \
-e "s!^\([^ ].*/\([^/.]*\)[^/]*$$\)!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)_cmd[_]*!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)cmd[_]*!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)_rpc[_]*!\1:\2!"
# special vars for generating the list of files or updates
found_lst=$(shell $(find_rpc_files_cmd) | $(gen_file_grp_cmd))
# filtered found lst
f_found_lst=$(call filter_files,$(found_lst))
diff_lst=$(filter-out $(flist),$(f_found_lst))
get_core_files=$(filter-out $(COREPATH)/modules% $(COREPATH)/lib%,$(1))
sort_files=$(sort $(call get_core_files,$(1)))\
$(sort $(filter-out $(call get_core_files,$(1)),$(1)))
# replace $(COREPATH) with the text "$(COREPATH)"
subst_corepath=$(patsubst $(patsubst %/,%,$(COREPATH))/%,\$$(COREPATH)/%,$(1))
# help will be the default rule (on-purpose since without having a patched
# GCC:TranslationUnit module, make all won't work)
.PHONY: help
help:
@echo "To regenerate $(foreach f,$(flist),$(call get_target,$f).{txt,xml})"
@echo "type: $(MAKE) all ."
@echo "or to regenerate all the rpc lists by searching all"
@echo " the source files for definitions, type: $(MAKE) autogen ."
@echo "NOTE: you need the GCC:TranslationUnit perl module with an "
@echo "extra patch applied (see $(CFG2TXT) --patch)."
.PHONY: txt
txt:
.PHONY: docbook
docbook:
.PHONY: clean_txt
clean_txt:
.PHONY: clean_docbook
clean_docbook:
.PHONY: all
all: txt $(docbook_output_dir)/rpc_list.xml
.PHONY: clean
clean: clean_txt clean_docbook
@rm -f $(docbook_output_dir)/rpc_list.xml
.PHONY: proper
proper:
@rm -f $(txt_output_dir)/rpc_*.txt
@rm -f $(docbook_output_dir)/rpc_*.xml
repo_ver="Kamailio "\
"git-$(shell git rev-parse --verify --short=6 HEAD 2>/dev/null)"
ifeq ($(repo_ver),git-)
repo_ver="Kamailio unknown"
endif
$(docbook_output_dir)/rpc_list.xml: Makefile \
$(foreach f,$(flist),$(docbook_output_dir)/$(call get_target,$f).xml)
@echo '<?xml version="1.0" encoding="UTF-8"?>' >$@
@echo '<!-- this file is autogenerated, do not edit! -->' >>$@
@echo '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"' >>$@
@echo ' "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"' >>$@
@echo ' [ <!ENTITY % local.common.attrib' >>$@
@echo " \"xmlns:xi CDATA #FIXED 'http://www.w3.org/2001/XInclude'\">]">>$@
@echo '>' >>$@
@echo '<book id="rpc_list"'\
'xmlns:xi="http://www.w3.org/2001/XInclude">' >>$@
@echo ' <title>RPC Commands List</title>' >>$@
@echo ' <bookinfo>' >>$@
@echo ' <productname class="trade">kamailio.org</productname>' >>$@
@echo ' <authorgroup>' >>$@
@echo ' <author>' >>$@
@echo ' <firstname>Kamailio</firstname>' >>$@
@echo ' <surname>Development Team</surname>' >>$@
@echo ' <affiliation><orgname>https://www.kamailio.org</orgname></affiliation>' >>$@
@echo ' <address>sr-dev@lists.kamailio.org</address>' >>$@
@echo ' </author>' >>$@
@echo ' </authorgroup>' >>$@
@echo ' <copyright>' >>$@
@echo ' <year>2008-2017</year>' >>$@
@echo ' <holder>Kamailio Project</holder>' >>$@
@echo ' </copyright>' >>$@
@echo ' </bookinfo>' >>$@
@$(foreach f,$(flist),\
echo ' <xi:include'\
'href="'$(call get_target,$f).xml'"/>' \
>>$@ ; )
@echo '</book>' >>$@
# finds all the files containing cfg defs
.PHONY: find
find:
@$(find_rpc_files_cmd)
# print the list of the autogenerated files
.PHONY: print-lst
print-lst:
@$(find_rpc_files_cmd) | $(gen_file_grp_cmd)
#
.PHONY: gen-file-list
.PHONY: gen-files_list
.PHONY: gen_files_list
gen-file-list gen-files-list gen_files_list:
@$(foreach f,$(call subst_corepath,$(call sort_files,$(f_found_lst))),\
echo "$f \\";)
print-modifaces:
@$(foreach f,$(call sort_files,$(f_found_lst)),\
echo "$(call subst_corepath,$(f)):$(call find_modiface, $(f)) \\";)
.PHONY: check-list
.PHONY: update-list
.PHONY: diff-list
check-list update-list diff-list:
@$(foreach f,$(call subst_corepath,$(call sort_files,$(diff_lst))),\
echo "$f \\";)
# try to generate the docs from all the sources
.PHONY: autogen
autogen:
@$(MAKE) all files_list="$(call sort_files,$(f_found_lst))"
$(foreach f,$(flist),$(eval $(call mk_rules,$(f))))

View file

@ -1,15 +0,0 @@
docs = rpc_list.xml
docbook_dir = ../../../docbook
# no subsection listed in the main TOC
xsltproc_flags+= --stringparam toc.section.depth 0
xsltproc_flags+= --stringparam section.autolabel 1
xsltproc_flags+= --stringparam section.label.includes.component.label 1
include $(docbook_dir)/Makefile
# updates to the html generated file
.PHONY: html-update
html-update:
# strip first to lines (xml and doctype constraints)
sed -i '1,2d' $(basename $(docs)).html

View file

@ -1,353 +0,0 @@
COREPATH=../../../src
#include $(COREPATH)/Makefile.defs
CFG2TXT=../../scripts/cdefs2doc/dump_selects.pl
CFG2DOCBOOK=../../scripts/cdefs2doc/dump_selects.pl
# extra generators options
# use select_core.c to resolve possible chained select
CFG2TXT_EXTRA_OPTS=--core $(COREPATH)/core/select_core.c
CFG2DOCBOOK_EXTRA_OPTS=--core $(COREPATH)/core/select_core.c
# output directory for generated txt files
txt_output_dir=.
# output directory for generated docbook xml files
docbook_output_dir=docbook
# list of files containing selects defs in the following format:
# <filename>:<sel_grp_name>
# can be easily updated by adding the output of:
# make diff-list (which obeys grp_exclude and file_exclude)
# or completely regenerated by replacing files_list with the output of:
# make gen-files-list
files_list= \
$(COREPATH)/core/select_core.c:core \
$(COREPATH)/modules/avp/avp.c:avp \
$(COREPATH)/modules/cnxcc/cnxcc_mod.c:cnxcc \
$(COREPATH)/modules/db2_ops/db2_ops.c:db2_ops \
$(COREPATH)/modules/nathelper/nathelper.c:nathelper \
$(COREPATH)/modules/textopsx/textopsx.c:textopsx \
$(COREPATH)/modules/timer/timer.c:timer \
$(COREPATH)/modules/tls/tls_select.c:tls \
$(COREPATH)/modules/tm/select.c:tm \
$(COREPATH)/modules/xmlrpc/xmlrpc.c:xmlrpc
grp_exclude=pa iptrtpproxy
# list of file prefixes to exclude (full path needed)
file_exclude= $(COREPATH)/obsolete/
# special per file group overrides
# format= grp_filename=... ,where filename does not contain the extension
# e.g.:
# grp_f_tcp_options=tcp
# grp_f_sctp_options=sctp
# special per group group name overrides
# e.g.:
# grp_g_maxfwd=mf
# override auto-detected group if set to 1 (else the group is used inside the
# file only if it cannot be aut-odetected)
ifeq ($(group_override),1)
override force_grp=force-
else
override force_grp=
endif
# command used for gcc (contains extra includes)
gcc=gcc
#-I$(COREPATH)/lib -I$(COREPATH) -I/usr/include/libxml2
# defines used by gcc
c_defs=-DNAME='\"kamailio\"' -DVERSION='\"5.1.0-dev3\"' -DARCH='\"x86_64\"' \
-DOS='linux_' -DOS_QUOTED='\"linux\"' -DCOMPILER='\"gcc 4.9.2\"' \
-D__CPU_x86_64 -D__OS_linux -DSER_VER=5001000 \
-DCFG_DIR='\"/usr/local/etc/kamailio/\"' \
-DRUN_DIR='\"/run/kamailio/\"' -DPKG_MALLOC -DSHM_MEM -DSHM_MMAP \
-DDNS_IP_HACK -DUSE_MCAST -DUSE_TCP -DDISABLE_NAGLE -DHAVE_RESOLV_RES \
-DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLOCKLIST -DUSE_NAPTR \
-DMEM_JOIN_FREE -DF_MALLOC -DQ_MALLOC -DTLSF_MALLOC \
-DDBG_SR_MEMORY -DUSE_TLS -DTLS_HOOKS -DUSE_CORE_STATS -DSTATISTICS \
-DMALLOC_STATS -DWITH_AS_SUPPORT -DUSE_SCTP -DFAST_LOCK -DADAPTIVE_WAIT \
-DADAPTIVE_WAIT_LOOPS=1024 -DCC_GCC_LIKE_ASM -DHAVE_GETHOSTBYNAME2 \
-DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD -DHAVE_MSG_NOSIGNAL \
-DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H -DHAVE_TIMEGM \
-DHAVE_SCHED_SETSCHEDULER -DHAVE_IP_MREQN -DHAVE_EPOLL -DHAVE_SIGIO_RT \
-DSIGINFO64_WORKAROUND -DUSE_FUTEX -DHAVE_SELECT
# 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))) )
#filtered files list
flist=$(call filter_files,$(files_list))
# throws an error if input is not in the format filename:grp
check_fname_grp=$(if $(filter-out 2,$(words $(subst :, ,$(1)))),\
$(error bad format "$(1)", it should be filename:grp))
# get prereq from file:grp (get_prereq(file:grp) => file)
get_prereq=$(firstword $(subst :, ,$(1)))
# get grp from file:grp (get_grp(file:grp) => grp)
get_listed_grp=$(word 2, $(subst :, ,$(1)))
# get base file name from file:grp: get_bname(file:grp)
# => basename(file) without extension (e.g. get_bname(foo/bar.c:x) => bar)
#
get_bname=$(basename $(notdir $(call get_prereq,$(1))))
#get grp from file:grp, using the overrides
get_grp=$(strip $(if $(grp_f_$(call get_bname,$(1))), \
$(grp_f_$(call get_bname,$(1))),\
$(if $(grp_g_$(call get_listed_grp,$(1))),\
$(grp_g_$(call get_listed_grp,$(1))),\
$(call get_listed_grp,$(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;b end}' \
-e '/^\(ifeq\|ifneq\|else\|endif\)[\t ]\+.*[\]$$/,/[^\]$$/{H;b end}' \
-e '/^[a-zA-Z._/$$][a-zA-Z0-9._()/$$ \t-]*:\([^=]\|$$\)/b eat_rule' \
-e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*[^\]$$/{H;b end}' \
-e '/^[\t ]*[A-Za-z._][A-Za-z0-9._-]*[\t ]*[+:]\?=.*\\$$/,/\(^$$\)\|\([^\]$$\)/{H;b end}' \
-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=../../../src
# 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) \
--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) \
--defs="$(c_defs) $$(e_idefs_$$(call get_grp,$(1)))" \
> "$$@" || (rm -f "$$@"; exit 1)
clean_$$(call get_target,$(1)).txt:
rm -f "$(txt_output_dir)/$$(call get_target,$(1)).txt"
clean_$$(call get_target,$(1)).xml:
rm -f "$(docbook_output_dir)/$$(call get_target,$(1)).xml"
txt: $(txt_output_dir)/$$(call get_target,$(1)).txt
docbook: $(docbook_output_dir)/$$(call get_target,$(1)).xml
clean_txt: clean_$$(call get_target,$(1)).txt
clean_docbook: clean_$$(call get_target,$(1)).xml
endef
find_sel_files_cmd= find $(COREPATH) -type f -name "*.[ch]" \
-exec grep "select_row_t[ ][a-zA-Z0-9_][a-zA-Z0-9_]*\[\][ ]*=" \
/dev/null {} \; \
| cut -d: -f1
# shell command to generate a file:grp list from a list of files
# grp will be the modulename if the file is in a module directory or
# the file name with the extension and _sel, sel_, select_, _select,
# _declaration or _table stripped out of it.
# output: list of " "filename":"grpname
gen_file_grp_cmd=\
sed -e "s!\(.*/modules[^/]*/\([^/][^/]*\)/.*\)! \1:\2!" \
-e "s!^\([^ ].*/\([^/.]*\)[^/]*$$\)!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)_select[_]*!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)select[_]*!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)_declaration[_]*!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)_table[_]*!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)_sel[_]*!\1:\2!" \
-e "s!^\([^ :]*\):\(.*\)sel[_]*!\1:\2!" \
# special vars for generating the list of files or updates
found_lst=$(shell $(find_sel_files_cmd) | $(gen_file_grp_cmd))
# filtered found lst
f_found_lst=$(call filter_files,$(found_lst))
diff_lst=$(filter-out $(flist),$(f_found_lst))
get_core_files=$(filter-out $(COREPATH)/modules% $(COREPATH)/lib%,$(1))
sort_files=$(sort $(call get_core_files,$(1)))\
$(sort $(filter-out $(call get_core_files,$(1)),$(1)))
# replace $(COREPATH) with the text "$(COREPATH)"
subst_corepath=$(patsubst $(patsubst %/,%,$(COREPATH))/%,\$$(COREPATH)/%,$(1))
# help will be the default rule (on-purpose since without having a patched
# GCC:TranslationUnit module, make all won't work)
.PHONY: help
help:
@echo "To regenerate $(foreach f,$(flist),$(call get_target,$f).{txt,xml})"
@echo "type: $(MAKE) all ."
@echo "or to regenerate all the select lists by searching all"
@echo " the source files for definitions, type: $(MAKE) autogen ."
@echo "NOTE: you need the GCC:TranslationUnit perl module with an "
@echo "extra patch applied (see $(CFG2TXT) --patch)."
.PHONY: txt
txt:
.PHONY: docbook
docbook:
.PHONY: clean_txt
clean_txt:
.PHONY: clean_docbook
clean_docbook:
.PHONY: all
all: txt $(docbook_output_dir)/select_list.xml
.PHONY: clean
clean: clean_txt clean_docbook
@rm -f $(docbook_output_dir)/select_list.xml
.PHONY: proper
proper:
@rm -f $(txt_output_dir)/select_*.txt
@rm -f $(docbook_output_dir)/select_*.xml
repo_ver="sip-router"\
"git-$(shell git rev-parse --verify --short=6 HEAD 2>/dev/null)"
ifeq ($(repo_ver),git-)
repo_ver="sip-router unknown"
endif
$(docbook_output_dir)/select_list.xml: Makefile \
$(foreach f,$(flist),$(docbook_output_dir)/$(call get_target,$f).xml)
@echo '<?xml version="1.0" encoding="UTF-8"?>' >$@
@echo '<!-- this file is autogenerated, do not edit! -->' >>$@
@echo '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"' >>$@
@echo ' "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"' >>$@
@echo ' [ <!ENTITY % local.common.attrib' >>$@
@echo " \"xmlns:xi CDATA #FIXED 'http://www.w3.org/2001/XInclude'\">]">>$@
@echo '>' >>$@
@echo '<book id="select_list"'\
'xmlns:xi="http://www.w3.org/2001/XInclude">' >>$@
@echo ' <title>Select List</title>' >>$@
@echo ' <bookinfo>' >>$@
@echo ' <productname class="trade">kamailio.org</productname>' >>$@
@echo ' <authorgroup>' >>$@
@echo ' <author>' >>$@
@echo ' <firstname>Kamailio</firstname>' >>$@
@echo ' <surname>Development Team</surname>' >>$@
@echo ' <affiliation><orgname>https://www.kamailio.org</orgname></affiliation>' >>$@
@echo ' <address>sr-dev@lists.kamailio.org</address>' >>$@
@echo ' </author>' >>$@
@echo ' </authorgroup>' >>$@
@echo ' <copyright>' >>$@
@echo ' <year>2008-2017</year>' >>$@
@echo ' <holder>Kamailio Project</holder>' >>$@
@echo ' </copyright>' >>$@
@echo ' </bookinfo>' >>$@
@echo ' <xi:include href="intro.xml"/>' >>$@
@$(foreach f,$(flist),\
echo ' <xi:include'\
'href="'$(call get_target,$f).xml'"/>' \
>>$@ ; )
@echo '</book>' >>$@
# finds all the files containing select defs
.PHONY: find
find:
@$(find_sel_files_cmd)
# print the list of the autogenerated files
.PHONY: print-lst
print-lst:
@$(find_sel_files_cmd) | $(gen_file_grp_cmd)
#
.PHONY: gen-file-list
.PHONY: gen-files_list
.PHONY: gen_files_list
gen-file-list gen-files-list gen_files_list:
@$(foreach f,$(call subst_corepath,$(call sort_files,$(f_found_lst))),\
echo "$f \\";)
.PHONY: check-list
.PHONY: update-list
.PHONY: diff-list
check-list update-list diff-list:
@$(foreach f,$(call subst_corepath,$(call sort_files,$(diff_lst))),\
echo "$f \\";)
# try to generate the docs from all the sources
.PHONY: autogen
autogen:
@$(MAKE) all files_list="$(call sort_files,$(f_found_lst))"
$(foreach f,$(flist),$(eval $(call mk_rules,$(f))))

View file

@ -1,15 +0,0 @@
docs = select_list.xml
docbook_dir = ../../../docbook
# no subsection listed in the main TOC
xsltproc_flags+= --stringparam toc.section.depth 0
xsltproc_flags+= --stringparam section.autolabel 1
xsltproc_flags+= --stringparam section.label.includes.component.label 1
include $(docbook_dir)/Makefile
# updates to the html generated file
.PHONY: html-update
html-update:
# strip first to lines (xml and doctype constraints)
sed -i '1,2d' $(basename $(docs)).html

View file

@ -1,4 +0,0 @@
docs = ser_radius.xml
docbook_dir = ../../docbook
include $(docbook_dir)/Makefile

View file

@ -1,4 +0,0 @@
docs = serdev.xml
docbook_dir = ../../docbook
include $(docbook_dir)/Makefile

View file

@ -1,4 +0,0 @@
docs = serfaq.xml
docbook_dir = ../../docbook
include $(docbook_dir)/Makefile

View file

@ -1,4 +0,0 @@
docs = ser-howto.xml
docbook_dir = ../../docbook
include $(docbook_dir)/Makefile

View file

@ -1,4 +0,0 @@
docs = seruser.xml
docbook_dir = ../../docbook
include $(docbook_dir)/Makefile

View file

@ -1,4 +0,0 @@
docs = sip_introduction.xml
docbook_dir = ../../docbook
include $(docbook_dir)/Makefile