Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix make all being slow #2553

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 4 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -411,26 +411,14 @@ include prebuilds.mk
-include $(filter %.d,$(HVLOGOBJS:%.o=%.d))


# 'make all' calculates the current checksum of all .h and .hpp files, storing them in a file. Then it decides whether to run 'make clean' or 'make standard' based on whether any .h and .hpp files have been altered
# 'make all' calculates the current checksum of all .h and .hpp files, storing the checksum in a file. Then it decides whether to run 'make clean' or 'make standard' based on whether any .h and .hpp files have been altered
HEADER_CHECKSUM_FILE=.header_checksum
all:
@if [ ! -f $(HEADER_CHECKSUM_FILE) ]; then \
echo "No previous .header_checksum file found."; \
find ./src/ -type f \( -name "*.h" -o -name "*.hpp" \) -exec sha256sum {} \; | sort > $(HEADER_CHECKSUM_FILE); \
@current_checksum=$$(find ./src/ -type f \( -name "*.h" -o -name "*.hpp" \) -print0 | sort -z | xargs -0 md5sum | md5sum | awk '{print $$1}'); \
if [ ! -f $(HEADER_CHECKSUM_FILE) ] || [ "$$(cat $(HEADER_CHECKSUM_FILE))" != "$$current_checksum" ]; then \
$(MAKE) clean; \
else \
find ./src/ -type f \( -name "*.h" -o -name "*.hpp" \) -exec sha256sum {} \; | sort > .current_checksums; \
changed_files=$$(comm -23 .current_checksums $(HEADER_CHECKSUM_FILE) | awk '{print $$2}'); \
if [ ! -z "$$changed_files" ]; then \
echo "Changed header files:"; \
echo "\033[1;37m$$changed_files\033[0m"; \
$(MAKE) clean; \
else \
echo "No header files have been changed."; \
fi; \
mv .current_checksums $(HEADER_CHECKSUM_FILE); \
fi; \
$(MAKE) standard;
$(MAKE) standard && echo "$$current_checksum" > $(HEADER_CHECKSUM_FILE)

standard: CXXFLAGS += $(STLOGFLAGS)
standard: CFLAGS += $(STLOGFLAGS)
Expand Down