[SR-Dev] git:master: makefiles: fix auto lib re-building

Andrei Pelinescu-Onciul andrei at iptel.org
Tue Feb 24 21:05:31 CET 2009


Module: sip-router
Branch: master
Commit: 19c546113aa78e454ec0f995550fde51828fce81
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=19c546113aa78e454ec0f995550fde51828fce81

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Tue Feb 24 21:04:21 2009 +0100

makefiles: fix auto lib re-building

- libs used by modules where rebuilt too often (more then once
  during a make all) as a result of different  DEFS for different
  modules (because of the different module interfaces and the new
   -DMOD_NAME).

---

 Makefile.rules |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/Makefile.rules b/Makefile.rules
index ea2190a..b03342f 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -27,12 +27,20 @@
 # (if not rebuild everything)
 ifeq (,$(filter $(nodep_targets),$(MAKECMDGOALS)))
 -include makecfg.lst
-ifneq ($(strip $(DEFS)), $(strip $(CFG_DEFS)))
+# if trying  to build a lib automatically and the lib is already compiled,
+# don't rebuild it if the only differences in DEFS or INCLUDES are covered
+# by LIB_NOREBUILD_DEFS/LIB_NOREBUILD_INCLUDES
+LIB_NOREBUILD_DEFS+= -DMOD_NAME% -D%_MOD_INTERFACE -DMOD_INTERFACE_% -DSR_%
+
+# don't rebuild if the differences are covered by NOREBUILD_DEFS or 
+# NOREBUILD_INCLUDES
+ifneq ($(filter-out $(NOREBUILD_DEFS),$(strip $(DEFS))), $(strip $(CFG_DEFS)))
 #$(warning different defs: <$(strip $(DEFS))> != )
 #$(warning               : <$(strip $(CFG_DEFS))>)
 $(shell rm -f makecfg.lst)
 endif
-ifneq ($(strip $(INCLUDES)), $(strip $(CFG_INCLUDES)))
+ifneq ($(filter-out $(NOREBUILD_INCLUDES), $(strip $(INCLUDES))),\
+		$(strip $(CFG_INCLUDES)))
 $(shell rm -f makecfg.lst)
 endif
 endif
@@ -95,7 +103,9 @@ ALL_LIBS+=$(foreach l, $(SER_LIBS), -L$(dir $l) -l$(notdir $l))
 $(NAME): librpath.lst $(SER_LIBS_DEPS)
 
 $(SER_LIBS_DEPS): FORCE
-	$(MAKE) -wC $(dir $@)  compile_for_install=$(lib_compile_for_install)
+	@$(MAKE) -wC $(dir $@)  compile_for_install=$(lib_compile_for_install) \
+		NOREBUILD_DEFS="$(NOREBUILD_DEFS) $(LIB_NOREBUILD_DEFS)" \
+		NOREBUILD_INCLUDES="$(NOREBUILD_INCLUDES) $(LIB_NOREBUILD_INCLUDES)"
 
 .PHONY: FORCE
 FORCE:
@@ -134,8 +144,10 @@ librpath.lst: $(ALLDEP)
 	@echo LIB_RPATH_LST:=$(SER_RPATH_LST) >librpath.lst
 
 makecfg.lst:
-	@echo CFG_DEFS:=$(subst ',\', $(subst ",\", $(strip $(DEFS)))) >>$@
-	@echo CFG_INCLUDES:=$(subst ',\', $(subst ",\", $(strip $(INCLUDES)))) >>$@
+	@echo CFG_DEFS:=$(subst ',\', $(subst ",\", \
+		$(filter-out $(NOREBUILD_DEFS), $(strip $(DEFS))))) >>$@
+	@echo CFG_INCLUDES:=$(subst ',\', $(subst ",\", \
+		$(filter-out $(NOREBUILD_INCLUDES), $(strip $(INCLUDES))))) >>$@
 .PHONY: all
 all: $(NAME) modules
 




More information about the sr-dev mailing list