瀏覽代碼

- 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 17 年之前
父節點
當前提交
0bd6adc6bc
共有 4 個文件被更改,包括 69 次插入27 次删除
  1. 24 5
      INSTALL
  2. 40 18
      Makefile
  3. 1 1
      Makefile.cfg
  4. 4 3
      Makefile.targets

+ 24 - 5
INSTALL

@@ -258,8 +258,19 @@ make modules=modules/print modules
 make cfg modules=modules/print mode=debug PROFILE=-pg
 make all
 
+- change & save the  modules list without rebuilding the whole config
+ (so that already compiled modules won't be re-compiled by 
+  make all/make modules):
+
+make modules-cfg include_modules="mysql postgress"
+
+- change only the compile/build options, without changing the modules list:
+
+make cfg-defs CPU=ultrasparc PROFILE=-pg
+
 - compile by default all the usual modules + mysql and postgres, optimized 
-for pentium-m and for space
+for pentium-m and for space (saves both the build options and the module 
+ list)
 
 make cfg include_modules="mysql postgres" CPU=pentium-m CC_EXTRA_OPTS=-Os
 make all
@@ -309,7 +320,7 @@ Make targets:
 
 Configure:
 
-make cfg or make config (force config regeneration and store it in config.mak)
+make cfg or make config (force config and module list regeneration)
 
 Example: make cfg include_modules=mysql mode=debug  (all future make 
 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
 proper) or if Makefile.defs was changed, the config will be re-generated
 automatically by the first make command. For example:
  make cfg  include_modules=mysql; make all is equivalent to 
- rm config.mak; make include_modules=mysql.
+ rm config.mak modules.lst; make include_modules=mysql.
+
+make cfg-defs  (force config regeneration, but don't touch the module list)
+
+Example: make cfg-defs CPU=ultrasparc CC_EXTRA_OPTS=-Os PROFILE=-pg
 
+make modules-cfg or
+make modules-list    (saves the module list, without regenerating the 
+                       build config)
+Example: make modules-list include_modules="tls" skip_modules="print"
 
 Clean:
 
 make clean   (clean the modules too)
 make proper  (clean also the dependencies and the config)
 make distclean (the same as proper)
-make mantainer-clean (clean everything, including make's config, auto 
- generated files, tags, *.dbg a.s.o)
+make mantainer-clean (clean everything, including make's config, saved 
+  module list, auto generated files, tags, *.dbg a.s.o)
 make clean-all (clean all the modules in modules/*)
 make proper-all (like make proper but for all the  modules in modules/*)
 

+ 40 - 18
Makefile

@@ -50,6 +50,11 @@
 #  2008-06-25  make cfg support (use a pre-built cfg.: config.mak) (andrei)
 #  2008-06-28  added clean-all, proper-all, install-modules-man and error 
 #               checks for install-utils & doc (andrei)
+#  2008-07-01  split module list from config.mak into modules.lst so that
+#               the modules list can be changed without rebuilding the whole
+#               ser (andrei)
+#              added cfg-defs, new target that only rebuilds config.mak
+#
 
 auto_gen=lex.yy.c cfg.tab.c #lexx, yacc etc
 auto_gen_others=cfg.tab.h  # auto generated, non-c
@@ -197,7 +202,7 @@ ALLDEP=config.mak Makefile Makefile.sources Makefile.rules
 
 
 # try saved cfg, unless we are in the process of building it
-ifeq (,$(filter config.mak config cfg,$(MAKECMDGOALS)))
+ifeq (,$(filter config.mak config cfg cfg-defs,$(MAKECMDGOALS)))
 include config.mak
 ifeq ($(makefile_defs),1)
 $(info config.mak loaded)
@@ -205,7 +210,7 @@ $(info config.mak loaded)
 config_mak=1
 endif
 else
-ifneq (,$(filter cfg config,$(word 1,$(MAKECMDGOALS))))
+ifneq (,$(filter cfg config cfg-defs,$(word 1,$(MAKECMDGOALS))))
 # needed here to avoid starting a config submake 
 # (e.g. rm -f config.mak; make config.mak), which would either require 
 # double Makefile.defs defines execution (suboptimal), would loose
@@ -215,6 +220,8 @@ $(shell rm -rf config.mak)
 endif
 endif
 
+include modules.lst
+
 main_makefile=1
 include Makefile.defs
 
@@ -317,10 +324,19 @@ else
 config.mak: Makefile.defs
 	@echo making config...
 	@echo "# this file is autogenerated by make cfg" >$@
-	@echo "# `date`" >>$@
 	@$(call mapf2,cfg_save_var,saved_fixed_vars,$(@))
 	@$(call mapf2,cfg_save_var2,saved_chg_vars,$(@))
 	@echo "override makefile_defs:=1" >>$@
+	@echo "DEFS:=\$$(filter-out \$$(DEFS_RM) \$$(extra_defs),\$$(DEFS))" \
+					"\$$(extra_defs)"  >>$@
+	@echo "CFLAGS:=\$$(filter-out \$$(CFLAGS_RM) \$$(CC_EXTRA_OPTS)," \
+						"\$$(CFLAGS)) \$$(CC_EXTRA_OPTS)" >>$@
+
+endif # ifeq ($(config_mak),1)
+
+modules.lst:
+	@echo  saving modules list...
+	@echo "# this file is autogenerated by make modules-cfg" >$@
 	@$(call cfg_save_var2,group_include,$@)
 	@$(call cfg_save_var2,include_modules,$@)
 	@$(call cfg_save_var2,static_modules,$@)
@@ -330,18 +346,16 @@ config.mak: Makefile.defs
 	@$(call cfg_save_var2,modules_noinc,$@)
 	@$(call cfg_save_var2,modules,$@)
 	@echo "modules_configured:=1" >>$@
-	@echo "DEFS:=\$$(filter-out \$$(DEFS_RM) \$$(extra_defs),\$$(DEFS))" \
-					"\$$(extra_defs)"  >>$@
-	@echo "CFLAGS:=\$$(filter-out \$$(CFLAGS_RM) \$$(CC_EXTRA_OPTS)," \
-						"\$$(CFLAGS)) \$$(CC_EXTRA_OPTS)" >>$@
 
-endif # ifeq ($(config_mak),1)
+.PHONY: cfg config cfg-defs
+cfg-defs: config.mak
 
-.PHONY: cfg config
-cfg config: config.mak
+cfg config: cfg-defs modules-cfg
 
-#rm -f config.mak
-#$(MAKE) config.mak exported_vars=0 
+.PHONY: modules-cfg modules-list modules-lst
+modules-cfg modules-list modules-lst: 
+	rm -rf modules.lst
+	$(MAKE) modules.lst
 
 .PHONY: all
 all: $(NAME) modules
@@ -356,7 +370,7 @@ print-modules:
 	echo The following modules will be made: $(modules_basenames) ; \
 
 .PHONY: modules
-modules:
+modules: modules.lst
 	@for r in $(modules) "" ; do \
 		if [ -n "$$r" -a -r "$$r/Makefile" ]; then \
 			echo  "" ; \
@@ -420,6 +434,7 @@ tar:
 		--exclude=libiname.lst \
 		--exclude=makecfg.lst \
 		--exclude=config.mak \
+		--exclude=modules.lst \
 		--exclude=*.[do] \
 		--exclude=*.so \
 		--exclude=*.il \
@@ -475,7 +490,7 @@ sunpkg:
 	rm -rf tmp/ser_sun_pkg
 
 .PHONY: modules-doc
-modules-doc:
+modules-doc: modules.lst
 	-@for r in $(modules) "" ; do \
 		if [ -n "$$r" ]; then \
 			echo  "" ; \
@@ -488,7 +503,7 @@ modules-doc:
 modules-readme: README
 
 .PHONY: README
-README:
+README: modules.lst
 	-@for r in $(modules) "" ; do \
 		if [ -n "$$r" ]; then \
 			echo  "" ; \
@@ -505,7 +520,7 @@ README:
 modules-man: man
 
 .PHONY: man
-man:
+man: modules.lst
 	-@for r in $(modules) "" ; do \
 		if [ -n "$$r" ]; then \
 			echo  "" ; \
@@ -609,7 +624,7 @@ install-share: $(share_prefix)/$(share_dir)
 		fi ; \
 	done; true
 
-install-modules: $(modules_prefix)/$(modules_dir)
+install-modules: modules.lst $(modules_prefix)/$(modules_dir)
 	@for r in $(modules) "" ; do \
 		if [ -n "$$r" -a -r "$$r/Makefile" ]; then \
 			echo  "" ; \
@@ -676,7 +691,7 @@ install-doc: $(doc_prefix)/$(doc_dir) install-modules-doc
 	$(INSTALL_DOC) README $(doc_prefix)/$(doc_dir)
 
 
-install-modules-doc: $(doc_prefix)/$(doc_dir)
+install-modules-doc: modules.lst $(doc_prefix)/$(doc_dir)
 	@for r in $(modules_basenames) "" ; do \
 		if [ -n "$$r" ]; then \
 			if [ -f modules/"$$r"/README ]; then \
@@ -738,8 +753,12 @@ clean:	clean_libs
 clean-all: modules=$(modules_all)
 clean-all: clean
 
+# on make proper clean also the build config (w/o module list)
 proper realclean distclean: clean_cfg 
 
+# on maintainer clean, remove also the configured module list
+maintainer-clean: clean_modules_cfg
+
 .PHONY: proper-all realclean-all distclean-all
 proper-all realclean-all distclean-all: modules=$(modules_all)
 proper-all realclean-all distclean-all: proper
@@ -749,3 +768,6 @@ proper-all realclean-all distclean-all: proper
 clean_cfg:
 	rm -f config.mak
 
+.PHONY: clean_modules_cfg clean-modules-cfg
+clean_modules_cfg clean-modules-cfg:
+	rm -f modules.lst

+ 1 - 1
Makefile.cfg

@@ -16,5 +16,5 @@ $(COREPATH)/config.mak: makefile_defs=0
 $(COREPATH)/config.mak: exported_vars=0
 
 $(COREPATH)/config.mak: $(COREPATH)/Makefile.defs
-	$(MAKE) -wC $(COREPATH) cfg
+	$(MAKE) -wC $(COREPATH) cfg-defs
 

+ 4 - 3
Makefile.targets

@@ -14,13 +14,14 @@
 #
 
 clean_targets:=	clean proper distclean realclean mantainer-clean clean_libs \
-				clean-all proper-all distclean-all realclean-all
+				clean-all proper-all distclean-all realclean-all \
+				clean_cfg clean_modules_cfg clean-modules-cfg
 doc_targets:=	modules-doc modules-readme README modules-man man \
 		install-doc install-modules-doc install-man install-ser-man \
 		install-modules-man
 # auxiliary: maintance, debugging, etc. (don't affect code/objects)
-aux_targets:=	TAGS tar dist cfg config config.mak print-modules dbg \
-		dbinstall librpath.lst makecfg.lst
+aux_targets:=	TAGS tar dist cfg-defs cfg config config.mak print-modules \
+		dbg dbinstall librpath.lst makecfg.lst modules.lst
 # other targets that don't produce code in the current directory ("external")
 ext_targets:=	modules libs utils \
 		install-cfg install-modules install-utils  install-modules-all \