Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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>
  • Loading branch information
mcb30 committed Aug 26, 2014
1 parent df202b3 commit bfe9f06
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/Makefile.housekeeping
Expand Up @@ -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.
Expand Down Expand Up @@ -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

###############################################################################
Expand Down

0 comments on commit bfe9f06

Please sign in to comment.