Module: sip-router Branch: kamailio_3.0 Commit: 3259e890c5ea9e142674c2487f3e9f28c26cd1a4 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3259e890...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Tue Oct 13 23:30:53 2009 +0200
core: combined Makefile with sr_3.0 version
- replaced previous version with sr_3.0 to install utils' tools - gen_ha1 still not to be installed - kamailio.cfg is installed as main config - check if cfg files to be installed exist -- $CFG_NAME-basic.cfg and $CFG_NAME-oob.cfg were attempted to be installed although not available for different flavours - install dictionary.kamailio used by K radius-related modules, instead of SR version
---
Makefile | 141 +++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 107 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile index 2d9f6d3..95115a5 100644 --- a/Makefile +++ b/Makefile @@ -339,15 +339,27 @@ cmodules=$(foreach mods,$(modules_dirs), $($(mods))) #modules_full_path=$(join $(modules), $(addprefix /, $(modules_names)))
-# which utils need compilation (directory path) and which to install -# (full path including file name) -utils_compile= utils/sercmd -utils_bin_install= utils/kamctl # sercmd is now installed by ctl -utils_script_install=
-# This is the list of files to be installed into the arch-independent -# shared directory (by default /usr/local/share/$(MAIN_NAME)) -share_install= +# list of utils directories that should be compiled by make utils +C_COMPILE_UTILS= utils/sercmd +# list of binaries that should be installed alongside +# (they should be created after make utils, see C_COMPILE_UTILS) +C_INSTALL_BIN= # sercmd is now installed by ctl + +# which utils know to install themselves and should be installed +# along the core (list of utils directories) +C_INSTALL_UTILS= utils/kamctl +# list of scripts that should be installed along the core +# (here a script is something that doesn't have a Makefile) +C_INSTALL_SCRIPTS= +# list of extra configs that should be installed along the core +# Note: all the paths of the form /usr/*lib/$(CFG_NAME)/<module_dir> +# will be updated to the directory where the modules will be installed. +C_INSTALL_CFGS= +# list of files that should be installed in the arch-independent +# directory (by default /usr/local/share/$(MAIN_NAME))) +C_INSTALL_SHARE= +
@@ -635,7 +647,7 @@ $(extra_objs):
.PHONY: utils utils: - @for r in $(utils_compile) "" ; do \ + @for r in $(C_COMPILE_UTILS) "" ; do \ if [ -n "$$r" ]; then \ $(call oecho, "" ;) \ $(call oecho, "" ;) \ @@ -780,27 +792,67 @@ $(man_prefix)/$(man_dir)/man5:
# note: sed with POSIX.1 regex doesn't support |, + or ? (darwin, solaris ...) install-cfg: $(cfg_prefix)/$(cfg_dir) - @sed $(foreach m,$(modules_dirs),\ - -e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)([:/"])#$($(m)_target)\1#g") \ - < etc/$(CFG_NAME)-basic.cfg > \ - $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample - @chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample - @if [ -z "${skip_cfg_install}" -a \ - ! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg ]; then \ - mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample \ - $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg; \ + @if [ -f etc/$(CFG_NAME).cfg ]; then \ + sed $(foreach m,$(modules_dirs),\ + -e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)([:/"])#$($(m)_target)\1#g") \ + < etc/$(CFG_NAME).cfg > \ + $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample; \ + chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample; \ + if [ -z "${skip_cfg_install}" -a \ + ! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg ]; then \ + mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample \ + $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg; \ + fi; \ fi - @sed $(foreach m,$(modules_dirs),\ - -e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)([:/"])#$($(m)_target)\1#g") \ - < etc/$(CFG_NAME)-oob.cfg \ - > $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample - @chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample - @if [ -z "${skip_cfg_install}" -a \ - ! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg ]; \ - then \ - mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample \ - $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg; \ + @if [ -f etc/$(CFG_NAME)-basic.cfg ]; then \ + sed $(foreach m,$(modules_dirs),\ + -e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)([:/"])#$($(m)_target)\1#g") \ + < etc/$(CFG_NAME)-basic.cfg > \ + $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg.sample; \ + chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg.sample; \ + if [ -z "${skip_cfg_install}" -a \ + ! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg ]; then \ + mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg.sample \ + $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg; \ + fi; \ + fi + @if [ -f etc/$(CFG_NAME)-oob.cfg ]; then \ + sed $(foreach m,$(modules_dirs),\ + -e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)([:/"])#$($(m)_target)\1#g") \ + < etc/$(CFG_NAME)-oob.cfg \ + > $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample; \ + chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample; \ + if [ -z "${skip_cfg_install}" -a \ + ! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg ]; \ + then \ + mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample \ + $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg; \ + fi; \ fi + # other configs + @for r in $(C_INSTALL_CFGS) ; do \ + if [ -n "$$r" ]; then \ + if [ -f "$$r" ]; then \ + n=`basename "$$r"` ; \ + sed $(foreach m,$(modules_dirs),\ + -e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)([:/"])#$($(m)_target)\1#g") \ + < "$$r" \ + > "$(cfg_prefix)/$(cfg_dir)$$n.sample" ; \ + chmod 644 "$(cfg_prefix)/$(cfg_dir)$$n.sample" ; \ + if [ -z "${skip_cfg_install}" -a \ + ! -f "$(cfg_prefix)/$(cfg_dir)$$n" ]; \ + then \ + mv -f "$(cfg_prefix)/$(cfg_dir)$$n.sample" \ + "$(cfg_prefix)/$(cfg_dir)$$n"; \ + fi ; \ + else \ + echo "ERROR: $$r not found" ; \ + if [ ${err_fail} = 1 ] ; then \ + exit 1; \ + fi ; \ + fi ; \ + fi ; \ + done; true # radius dictionary $(INSTALL_TOUCH) $(cfg_prefix)/$(cfg_dir)/dictionary.$(CFG_NAME) $(INSTALL_CFG) etc/dictionary.$(CFG_NAME) $(cfg_prefix)/$(cfg_dir) @@ -811,7 +863,7 @@ install-bin: $(bin_prefix)/$(bin_dir) $(NAME)
install-share: $(share_prefix)/$(share_dir) - @for r in $(share_install) "" ; do \ + @for r in $(C_INSTALL_SHARE) "" ; do \ if [ -n "$$r" ]; then \ if [ -f "$$r" ]; then \ $(call try_err, $(INSTALL_TOUCH) \ @@ -835,18 +887,39 @@ install-every-module-doc: $(foreach mods,$(modules_dirs),install-$(mods)-doc) install-every-module-man: $(foreach mods,$(modules_dirs),install-$(mods)-man)
install-utils: utils $(bin_prefix)/$(bin_dir) - @for r in $(utils_bin_install) "" ; do \ - if [ -d "$$r" ]; then \ - if [ -f "$$r/Makefile" ]; then \ - make -C "$$r" install; \ + @for r in $(C_INSTALL_BIN) "" ; do \ + if [ -n "$$r" ]; then \ + if [ -f "$$r" ]; then \ + $(call try_err, $(INSTALL_TOUCH) \ + $(bin_prefix)/$(bin_dir)/`basename "$$r"` ); \ + $(call try_err,\ + $(INSTALL_BIN) "$$r" $(bin_prefix)/$(bin_dir) ); \ else \ - echo "ERROR: $$r has no Makefile to install" ; \ + echo "ERROR: $$r not compiled" ; \ if [ ${err_fail} = 1 ] ; then \ exit 1; \ fi ; \ fi ;\ fi ; \ done; true + @for r in $(C_INSTALL_SCRIPTS) "" ; do \ + if [ -n "$$r" ]; then \ + if [ -f "$$r" ]; then \ + $(call try_err, $(INSTALL_TOUCH) \ + $(bin_prefix)/$(bin_dir)/`basename "$$r"` ); \ + $(call try_err,\ + $(INSTALL_SCRIPT) "$$r" $(bin_prefix)/$(bin_dir) ); \ + else \ + echo "ERROR: $$r not compiled" ; \ + if [ ${err_fail} = 1 ] ; then \ + exit 1; \ + fi ; \ + fi ;\ + fi ; \ + done; true + @for ut in $(C_INSTALL_UTILS) ; do \ + $(call try_err, $(MAKE) -C "$${ut}" install-if-newer ) ;\ + done; true
install-modules-all: install-every-module install-every-module-doc