Browse Source

[build] Avoid deleting config header files if build is interrupted

With extremely unlucky timing, it is possible to interrupt a build and
cause make to delete config/named.h (and possibly any local
configuration headers).

Mark config/named.h and all local configuration headers as .PRECIOUS
to prevent make from ever deleting them.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
bfe9f06f9b
1 changed files with 15 additions and 2 deletions
  1. 15
    2
      src/Makefile.housekeeping

+ 15
- 2
src/Makefile.housekeeping View File

@@ -717,6 +717,8 @@ endif
717 717
 config/named.h : $(CONFIG_LIST)
718 718
 	$(Q)$(TOUCH) $@
719 719
 
720
+.PRECIOUS : config/named.h
721
+
720 722
 # These files use .incbin inline assembly to include a binary file.
721 723
 # Unfortunately ccache does not detect this dependency and caches
722 724
 # builds even when the binary file has changed.
@@ -1289,14 +1291,25 @@ CLEANUP += $(EINFO)
1289 1291
 # Local configs
1290 1292
 #
1291 1293
 CONFIG_HEADERS := $(patsubst config/%,%,$(wildcard config/*.h))
1294
+CONFIG_LOCAL_HEADERS := $(foreach HEADER,$(CONFIG_HEADERS),\
1295
+				  config/local/$(HEADER))
1292 1296
 
1293
-$(foreach HEADER,$(CONFIG_HEADERS),config/local/$(HEADER)) :
1297
+$(CONFIG_LOCAL_HEADERS) :
1294 1298
 	$(Q)$(TOUCH) $@
1295 1299
 
1300
+.PRECIOUS : $(CONFIG_LOCAL_HEADERS)
1301
+
1296 1302
 ifneq ($(CONFIG),)
1297
-$(foreach HEADER,$(CONFIG_HEADERS),config/local/$(CONFIG)/$(HEADER)) :
1303
+
1304
+CONFIG_LOCAL_NAMED_HEADERS := $(foreach HEADER,$(CONFIG_HEADERS),\
1305
+					config/local/$(CONFIG)/$(HEADER))
1306
+
1307
+$(CONFIG_LOCAL_NAMED_HEADERS) :
1298 1308
 	$(Q)$(MKDIR) -p $(dir $@)
1299 1309
 	$(Q)$(TOUCH) $@
1310
+
1311
+.PRECIOUS : $(CONFIG_LOCAL_NAMED_HEADERS)
1312
+
1300 1313
 endif
1301 1314
 
1302 1315
 ###############################################################################

Loading…
Cancel
Save