Make 'make clean all' work

In this case, the 'clean' step would nuke the metadata files, but they have
already been read, so in-memory state is fine.  This triggered a couple of
pathological conditions that would not normally be hit.  This commit fills in
those nodes in the DAG, even though they are not directly needed in most
builds.

Also fix some whitespace for readability.
This commit is contained in:
Tim Hockin 2016-07-19 16:42:28 -07:00
parent afe4977c9b
commit ab703e0406

View File

@ -139,12 +139,18 @@ $(foreach dir, $(ALL_GO_DIRS), $(eval \
# We regenerate the output file in order to satisfy make's "newer than" rules, # We regenerate the output file in order to satisfy make's "newer than" rules,
# but we only need to rebuild targets if the contents actually changed. That # but we only need to rebuild targets if the contents actually changed. That
# is what the .stamp file represents. # is what the .stamp file represents.
$(foreach dir, $(ALL_GO_DIRS), $(META_DIR)/$(dir)/$(GOFILES_META)): $(foreach dir, $(ALL_GO_DIRS), \
$(META_DIR)/$(dir)/$(GOFILES_META)):
FILES=$$(ls $</*.go | grep --color=never -v $(GENERATED_FILE_PREFIX)); \ FILES=$$(ls $</*.go | grep --color=never -v $(GENERATED_FILE_PREFIX)); \
mkdir -p $(@D); \ mkdir -p $(@D); \
echo "gofiles__$< := $$(echo $${FILES})" >$@.tmp; \ echo "gofiles__$< := $$(echo $${FILES})" >$@.tmp; \
cmp -s $@.tmp $@ || touch $@.stamp; \ cmp -s $@.tmp $@ || touch $@.stamp; \
mv $@.tmp $@ mv $@.tmp $@
# This is required to fill in the DAG, since some cases (e.g. 'make clean all')
# will reference the .stamp file when it doesn't exist. We don't need to
# rebuild it in that case, just keep make happy.
$(foreach dir, $(ALL_GO_DIRS), \
$(META_DIR)/$(dir)/$(GOFILES_META).stamp):
# Include any deps files as additional Makefile rules. This triggers make to # Include any deps files as additional Makefile rules. This triggers make to
# consider the deps files for rebuild, which makes the whole # consider the deps files for rebuild, which makes the whole
@ -228,6 +234,7 @@ $(shell rm -f $(META_DIR)/$(DEEPCOPY_GEN)*.todo)
# How to regenerate deep-copy code. This is a little slow to run, so we batch # How to regenerate deep-copy code. This is a little slow to run, so we batch
# it up and trigger the batch from the 'generated_files' target. # it up and trigger the batch from the 'generated_files' target.
$(DEEPCOPY_FILES): $(DEEPCOPY_GEN) $(DEEPCOPY_FILES): $(DEEPCOPY_GEN)
mkdir -p $$(dirname $(META_DIR)/$(DEEPCOPY_GEN))
echo $(PRJ_SRC_PATH)/$(@D) >> $(META_DIR)/$(DEEPCOPY_GEN).todo echo $(PRJ_SRC_PATH)/$(@D) >> $(META_DIR)/$(DEEPCOPY_GEN).todo
# This calculates the dependencies for the generator tool, so we only rebuild # This calculates the dependencies for the generator tool, so we only rebuild
@ -341,7 +348,8 @@ $(foreach dir, $(CONVERSION_DIRS), $(eval \
# We regenerate the output file in order to satisfy make's "newer than" rules, # We regenerate the output file in order to satisfy make's "newer than" rules,
# but we only need to rebuild targets if the contents actually changed. That # but we only need to rebuild targets if the contents actually changed. That
# is what the .stamp file represents. # is what the .stamp file represents.
$(foreach dir, $(CONVERSION_DIRS), $(META_DIR)/$(dir)/$(CONVERSIONS_META)): $(foreach dir, $(CONVERSION_DIRS), \
$(META_DIR)/$(dir)/$(CONVERSIONS_META)):
TAGS=$$(grep --color=never -h '^// *+k8s:conversion-gen=' $</*.go \ TAGS=$$(grep --color=never -h '^// *+k8s:conversion-gen=' $</*.go \
| cut -f2- -d= \ | cut -f2- -d= \
| sed 's|$(PRJ_SRC_PATH)/||'); \ | sed 's|$(PRJ_SRC_PATH)/||'); \
@ -407,6 +415,7 @@ $(shell rm -f $(META_DIR)/$(CONVERSION_GEN)*.todo)
# How to regenerate conversion code. This is a little slow to run, so we batch # How to regenerate conversion code. This is a little slow to run, so we batch
# it up and trigger the batch from the 'generated_files' target. # it up and trigger the batch from the 'generated_files' target.
$(CONVERSION_FILES): $(CONVERSION_GEN) $(CONVERSION_FILES): $(CONVERSION_GEN)
mkdir -p $$(dirname $(META_DIR)/$(CONVERSION_GEN))
echo $(PRJ_SRC_PATH)/$(@D) >> $(META_DIR)/$(CONVERSION_GEN).todo echo $(PRJ_SRC_PATH)/$(@D) >> $(META_DIR)/$(CONVERSION_GEN).todo
# This calculates the dependencies for the generator tool, so we only rebuild # This calculates the dependencies for the generator tool, so we only rebuild