瀏覽代碼

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)
Andrei Pelinescu-Onciul 16 年之前
父節點
當前提交
3f52ab26d1
共有 3 個文件被更改,包括 25 次插入10 次删除
  1. 1 1
      INSTALL
  2. 21 7
      Makefile
  3. 3 2
      Makefile.targets

+ 1 - 1
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:

+ 21 - 7
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

+ 3 - 2
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 \