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 78
 
77 79
 #include  source related defs
78 80
 include Makefile.sources
81
+#include special targets lists
82
+include Makefile.targets
79 83
 
80 84
 # whether or not the entire build process should fail if building a module or
81 85
 #  an utility fails
... ...
@@ -93,7 +97,15 @@ skip_modules?=
93 97
 # Alternatives are txt, html, xhtml, and pdf (see Makefile.doc)
94 98
 doc_format?=html
95 99
 
100
+# don't force modules.lst generation if the makefile goals do not
101
+# require it (but if present use it)
102
+ifeq (,$(strip $(filter-out $(clean_targets) $(aux_targets),$(MAKECMDGOALS))))
103
+ifneq (,$(strip $(wildcard modules.lst)))
104
+-include modules.lst
105
+endif
106
+else
96 107
 include modules.lst
108
+endif # ifneq (,$(strip $(filter-out ...,$(MAKECMDGOALS))))
97 109
 
98 110
 #if called with group_include, ignore the modules from modules.lst
99 111
 ifneq ($(group_include),)
... ...
@@ -221,15 +233,17 @@ ALLDEP=config.mak Makefile Makefile.sources Makefile.rules
221 233
 #C_DEFS:=
222 234
 
223 235
 
224
-# try saved cfg, unless we are in the process of building it
225
-ifeq (,$(filter config.mak config cfg cfg-defs,$(MAKECMDGOALS)))
236
+# try saved cfg, unless we are in the process of building it or if we're doing
237
+# a clean
238
+ifeq (,$(strip \
239
+	$(filter config.mak config cfg cfg-defs $(clean_targets),$(MAKECMDGOALS))))
226 240
 include config.mak
227 241
 ifeq ($(makefile_defs),1)
228 242
 $(info config.mak loaded)
229 243
 # config_make valid & used
230 244
 config_mak=1
231 245
 endif
232
-else
246
+else # config.mak doesn't need to be used
233 247
 ifneq (,$(filter cfg config cfg-defs,$(word 1,$(MAKECMDGOALS))))
234 248
 # needed here to avoid starting a config submake 
235 249
 # (e.g. rm -f config.mak; make config.mak), which would either require 
... ...
@@ -318,7 +332,6 @@ ifneq ($(TLS),)
318 332
 endif
319 333
 
320 334
 # include the common rules
321
-include Makefile.targets
322 335
 include Makefile.rules
323 336
 
324 337
 #extra targets 
... ...
@@ -366,13 +379,14 @@ modules.lst:
366 379
 	@$(call cfg_save_var2,modules,$@)
367 380
 	@echo "modules_configured:=1" >>$@
368 381
 
382
+
369 383
 .PHONY: cfg config cfg-defs
370 384
 cfg-defs: config.mak
371 385
 
372 386
 cfg config: cfg-defs modules-cfg
373 387
 
374 388
 .PHONY: modules-cfg modules-list modules-lst
375
-modules-cfg modules-list modules-lst: 
389
+modules-cfg modules-list modules-lst:
376 390
 	rm -f modules.lst
377 391
 	$(MAKE) modules.lst
378 392
 
... ...
@@ -806,8 +820,8 @@ proper-all realclean-all distclean-all: modules=$(modules_all)
806 820
 proper-all realclean-all distclean-all: proper
807 821
 
808 822
 
809
-.PHONY: clean_cfg
810
-clean_cfg:
823
+.PHONY: clean_cfg clean-cfg
824
+clean_cfg clean-cfg:
811 825
 	rm -f config.mak
812 826
 
813 827
 .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 \