Browse code

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 authored on 22/04/2009 15:09:13
Showing 3 changed files
... ...
@@ -353,7 +353,7 @@ make proper-all (like make proper but for all the  modules in modules/*)
353 353
 
354 354
 Config clean:
355 355
 
356
-make clean_cfg (cleans the compile config)
356
+make clean-cfg (cleans the compile config)
357 357
 make clean-modules-cfg (cleans the modules list)
358 358
 
359 359
 "Reduced" clean:
... ...
@@ -59,6 +59,8 @@
59 59
 #  2009-04-02  workaround for export not supported in gnu make 3.80
60 60
 #               target specific variables: use mk_params for each
61 61
 #               $(MAKE) invocation (andrei)
62
+#  2009-04-22  don't rebuild config.mak or modules.lst if not needed
63
+#              (e.g. on clean) (andrei)
62 64
 #
63 65
 
64 66
 # check make version
... ...
@@ -76,6 +78,8 @@ auto_gen_others=cfg.tab.h  # auto generated, non-c
76 76
 
77 77
 #include  source related defs
78 78
 include Makefile.sources
79
+#include special targets lists
80
+include Makefile.targets
79 81
 
80 82
 # whether or not the entire build process should fail if building a module or
81 83
 #  an utility fails
... ...
@@ -93,7 +97,15 @@ skip_modules?=
93 93
 # Alternatives are txt, html, xhtml, and pdf (see Makefile.doc)
94 94
 doc_format?=html
95 95
 
96
+# don't force modules.lst generation if the makefile goals do not
97
+# require it (but if present use it)
98
+ifeq (,$(strip $(filter-out $(clean_targets) $(aux_targets),$(MAKECMDGOALS))))
99
+ifneq (,$(strip $(wildcard modules.lst)))
100
+-include modules.lst
101
+endif
102
+else
96 103
 include modules.lst
104
+endif # ifneq (,$(strip $(filter-out ...,$(MAKECMDGOALS))))
97 105
 
98 106
 #if called with group_include, ignore the modules from modules.lst
99 107
 ifneq ($(group_include),)
... ...
@@ -221,15 +233,17 @@ ALLDEP=config.mak Makefile Makefile.sources Makefile.rules
221 221
 #C_DEFS:=
222 222
 
223 223
 
224
-# try saved cfg, unless we are in the process of building it
225
-ifeq (,$(filter config.mak config cfg cfg-defs,$(MAKECMDGOALS)))
224
+# try saved cfg, unless we are in the process of building it or if we're doing
225
+# a clean
226
+ifeq (,$(strip \
227
+	$(filter config.mak config cfg cfg-defs $(clean_targets),$(MAKECMDGOALS))))
226 228
 include config.mak
227 229
 ifeq ($(makefile_defs),1)
228 230
 $(info config.mak loaded)
229 231
 # config_make valid & used
230 232
 config_mak=1
231 233
 endif
232
-else
234
+else # config.mak doesn't need to be used
233 235
 ifneq (,$(filter cfg config cfg-defs,$(word 1,$(MAKECMDGOALS))))
234 236
 # needed here to avoid starting a config submake 
235 237
 # (e.g. rm -f config.mak; make config.mak), which would either require 
... ...
@@ -318,7 +332,6 @@ ifneq ($(TLS),)
318 318
 endif
319 319
 
320 320
 # include the common rules
321
-include Makefile.targets
322 321
 include Makefile.rules
323 322
 
324 323
 #extra targets 
... ...
@@ -366,13 +379,14 @@ modules.lst:
366 366
 	@$(call cfg_save_var2,modules,$@)
367 367
 	@echo "modules_configured:=1" >>$@
368 368
 
369
+
369 370
 .PHONY: cfg config cfg-defs
370 371
 cfg-defs: config.mak
371 372
 
372 373
 cfg config: cfg-defs modules-cfg
373 374
 
374 375
 .PHONY: modules-cfg modules-list modules-lst
375
-modules-cfg modules-list modules-lst: 
376
+modules-cfg modules-list modules-lst:
376 377
 	rm -f modules.lst
377 378
 	$(MAKE) modules.lst
378 379
 
... ...
@@ -806,8 +820,8 @@ proper-all realclean-all distclean-all: modules=$(modules_all)
806 806
 proper-all realclean-all distclean-all: proper
807 807
 
808 808
 
809
-.PHONY: clean_cfg
810
-clean_cfg:
809
+.PHONY: clean_cfg clean-cfg
810
+clean_cfg clean-cfg:
811 811
 	rm -f config.mak
812 812
 
813 813
 .PHONY: clean_modules_cfg clean-modules-cfg
... ...
@@ -15,7 +15,7 @@
15 15
 
16 16
 clean_targets:=	clean proper distclean realclean maintainer-clean local-clean \
17 17
 				clean-all proper-all distclean-all realclean-all \
18
-				clean_cfg clean_modules_cfg clean-modules-cfg \
18
+				clean_cfg clean-cfg clean_modules_cfg clean-modules-cfg \
19 19
 				clean-modules proper-modules realclean-modules \
20 20
 				distclean-modules maintainer-clean-modules \
21 21
 				clean-utils proper-utils realclean-utils distclean-utils \
... ...
@@ -28,7 +28,8 @@ doc_targets:=	modules-doc modules-readme README modules-man man \
28 28
 		install-modules-man
29 29
 # auxiliary: maintance, debugging, etc. (don't affect code/objects)
30 30
 aux_targets:=	TAGS tar dist cfg-defs cfg config config.mak print-modules \
31
-		dbg dbinstall librpath.lst makecfg.lst modules.lst
31
+		dbg dbinstall librpath.lst makecfg.lst modules.lst modules-cfg \
32
+		modules-list modules-lst
32 33
 # other targets that don't produce code in the current directory ("external")
33 34
 ext_targets:=	modules libs utils \
34 35
 		install-cfg install-modules install-utils  install-modules-all \