Browse Source

- check defines and includes used at compile time and if different
force rebuilding everything in the current dir (creates a new file:
makecfg.lst that stores the compile defines & includes used at compile
time). This should solve problems such as compiling mysql with malloc
debugging, modifiyng a file and then recompiling without malloc debugging.

Andrei Pelinescu-Onciul 17 years ago
parent
commit
5cace4edcc
4 changed files with 31 additions and 2 deletions
  1. 2 0
      Makefile
  2. 1 1
      Makefile.defs
  3. 22 1
      Makefile.rules
  4. 6 0
      NEWS

+ 2 - 0
Makefile

@@ -341,6 +341,8 @@ tar:
 		--exclude=.svn* \
 		--exclude=.cvsignore \
 		--exclude=librpath.lst \
+		--exclude=libiname.lst \
+		--exclude=makecfg.lst \
 		--exclude=*.[do] \
 		--exclude=*.so \
 		--exclude=*.il \

+ 1 - 1
Makefile.defs

@@ -78,7 +78,7 @@ MAIN_NAME=ser
 VERSION = 2
 PATCHLEVEL = 1
 SUBLEVEL =  0
-EXTRAVERSION = -dev21-tcp
+EXTRAVERSION = -dev22-tcp
 
 SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
 			$(SUBLEVEL) )

+ 22 - 1
Makefile.rules

@@ -18,9 +18,26 @@
 # --------
 #  2007-03-29  set rpath differently for make install
 #              automatically build listed SER_LIBS if needed (andrei)
+#  2008-06-23  automatically rebuild if make time defines or includes
+#              changed (via makecfg.lst)
 #
 
 
+# check if the saved cfg corresponds with the current one
+# (if not rebuild everything)
+ifeq (,$(filter clean %clean clean% proper %proper proper%, $(MAKECMDGOALS)))
+-include makecfg.lst
+ifneq ($(strip $(DEFS)), $(strip $(CFG_DEFS)))
+#$(warning different defs: <$(strip $(DEFS))> != )
+#$(warning               : <$(strip $(CFG_DEFS))>)
+$(shell rm -f makecfg.lst)
+endif
+ifneq ($(INCLUDES), $(CFG_INCLUDES))
+$(shell rm -f makecfg.lst)
+endif
+endif
+
+ALLDEP+=makecfg.lst
 
 #implicit rules
 %.o:%.c  $(ALLDEP)
@@ -117,6 +134,9 @@ $(NAME): $(objs) $(ALLDEP)
 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)))) >>$@
 .PHONY: all
 all: $(NAME) modules
 
@@ -128,7 +148,8 @@ static: $(objs)
 
 .PHONY: clean
 clean: 
-	-@rm -f $(objs) $(NAME) $(objs:.o=.il) librpath.lst 2>/dev/null
+	-@rm -f $(objs) $(NAME) $(objs:.o=.il) librpath.lst \
+				makecfg.lst 2>/dev/null
 	-@for r in $(modules) $(static_modules_path) "" ; do \
 		if [ -d "$$r" ]; then \
 			echo "module $$r" ; \

+ 6 - 0
NEWS

@@ -262,6 +262,12 @@ new config variables:
     is not initialized at startup and cannot be enabled runtime,
     that saves some memory.
 
+build system:
+ - check defines and includes used at compile time and if different 
+   force rebuilding everything in the current dir (creates a new file: 
+   makecfg.lst that stores the compile defines & includes used at compile 
+   time)
+
 
 
 2.0.0 changes