Merge commit 'origin/ser_core_cvs'
[sip-router] / Makefile.rules
index af51b08..8767ec0 100644 (file)
 # (if not rebuild everything)
 ifeq (,$(filter $(nodep_targets),$(MAKECMDGOALS)))
 -include makecfg.lst
-ifneq ($(strip $(C_DEFS) $(DEFS)), $(strip $(CFG_DEFS)))
-#$(warning different defs: <$(strip $(C_DEFS) $(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=
+
+# don't rebuild if the differences are covered by NOREBUILD_DEFS or 
+# NOREBUILD_INCLUDES
+ifneq ($(strip $(filter-out $(NOREBUILD_DEFS),\
+               $(C_DEFS) $(DEFS))),$(strip $(CFG_DEFS)))
+#$(warning different defs: <$(strip $(DEFS))> != )
 #$(warning               : <$(strip $(CFG_DEFS))>)
 $(shell rm -f makecfg.lst)
 endif
-ifneq ($(strip $(C_INCLUDES) $(INCLUDES)), $(strip $(CFG_INCLUDES)))
+ifneq ($(strip $(filter-out $(NOREBUILD_INCLUDES),\
+                       $(C_INCLUDES) $(INCLUDES))),$(strip $(CFG_INCLUDES)))
 $(shell rm -f makecfg.lst)
 endif
 endif
@@ -99,7 +108,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:
@@ -138,10 +149,11 @@ librpath.lst: $(ALLDEP)
        @echo LIB_RPATH_LST:=$(SER_RPATH_LST) >librpath.lst
 
 makecfg.lst:
-       @echo CFG_DEFS:=\
-               $(subst ',\', $(subst ",\", $(strip $(C_DEFS) $(DEFS)))) >>$@
-       @echo CFG_INCLUDES:=\
-               $(subst ',\', $(subst ",\", $(strip $(C_INCLUDES) $(INCLUDES)))) >>$@
+       @echo CFG_DEFS:=$(subst ',\', $(subst ",\",$(strip \
+                       $(filter-out $(NOREBUILD_DEFS), $(C_DEFS) $(DEFS))))) >>$@
+       @echo CFG_INCLUDES:=$(subst ',\', $(subst ",\",$(strip \
+                       $(filter-out $(NOREBUILD_INCLUDES),\
+                               $(C_INCLUDES) $(INCLUDES))))) >>$@
 .PHONY: all
 all: $(NAME) modules