[SR-Dev] git:ser_core_cvs: makefile: config and modules.lst minor fixes

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Apr 23 12:51:08 CEST 2009


Module: sip-router
Branch: ser_core_cvs
Commit: 3f52ab26d1bcdbb6c03e1ba94b5b48b8880404e8
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=3f52ab26d1bcdbb6c03e1ba94b5b48b8880404e8

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Wed Apr 22 15:09:13 2009 +0000

makefile: config and modules.lst minor fixes

- don't build the config on clean (even if not present)
- don't build the modules.lst unless needed (don't build it on
  clean, core only make a.s.o)

---

 INSTALL          |    2 +-
 Makefile         |   28 +++++++++++++++++++++-------
 Makefile.targets |    5 +++--
 3 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/INSTALL b/INSTALL
index 4618835..4d659b0 100644
--- a/INSTALL
+++ b/INSTALL
@@ -353,7 +353,7 @@ make proper-all (like make proper but for all the  modules in modules/*)
 
 Config clean:
 
-make clean_cfg (cleans the compile config)
+make clean-cfg (cleans the compile config)
 make clean-modules-cfg (cleans the modules list)
 
 "Reduced" clean:
diff --git a/Makefile b/Makefile
index 98ff4d2..2c87003 100644
--- a/Makefile
+++ b/Makefile
@@ -59,6 +59,8 @@
 #  2009-04-02  workaround for export not supported in gnu make 3.80
 #               target specific variables: use mk_params for each
 #               $(MAKE) invocation (andrei)
+#  2009-04-22  don't rebuild config.mak or modules.lst if not needed
+#              (e.g. on clean) (andrei)
 #
 
 # check make version
@@ -76,6 +78,8 @@ auto_gen_others=cfg.tab.h  # auto generated, non-c
 
 #include  source related defs
 include Makefile.sources
+#include special targets lists
+include Makefile.targets
 
 # whether or not the entire build process should fail if building a module or
 #  an utility fails
@@ -93,7 +97,15 @@ skip_modules?=
 # Alternatives are txt, html, xhtml, and pdf (see Makefile.doc)
 doc_format?=html
 
+# don't force modules.lst generation if the makefile goals do not
+# require it (but if present use it)
+ifeq (,$(strip $(filter-out $(clean_targets) $(aux_targets),$(MAKECMDGOALS))))
+ifneq (,$(strip $(wildcard modules.lst)))
+-include modules.lst
+endif
+else
 include modules.lst
+endif # ifneq (,$(strip $(filter-out ...,$(MAKECMDGOALS))))
 
 #if called with group_include, ignore the modules from modules.lst
 ifneq ($(group_include),)
@@ -221,15 +233,17 @@ ALLDEP=config.mak Makefile Makefile.sources Makefile.rules
 #C_DEFS:=
 
 
-# try saved cfg, unless we are in the process of building it
-ifeq (,$(filter config.mak config cfg cfg-defs,$(MAKECMDGOALS)))
+# try saved cfg, unless we are in the process of building it or if we're doing
+# a clean
+ifeq (,$(strip \
+	$(filter config.mak config cfg cfg-defs $(clean_targets),$(MAKECMDGOALS))))
 include config.mak
 ifeq ($(makefile_defs),1)
 $(info config.mak loaded)
 # config_make valid & used
 config_mak=1
 endif
-else
+else # config.mak doesn't need to be used
 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 
@@ -318,7 +332,6 @@ ifneq ($(TLS),)
 endif
 
 # include the common rules
-include Makefile.targets
 include Makefile.rules
 
 #extra targets 
@@ -366,13 +379,14 @@ modules.lst:
 	@$(call cfg_save_var2,modules,$@)
 	@echo "modules_configured:=1" >>$@
 
+
 .PHONY: cfg config cfg-defs
 cfg-defs: config.mak
 
 cfg config: cfg-defs modules-cfg
 
 .PHONY: modules-cfg modules-list modules-lst
-modules-cfg modules-list modules-lst: 
+modules-cfg modules-list modules-lst:
 	rm -f modules.lst
 	$(MAKE) modules.lst
 
@@ -806,8 +820,8 @@ proper-all realclean-all distclean-all: modules=$(modules_all)
 proper-all realclean-all distclean-all: proper
 
 
-.PHONY: clean_cfg
-clean_cfg:
+.PHONY: clean_cfg clean-cfg
+clean_cfg clean-cfg:
 	rm -f config.mak
 
 .PHONY: clean_modules_cfg clean-modules-cfg
diff --git a/Makefile.targets b/Makefile.targets
index 8f287ab..ec187a1 100644
--- a/Makefile.targets
+++ b/Makefile.targets
@@ -15,7 +15,7 @@
 
 clean_targets:=	clean proper distclean realclean maintainer-clean local-clean \
 				clean-all proper-all distclean-all realclean-all \
-				clean_cfg clean_modules_cfg clean-modules-cfg \
+				clean_cfg clean-cfg clean_modules_cfg clean-modules-cfg \
 				clean-modules proper-modules realclean-modules \
 				distclean-modules maintainer-clean-modules \
 				clean-utils proper-utils realclean-utils distclean-utils \
@@ -28,7 +28,8 @@ doc_targets:=	modules-doc modules-readme README modules-man man \
 		install-modules-man
 # auxiliary: maintance, debugging, etc. (don't affect code/objects)
 aux_targets:=	TAGS tar dist cfg-defs cfg config config.mak print-modules \
-		dbg dbinstall librpath.lst makecfg.lst modules.lst
+		dbg dbinstall librpath.lst makecfg.lst modules.lst modules-cfg \
+		modules-list 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 \




More information about the sr-dev mailing list