Browse code

- 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 authored on 24/06/2008 14:39:52
Showing 4 changed files
... ...
@@ -341,6 +341,8 @@ tar:
341 341
 		--exclude=.svn* \
342 342
 		--exclude=.cvsignore \
343 343
 		--exclude=librpath.lst \
344
+		--exclude=libiname.lst \
345
+		--exclude=makecfg.lst \
344 346
 		--exclude=*.[do] \
345 347
 		--exclude=*.so \
346 348
 		--exclude=*.il \
... ...
@@ -78,7 +78,7 @@ MAIN_NAME=ser
78 78
 VERSION = 2
79 79
 PATCHLEVEL = 1
80 80
 SUBLEVEL =  0
81
-EXTRAVERSION = -dev21-tcp
81
+EXTRAVERSION = -dev22-tcp
82 82
 
83 83
 SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
84 84
 			$(SUBLEVEL) )
... ...
@@ -18,9 +18,26 @@
18 18
 # --------
19 19
 #  2007-03-29  set rpath differently for make install
20 20
 #              automatically build listed SER_LIBS if needed (andrei)
21
+#  2008-06-23  automatically rebuild if make time defines or includes
22
+#              changed (via makecfg.lst)
21 23
 #
22 24
 
23 25
 
26
+# check if the saved cfg corresponds with the current one
27
+# (if not rebuild everything)
28
+ifeq (,$(filter clean %clean clean% proper %proper proper%, $(MAKECMDGOALS)))
29
+-include makecfg.lst
30
+ifneq ($(strip $(DEFS)), $(strip $(CFG_DEFS)))
31
+#$(warning different defs: <$(strip $(DEFS))> != )
32
+#$(warning               : <$(strip $(CFG_DEFS))>)
33
+$(shell rm -f makecfg.lst)
34
+endif
35
+ifneq ($(INCLUDES), $(CFG_INCLUDES))
36
+$(shell rm -f makecfg.lst)
37
+endif
38
+endif
39
+
40
+ALLDEP+=makecfg.lst
24 41
 
25 42
 #implicit rules
26 43
 %.o:%.c  $(ALLDEP)
... ...
@@ -117,6 +134,9 @@ $(NAME): $(objs) $(ALLDEP)
117 117
 librpath.lst: $(ALLDEP)
118 118
 	@echo LIB_RPATH_LST:=$(SER_RPATH_LST) >librpath.lst
119 119
 
120
+makecfg.lst:
121
+	@echo CFG_DEFS:=$(subst ',\', $(subst ",\", $(strip $(DEFS)))) >>$@
122
+	@echo CFG_INCLUDES:=$(subst ',\', $(subst ",\", $(strip $(INCLUDES)))) >>$@
120 123
 .PHONY: all
121 124
 all: $(NAME) modules
122 125
 
... ...
@@ -128,7 +148,8 @@ static: $(objs)
128 128
 
129 129
 .PHONY: clean
130 130
 clean: 
131
-	-@rm -f $(objs) $(NAME) $(objs:.o=.il) librpath.lst 2>/dev/null
131
+	-@rm -f $(objs) $(NAME) $(objs:.o=.il) librpath.lst \
132
+				makecfg.lst 2>/dev/null
132 133
 	-@for r in $(modules) $(static_modules_path) "" ; do \
133 134
 		if [ -d "$$r" ]; then \
134 135
 			echo "module $$r" ; \
... ...
@@ -262,6 +262,12 @@ new config variables:
262 262
     is not initialized at startup and cannot be enabled runtime,
263 263
     that saves some memory.
264 264
 
265
+build system:
266
+ - check defines and includes used at compile time and if different 
267
+   force rebuilding everything in the current dir (creates a new file: 
268
+   makecfg.lst that stores the compile defines & includes used at compile 
269
+   time)
270
+
265 271
 
266 272
 
267 273
 2.0.0 changes