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 320
 
310 321
 Configure:
311 322
 
312
-make cfg or make config (force config regeneration and store it in config.mak)
323
+make cfg or make config (force config and module list regeneration)
313 324
 
314 325
 Example: make cfg include_modules=mysql mode=debug  (all future make 
315 326
 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 329
 proper) or if Makefile.defs was changed, the config will be re-generated
319 330
 automatically by the first make command. For example:
320 331
  make cfg  include_modules=mysql; make all is equivalent to 
321
- rm config.mak; make include_modules=mysql.
332
+ rm config.mak modules.lst; make include_modules=mysql.
333
+
334
+make cfg-defs  (force config regeneration, but don't touch the module list)
335
+
336
+Example: make cfg-defs CPU=ultrasparc CC_EXTRA_OPTS=-Os PROFILE=-pg
322 337
 
338
+make modules-cfg or
339
+make modules-list    (saves the module list, without regenerating the 
340
+                       build config)
341
+Example: make modules-list include_modules="tls" skip_modules="print"
323 342
 
324 343
 Clean:
325 344
 
326 345
 make clean   (clean the modules too)
327 346
 make proper  (clean also the dependencies and the config)
328 347
 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)
348
+make mantainer-clean (clean everything, including make's config, saved 
349
+  module list, auto generated files, tags, *.dbg a.s.o)
331 350
 make clean-all (clean all the modules in modules/*)
332 351
 make proper-all (like make proper but for all the  modules in modules/*)
333 352
 
... ...
@@ -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 202
 
198 203
 
199 204
 # try saved cfg, unless we are in the process of building it
200
-ifeq (,$(filter config.mak config cfg,$(MAKECMDGOALS)))
205
+ifeq (,$(filter config.mak config cfg cfg-defs,$(MAKECMDGOALS)))
201 206
 include config.mak
202 207
 ifeq ($(makefile_defs),1)
203 208
 $(info config.mak loaded)
... ...
@@ -205,7 +210,7 @@ $(info config.mak loaded)
205 210
 config_mak=1
206 211
 endif
207 212
 else
208
-ifneq (,$(filter cfg config,$(word 1,$(MAKECMDGOALS))))
213
+ifneq (,$(filter cfg config cfg-defs,$(word 1,$(MAKECMDGOALS))))
209 214
 # needed here to avoid starting a config submake 
210 215
 # (e.g. rm -f config.mak; make config.mak), which would either require 
211 216
 # double Makefile.defs defines execution (suboptimal), would loose
... ...
@@ -215,6 +220,8 @@ $(shell rm -rf config.mak)
215 220
 endif
216 221
 endif
217 222
 
223
+include modules.lst
224
+
218 225
 main_makefile=1
219 226
 include Makefile.defs
220 227
 
... ...
@@ -317,10 +324,19 @@ else
317 324
 config.mak: Makefile.defs
318 325
 	@echo making config...
319 326
 	@echo "# this file is autogenerated by make cfg" >$@
320
-	@echo "# `date`" >>$@
321 327
 	@$(call mapf2,cfg_save_var,saved_fixed_vars,$(@))
322 328
 	@$(call mapf2,cfg_save_var2,saved_chg_vars,$(@))
323 329
 	@echo "override makefile_defs:=1" >>$@
330
+	@echo "DEFS:=\$$(filter-out \$$(DEFS_RM) \$$(extra_defs),\$$(DEFS))" \
331
+					"\$$(extra_defs)"  >>$@
332
+	@echo "CFLAGS:=\$$(filter-out \$$(CFLAGS_RM) \$$(CC_EXTRA_OPTS)," \
333
+						"\$$(CFLAGS)) \$$(CC_EXTRA_OPTS)" >>$@
334
+
335
+endif # ifeq ($(config_mak),1)
336
+
337
+modules.lst:
338
+	@echo  saving modules list...
339
+	@echo "# this file is autogenerated by make modules-cfg" >$@
324 340
 	@$(call cfg_save_var2,group_include,$@)
325 341
 	@$(call cfg_save_var2,include_modules,$@)
326 342
 	@$(call cfg_save_var2,static_modules,$@)
... ...
@@ -330,18 +346,16 @@ config.mak: Makefile.defs
330 346
 	@$(call cfg_save_var2,modules_noinc,$@)
331 347
 	@$(call cfg_save_var2,modules,$@)
332 348
 	@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 349
 
338
-endif # ifeq ($(config_mak),1)
350
+.PHONY: cfg config cfg-defs
351
+cfg-defs: config.mak
339 352
 
340
-.PHONY: cfg config
341
-cfg config: config.mak
353
+cfg config: cfg-defs modules-cfg
342 354
 
343
-#rm -f config.mak
344
-#$(MAKE) config.mak exported_vars=0 
355
+.PHONY: modules-cfg modules-list modules-lst
356
+modules-cfg modules-list modules-lst: 
357
+	rm -rf modules.lst
358
+	$(MAKE) modules.lst
345 359
 
346 360
 .PHONY: all
347 361
 all: $(NAME) modules
... ...
@@ -356,7 +370,7 @@ print-modules:
356 370
 	echo The following modules will be made: $(modules_basenames) ; \
357 371
 
358 372
 .PHONY: modules
359
-modules:
373
+modules: modules.lst
360 374
 	@for r in $(modules) "" ; do \
361 375
 		if [ -n "$$r" -a -r "$$r/Makefile" ]; then \
362 376
 			echo  "" ; \
... ...
@@ -420,6 +434,7 @@ tar:
420 434
 		--exclude=libiname.lst \
421 435
 		--exclude=makecfg.lst \
422 436
 		--exclude=config.mak \
437
+		--exclude=modules.lst \
423 438
 		--exclude=*.[do] \
424 439
 		--exclude=*.so \
425 440
 		--exclude=*.il \
... ...
@@ -475,7 +490,7 @@ sunpkg:
475 490
 	rm -rf tmp/ser_sun_pkg
476 491
 
477 492
 .PHONY: modules-doc
478
-modules-doc:
493
+modules-doc: modules.lst
479 494
 	-@for r in $(modules) "" ; do \
480 495
 		if [ -n "$$r" ]; then \
481 496
 			echo  "" ; \
... ...
@@ -488,7 +503,7 @@ modules-doc:
488 503
 modules-readme: README
489 504
 
490 505
 .PHONY: README
491
-README:
506
+README: modules.lst
492 507
 	-@for r in $(modules) "" ; do \
493 508
 		if [ -n "$$r" ]; then \
494 509
 			echo  "" ; \
... ...
@@ -505,7 +520,7 @@ README:
505 520
 modules-man: man
506 521
 
507 522
 .PHONY: man
508
-man:
523
+man: modules.lst
509 524
 	-@for r in $(modules) "" ; do \
510 525
 		if [ -n "$$r" ]; then \
511 526
 			echo  "" ; \
... ...
@@ -609,7 +624,7 @@ install-share: $(share_prefix)/$(share_dir)
609 624
 		fi ; \
610 625
 	done; true
611 626
 
612
-install-modules: $(modules_prefix)/$(modules_dir)
627
+install-modules: modules.lst $(modules_prefix)/$(modules_dir)
613 628
 	@for r in $(modules) "" ; do \
614 629
 		if [ -n "$$r" -a -r "$$r/Makefile" ]; then \
615 630
 			echo  "" ; \
... ...
@@ -676,7 +691,7 @@ install-doc: $(doc_prefix)/$(doc_dir) install-modules-doc
676 691
 	$(INSTALL_DOC) README $(doc_prefix)/$(doc_dir)
677 692
 
678 693
 
679
-install-modules-doc: $(doc_prefix)/$(doc_dir)
694
+install-modules-doc: modules.lst $(doc_prefix)/$(doc_dir)
680 695
 	@for r in $(modules_basenames) "" ; do \
681 696
 		if [ -n "$$r" ]; then \
682 697
 			if [ -f modules/"$$r"/README ]; then \
... ...
@@ -738,8 +753,12 @@ clean:	clean_libs
738 753
 clean-all: modules=$(modules_all)
739 754
 clean-all: clean
740 755
 
756
+# on make proper clean also the build config (w/o module list)
741 757
 proper realclean distclean: clean_cfg 
742 758
 
759
+# on maintainer clean, remove also the configured module list
760
+maintainer-clean: clean_modules_cfg
761
+
743 762
 .PHONY: proper-all realclean-all distclean-all
744 763
 proper-all realclean-all distclean-all: modules=$(modules_all)
745 764
 proper-all realclean-all distclean-all: proper
... ...
@@ -749,3 +768,6 @@ proper-all realclean-all distclean-all: proper
749 768
 clean_cfg:
750 769
 	rm -f config.mak
751 770
 
771
+.PHONY: clean_modules_cfg clean-modules-cfg
772
+clean_modules_cfg clean-modules-cfg:
773
+	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 \