Module: sip-router Branch: master Commit: a91ba01fc9abbd737e560704e4620370a4e1c08a URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a91ba01f...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Fri Oct 9 21:03:03 2009 +0200
makefile: even more quiet
---
Makefile | 56 +++++++++++++++++++++++++++++++------------------------- Makefile.defs | 11 +++++++++-- Makefile.libs | 2 ++ Makefile.rules | 13 +++++++++---- 4 files changed, 51 insertions(+), 31 deletions(-)
diff --git a/Makefile b/Makefile index 3a399a6..88d96e6 100644 --- a/Makefile +++ b/Makefile @@ -247,7 +247,9 @@ ifeq (,$(strip \ $(filter config.mak config cfg cfg-defs $(clean_targets),$(MAKECMDGOALS)))) include config.mak ifeq ($(makefile_defs),1) +ifeq ($(quiet),verbose) $(info config.mak loaded) +endif # verbose # config_make valid & used config_mak=1 ifeq ($(MAIN_NAME),) @@ -265,6 +267,10 @@ $(shell rm -rf config.mak) config_mak=0 makefile_defs=0 exported_vars=0 +else +# config.mak not strictly needed, but try to load it if exists for $(Q) +config_mak=skip +-include config.mak endif endif
@@ -401,7 +407,7 @@ ifeq ($(config_mak),1)
include Makefile.cfg
-else +else ifneq ($(config_mak),skip)
config.mak: Makefile.defs @echo making config... @@ -494,8 +500,8 @@ $(1)_target=$(prefix)/$(modules_dir)$(1) $(1): modules.lst @for r in $($(1)) "" ; do \ if [ -n "$$$$r" -a -r "$$$$r/Makefile" ]; then \ - echo "" ; \ - echo "" ; \ + $(call oecho, "" ;) \ + $(call oecho, "" ;) \ if $(MAKE) -C $$$$r $$(mk_params) || [ ${err_fail} != 1 ] ; then \ :; \ else \ @@ -508,8 +514,8 @@ $(1): modules.lst $(1)-doc: modules.lst @for r in $($(1)) "" ; do \ if [ -n "$$$$r" ]; then \ - echo "" ; \ - echo "" ; \ + $(call oecho, "" ;) \ + $(call oecho, "" ;) \ $(MAKE) -C $$$$r/doc $(doc_format) $$(mk_params); \ fi ; \ done @@ -519,8 +525,8 @@ $(1)-doc: modules.lst $(1)-readme: modules.lst -@for r in $($(1)) "" ; do \ if [ -n "$$$$r" ]; then \ - echo "" ; \ - echo "" ; \ + $(call oecho, "" ;) \ + $(call oecho, "" ;) \ if $(MAKE) -C $$$$r $$(mk_params) README || [ ${err_fail} != 1 ];\ then \ :; \ @@ -534,8 +540,8 @@ $(1)-readme: modules.lst $(1)-man: modules.lst -@for r in $($(1)) "" ; do \ if [ -n "$$$$r" ]; then \ - echo "" ; \ - echo "" ; \ + $(call oecho, "" ;) \ + $(call oecho, "" ;) \ if $(MAKE) -C $$$$r $$(mk_params) man || [ ${err_fail} != 1 ] ;\ then \ :; \ @@ -550,8 +556,8 @@ $(1)-man: modules.lst install-$(1): modules.lst $$($(1)_dst) @for r in $($(1)) "" ; do \ if [ -n "$$$$r" -a -r "$$$$r/Makefile" ]; then \ - echo "" ; \ - echo "" ; \ + $(call oecho, "" ;) \ + $(call oecho, "" ;) \ if $(MAKE) -C $$$$r install mods_dst=$$($(1)_dst) $$(mk_params) \ || [ ${err_fail} != 1 ] ; then \ :; \ @@ -617,8 +623,8 @@ $(extra_objs): @echo "Extra objs: $(extra_objs)" @for r in $(static_modules_path) "" ; do \ if [ -n "$$r" -a -r "$$r/Makefile" ]; then \ - echo "" ; \ - echo "Making static module $r" ; \ + $(call oecho, "" ;) \ + $(call oecho, "Making static module $r" ;) \ if $(MAKE) -C $$r static $(mk_params) ; then \ :; \ else \ @@ -631,8 +637,8 @@ $(extra_objs): utils: @for r in $(utils_compile) "" ; do \ if [ -n "$$r" ]; then \ - echo "" ; \ - echo "" ; \ + $(call oecho, "" ;) \ + $(call oecho, "" ;) \ if $(MAKE) -C $$r $(mk_params) || [ ${err_fail} != 1 ] ; \ then \ :; \ @@ -774,22 +780,22 @@ $(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),\ + @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 \ + @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 - sed $(foreach m,$(modules_dirs),\ + @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 \ + @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 \ @@ -878,22 +884,22 @@ install-doc: $(doc_prefix)/$(doc_dir) install-every-module-doc
install-sr-man: $(man_prefix)/$(man_dir)/man8 $(man_prefix)/$(man_dir)/man5 - sed -e "s#/etc/$(CFG_NAME)/$(CFG_NAME).cfg#$(cfg_target)$(MAIN_NAME).cfg#g" \ + @sed -e "s#/etc/$(CFG_NAME)/$(CFG_NAME).cfg#$(cfg_target)$(MAIN_NAME).cfg#g" \ -e "s#/usr/sbin/#$(bin_target)#g" \ $(foreach m,$(modules_dirs),\ -e "s#/usr/lib/$(CFG_NAME)/$(m)([^_])#$($(m)_target)\1#g") \ -e "s#/usr/share/doc/$(CFG_NAME)/#$(doc_target)#g" \ < $(CFG_NAME).8 > \ $(man_prefix)/$(man_dir)/man8/$(MAIN_NAME).8 - chmod 644 $(man_prefix)/$(man_dir)/man8/$(MAIN_NAME).8 - sed -e "s#/etc/$(CFG_NAME)/$(CFG_NAME).cfg#$(cfg_target)$(MAIN_NAME).cfg#g" \ + @chmod 644 $(man_prefix)/$(man_dir)/man8/$(MAIN_NAME).8 + @sed -e "s#/etc/$(CFG_NAME)/$(CFG_NAME).cfg#$(cfg_target)$(MAIN_NAME).cfg#g" \ -e "s#/usr/sbin/#$(bin_target)#g" \ $(foreach m,$(modules_dirs),\ -e "s#/usr/lib/$(CFG_NAME)/$(m)([^_])#$($(m)_target)\1#g") \ -e "s#/usr/share/doc/$(CFG_NAME)/#$(doc_target)#g" \ < $(CFG_NAME).cfg.5 > \ $(man_prefix)/$(man_dir)/man5/$(MAIN_NAME).cfg.5 - chmod 644 $(man_prefix)/$(man_dir)/man5/$(MAIN_NAME).cfg.5 + @chmod 644 $(man_prefix)/$(man_dir)/man5/$(MAIN_NAME).cfg.5
install-man: install-sr-man install-every-module-man
diff --git a/Makefile.defs b/Makefile.defs index a9bd307..ee02e39 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -75,15 +75,18 @@ # 2009-10-01 use -fsigned-char for gcc on ppc, ppc64, arm and arm6 # (on those archs char is unsigned by default) (andrei)
+quiet?=$(if $(filter 1 yes on,$(Q)),silent,verbose)
# check if already included/exported
- # used for sanity checks for Makefile.defs inclusion (!= makefile_defs which # specifies if we have a set of valid defs) override makefile_defs_included:=1 ifeq ($(makefile_defs),1) +ifeq ($(quiet),verbose) $(info Makefile.defs defs skipped) +endif # verbose + else
ifeq (,$(main_makefile)) @@ -94,7 +97,9 @@ ifeq (,$(main_makefile)) # don't export the vars) COREPATH?= ../.. include $(COREPATH)/config.mak +ifeq ($(quiet),verbose) $(info config.mak included) +endif # verbose # config.mak should set makefile_defs if complete export makefile_defs
@@ -103,7 +108,9 @@ override makefile_defs=1 export makefile_defs
+ifeq ($(quiet),verbose) $(info normal Makefile.defs exec) +endif # verbose # main binary name MAIN_NAME=ser #prefix for various configs and scripts @@ -417,11 +424,11 @@ endif # predefined macros tests (x86_macros, ...) endif # gcc
ifdef CC_ARCH -$(info target architecture <$(CC_ARCH)>, host architecture <$(HOST_ARCH)>) ARCH:=$(CC_ARCH) else ARCH:=$(HOST_ARCH) endif +$(info target architecture <$(ARCH)>, host architecture <$(HOST_ARCH)>)
# compile-time options # diff --git a/Makefile.libs b/Makefile.libs index 21df837..6182580 100644 --- a/Makefile.libs +++ b/Makefile.libs @@ -20,7 +20,9 @@ endif
ifneq (,$(filter install% %install install, $(MAKECMDGOALS))) compile_for_install:=yes +ifeq ($(quiet),verbose) $(info install mode) +endif # verbose endif
ifeq ($(NAME),) diff --git a/Makefile.rules b/Makefile.rules index 55c7897..feadec5 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -66,9 +66,14 @@ silent_cmd_LD=LD ($(LD)) [$(strip $(crt_type) $(NAME))] $@ ifneq (,$(filter 1 yes on, $(Q) $(QUIET))) quiet=silent Q=1 +MAKE+= --no-print-directory +#shell optional print +oecho= else -Q=0 +override Q:= quiet=verbose +#shell optional print +oecho=echo $(1) endif
quote:= " @@ -156,14 +161,14 @@ $(SER_IPATH_LST): FORCE $(@) 1>/dev/null 2>/dev/null ; \ then :; \ else \ - echo "re-building $(@D)" ; \ + $(call oecho,"re-building $(@D)" ;) \ $(MAKE) -wC $(@D) compile_for_install=$(lib_compile_for_install) ; \ fi
.PHONY: FORCE-BUILD-LIBS FORCE-BUILD-LIBS: @for r in $(SER_LIBS_DIRS) ; do \ - echo building lib $$r; \ + $(call oecho,building lib $$r ;) \ $(MAKE) -wC $$r compile_for_install=$(lib_compile_for_install) ; \ done
@@ -207,7 +212,7 @@ clean: local-clean clean-modules: -@for r in $(cmodules) $(static_modules_path) "" ; do \ if [ -d "$$r" ]; then \ - echo "module $$r" ; \ + $(call oecho,"module $$r" ;) \ $(MAKE) -C "$$r" clean ; \ [ -d "$$r"/doc/Makefile ] && $(MAKE) -C "$$r"/doc clean ; \ fi ; \