]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Avoid deleting config header files if build is interrupted
authorMichael Brown <mcb30@ipxe.org>
Tue, 26 Aug 2014 14:05:48 +0000 (15:05 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 26 Aug 2014 14:08:46 +0000 (15:08 +0100)
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>
src/Makefile.housekeeping

index 0e490f61f8000e51a85671099dcc259f75615af9..b2c695947cea88b2183a15c16ba9e22b548f25f2 100644 (file)
@@ -717,6 +717,8 @@ endif
 config/named.h : $(CONFIG_LIST)
        $(Q)$(TOUCH) $@
 
+.PRECIOUS : config/named.h
+
 # These files use .incbin inline assembly to include a binary file.
 # Unfortunately ccache does not detect this dependency and caches
 # builds even when the binary file has changed.
@@ -1289,14 +1291,25 @@ CLEANUP += $(EINFO)
 # Local configs
 #
 CONFIG_HEADERS := $(patsubst config/%,%,$(wildcard config/*.h))
+CONFIG_LOCAL_HEADERS := $(foreach HEADER,$(CONFIG_HEADERS),\
+                                 config/local/$(HEADER))
 
-$(foreach HEADER,$(CONFIG_HEADERS),config/local/$(HEADER)) :
+$(CONFIG_LOCAL_HEADERS) :
        $(Q)$(TOUCH) $@
 
+.PRECIOUS : $(CONFIG_LOCAL_HEADERS)
+
 ifneq ($(CONFIG),)
-$(foreach HEADER,$(CONFIG_HEADERS),config/local/$(CONFIG)/$(HEADER)) :
+
+CONFIG_LOCAL_NAMED_HEADERS := $(foreach HEADER,$(CONFIG_HEADERS),\
+                                       config/local/$(CONFIG)/$(HEADER))
+
+$(CONFIG_LOCAL_NAMED_HEADERS) :
        $(Q)$(MKDIR) -p $(dir $@)
        $(Q)$(TOUCH) $@
+
+.PRECIOUS : $(CONFIG_LOCAL_NAMED_HEADERS)
+
 endif
 
 ###############################################################################