Browse code

- moved modules list from config.mak to modules.lst and added modules list reconfigure targets: make modules-cfg ... (this allows changing the modules list without triggering a complete recompile) - added make cfg-defs which would change only the build options, without modifying the modules list

Andrei Pelinescu-Onciul authored on 01/07/2008 20:31:55
Showing 4 changed files
... ...
@@ -258,8 +258,19 @@ make modules=modules/print modules
258 258
 make cfg modules=modules/print mode=debug PROFILE=-pg
259 259
 make all
260 260
 
261
+- change & save the  modules list without rebuilding the whole config
262
+ (so that already compiled modules won't be re-compiled by 
263
+  make all/make modules):
264
+
265
+make modules-cfg include_modules="mysql postgress"
266
+
267
+- change only the compile/build options, without changing the modules list:
268
+
269
+make cfg-defs CPU=ultrasparc PROFILE=-pg
270
+
261 271
 - compile by default all the usual modules + mysql and postgres, optimized 
262
-for pentium-m and for space
272
+for pentium-m and for space (saves both the build options and the module 
273
+ list)
263 274
 
264 275
 make cfg include_modules="mysql postgres" CPU=pentium-m CC_EXTRA_OPTS=-Os
265 276
 make all
... ...
@@ -309,7 +320,7 @@ Make targets:
309 309
 
310 310
 Configure:
311 311
 
312
-make cfg or make config (force config regeneration and store it in config.mak)
312
+make cfg or make config (force config and module list regeneration)
313 313
 
314 314
 Example: make cfg include_modules=mysql mode=debug  (all future make 
315 315
 invocations will include the mysql module and will build in debug mode)
... ...
@@ -318,16 +329,24 @@ Note: if config.mak doesn't exist (e.g. initial checkout or after a make
318 318
 proper) or if Makefile.defs was changed, the config will be re-generated
319 319
 automatically by the first make command. For example:
320 320
  make cfg  include_modules=mysql; make all is equivalent to 
321
- rm config.mak; make include_modules=mysql.
321
+ rm config.mak modules.lst; make include_modules=mysql.
322
+
323
+make cfg-defs  (force config regeneration, but don't touch the module list)
324
+
325
+Example: make cfg-defs CPU=ultrasparc CC_EXTRA_OPTS=-Os PROFILE=-pg
322 326
 
327
+make modules-cfg or
328
+make modules-list    (saves the module list, without regenerating the 
329
+                       build config)
330
+Example: make modules-list include_modules="tls" skip_modules="print"
323 331
 
324 332
 Clean:
325 333
 
326 334
 make clean   (clean the modules too)
327 335
 make proper  (clean also the dependencies and the config)
328 336
 make distclean (the same as proper)
329
-make mantainer-clean (clean everything, including make's config, auto 
330
- generated files, tags, *.dbg a.s.o)
337
+make mantainer-clean (clean everything, including make's config, saved 
338
+  module list, auto generated files, tags, *.dbg a.s.o)
331 339
 make clean-all (clean all the modules in modules/*)
332 340
 make proper-all (like make proper but for all the  modules in modules/*)
333 341
 
... ...
@@ -50,6 +50,11 @@
50 50
 #  2008-06-25  make cfg support (use a pre-built cfg.: config.mak) (andrei)
51 51
 #  2008-06-28  added clean-all, proper-all, install-modules-man and error 
52 52
 #               checks for install-utils & doc (andrei)
53
+#  2008-07-01  split module list from config.mak into modules.lst so that
54
+#               the modules list can be changed without rebuilding the whole
55
+#               ser (andrei)
56
+#              added cfg-defs, new target that only rebuilds config.mak
57
+#
53 58
 
54 59
 auto_gen=lex.yy.c cfg.tab.c #lexx, yacc etc
55 60
 auto_gen_others=cfg.tab.h  # auto generated, non-c
... ...
@@ -197,7 +202,7 @@ ALLDEP=config.mak Makefile Makefile.sources Makefile.rules
197 197
 
198 198
 
199 199
 # try saved cfg, unless we are in the process of building it
200
-ifeq (,$(filter config.mak config cfg,$(MAKECMDGOALS)))
200
+ifeq (,$(filter config.mak config cfg cfg-defs,$(MAKECMDGOALS)))
201 201
 include config.mak
202 202
 ifeq ($(makefile_defs),1)
203 203
 $(info config.mak loaded)
... ...
@@ -205,7 +210,7 @@ $(info config.mak loaded)
205 205
 config_mak=1
206 206
 endif
207 207
 else
208
-ifneq (,$(filter cfg config,$(word 1,$(MAKECMDGOALS))))
208
+ifneq (,$(filter cfg config cfg-defs,$(word 1,$(MAKECMDGOALS))))
209 209
 # needed here to avoid starting a config submake 
210 210
 # (e.g. rm -f config.mak; make config.mak), which would either require 
211 211
 # double Makefile.defs defines execution (suboptimal), would loose
... ...
@@ -215,6 +220,8 @@ $(shell rm -rf config.mak)
215 215
 endif
216 216
 endif
217 217
 
218
+include modules.lst
219
+
218 220
 main_makefile=1
219 221
 include Makefile.defs
220 222
 
... ...
@@ -317,10 +324,19 @@ else
317 317
 config.mak: Makefile.defs
318 318
 	@echo making config...
319 319
 	@echo "# this file is autogenerated by make cfg" >$@
320
-	@echo "# `date`" >>$@
321 320
 	@$(call mapf2,cfg_save_var,saved_fixed_vars,$(@))
322 321
 	@$(call mapf2,cfg_save_var2,saved_chg_vars,$(@))
323 322
 	@echo "override makefile_defs:=1" >>$@
323
+	@echo "DEFS:=\$$(filter-out \$$(DEFS_RM) \$$(extra_defs),\$$(DEFS))" \
324
+					"\$$(extra_defs)"  >>$@
325
+	@echo "CFLAGS:=\$$(filter-out \$$(CFLAGS_RM) \$$(CC_EXTRA_OPTS)," \
326
+						"\$$(CFLAGS)) \$$(CC_EXTRA_OPTS)" >>$@
327
+
328
+endif # ifeq ($(config_mak),1)
329
+
330
+modules.lst:
331
+	@echo  saving modules list...
332
+	@echo "# this file is autogenerated by make modules-cfg" >$@
324 333
 	@$(call cfg_save_var2,group_include,$@)
325 334
 	@$(call cfg_save_var2,include_modules,$@)
326 335
 	@$(call cfg_save_var2,static_modules,$@)
... ...
@@ -330,18 +346,16 @@ config.mak: Makefile.defs
330 330
 	@$(call cfg_save_var2,modules_noinc,$@)
331 331
 	@$(call cfg_save_var2,modules,$@)
332 332
 	@echo "modules_configured:=1" >>$@
333
-	@echo "DEFS:=\$$(filter-out \$$(DEFS_RM) \$$(extra_defs),\$$(DEFS))" \
334
-					"\$$(extra_defs)"  >>$@
335
-	@echo "CFLAGS:=\$$(filter-out \$$(CFLAGS_RM) \$$(CC_EXTRA_OPTS)," \
336
-						"\$$(CFLAGS)) \$$(CC_EXTRA_OPTS)" >>$@
337 333
 
338
-endif # ifeq ($(config_mak),1)
334
+.PHONY: cfg config cfg-defs
335
+cfg-defs: config.mak
339 336
 
340
-.PHONY: cfg config
341
-cfg config: config.mak
337
+cfg config: cfg-defs modules-cfg
342 338
 
343
-#rm -f config.mak
344
-#$(MAKE) config.mak exported_vars=0 
339
+.PHONY: modules-cfg modules-list modules-lst
340
+modules-cfg modules-list modules-lst: 
341
+	rm -rf modules.lst
342
+	$(MAKE) modules.lst
345 343
 
346 344
 .PHONY: all
347 345
 all: $(NAME) modules
... ...
@@ -356,7 +370,7 @@ print-modules:
356 356
 	echo The following modules will be made: $(modules_basenames) ; \
357 357
 
358 358
 .PHONY: modules
359
-modules:
359
+modules: modules.lst
360 360
 	@for r in $(modules) "" ; do \
361 361
 		if [ -n "$$r" -a -r "$$r/Makefile" ]; then \
362 362
 			echo  "" ; \
... ...
@@ -420,6 +434,7 @@ tar:
420 420
 		--exclude=libiname.lst \
421 421
 		--exclude=makecfg.lst \
422 422
 		--exclude=config.mak \
423
+		--exclude=modules.lst \
423 424
 		--exclude=*.[do] \
424 425
 		--exclude=*.so \
425 426
 		--exclude=*.il \
... ...
@@ -475,7 +490,7 @@ sunpkg:
475 475
 	rm -rf tmp/ser_sun_pkg
476 476
 
477 477
 .PHONY: modules-doc
478
-modules-doc:
478
+modules-doc: modules.lst
479 479
 	-@for r in $(modules) "" ; do \
480 480
 		if [ -n "$$r" ]; then \
481 481
 			echo  "" ; \
... ...
@@ -488,7 +503,7 @@ modules-doc:
488 488
 modules-readme: README
489 489
 
490 490
 .PHONY: README
491
-README:
491
+README: modules.lst
492 492
 	-@for r in $(modules) "" ; do \
493 493
 		if [ -n "$$r" ]; then \
494 494
 			echo  "" ; \
... ...
@@ -505,7 +520,7 @@ README:
505 505
 modules-man: man
506 506
 
507 507
 .PHONY: man
508
-man:
508
+man: modules.lst
509 509
 	-@for r in $(modules) "" ; do \
510 510
 		if [ -n "$$r" ]; then \
511 511
 			echo  "" ; \
... ...
@@ -609,7 +624,7 @@ install-share: $(share_prefix)/$(share_dir)
609 609
 		fi ; \
610 610
 	done; true
611 611
 
612
-install-modules: $(modules_prefix)/$(modules_dir)
612
+install-modules: modules.lst $(modules_prefix)/$(modules_dir)
613 613
 	@for r in $(modules) "" ; do \
614 614
 		if [ -n "$$r" -a -r "$$r/Makefile" ]; then \
615 615
 			echo  "" ; \
... ...
@@ -676,7 +691,7 @@ install-doc: $(doc_prefix)/$(doc_dir) install-modules-doc
676 676
 	$(INSTALL_DOC) README $(doc_prefix)/$(doc_dir)
677 677
 
678 678
 
679
-install-modules-doc: $(doc_prefix)/$(doc_dir)
679
+install-modules-doc: modules.lst $(doc_prefix)/$(doc_dir)
680 680
 	@for r in $(modules_basenames) "" ; do \
681 681
 		if [ -n "$$r" ]; then \
682 682
 			if [ -f modules/"$$r"/README ]; then \
... ...
@@ -738,8 +753,12 @@ clean:	clean_libs
738 738
 clean-all: modules=$(modules_all)
739 739
 clean-all: clean
740 740
 
741
+# on make proper clean also the build config (w/o module list)
741 742
 proper realclean distclean: clean_cfg 
742 743
 
744
+# on maintainer clean, remove also the configured module list
745
+maintainer-clean: clean_modules_cfg
746
+
743 747
 .PHONY: proper-all realclean-all distclean-all
744 748
 proper-all realclean-all distclean-all: modules=$(modules_all)
745 749
 proper-all realclean-all distclean-all: proper
... ...
@@ -749,3 +768,6 @@ proper-all realclean-all distclean-all: proper
749 749
 clean_cfg:
750 750
 	rm -f config.mak
751 751
 
752
+.PHONY: clean_modules_cfg clean-modules-cfg
753
+clean_modules_cfg clean-modules-cfg:
754
+	rm -f modules.lst
... ...
@@ -16,5 +16,5 @@ $(COREPATH)/config.mak: makefile_defs=0
16 16
 $(COREPATH)/config.mak: exported_vars=0
17 17
 
18 18
 $(COREPATH)/config.mak: $(COREPATH)/Makefile.defs
19
-	$(MAKE) -wC $(COREPATH) cfg
19
+	$(MAKE) -wC $(COREPATH) cfg-defs
20 20
 
... ...
@@ -14,13 +14,14 @@
14 14
 #
15 15
 
16 16
 clean_targets:=	clean proper distclean realclean mantainer-clean clean_libs \
17
-				clean-all proper-all distclean-all realclean-all
17
+				clean-all proper-all distclean-all realclean-all \
18
+				clean_cfg clean_modules_cfg clean-modules-cfg
18 19
 doc_targets:=	modules-doc modules-readme README modules-man man \
19 20
 		install-doc install-modules-doc install-man install-ser-man \
20 21
 		install-modules-man
21 22
 # auxiliary: maintance, debugging, etc. (don't affect code/objects)
22
-aux_targets:=	TAGS tar dist cfg config config.mak print-modules dbg \
23
-		dbinstall librpath.lst makecfg.lst
23
+aux_targets:=	TAGS tar dist cfg-defs cfg config config.mak print-modules \
24
+		dbg dbinstall librpath.lst makecfg.lst modules.lst
24 25
 # other targets that don't produce code in the current directory ("external")
25 26
 ext_targets:=	modules libs utils \
26 27
 		install-cfg install-modules install-utils  install-modules-all \