From f5644f1471159a147e93135145dd70c57cf62fe9 Mon Sep 17 00:00:00 2001 From: Pawel Wieczorkiewicz Date: Mon, 13 Nov 2023 16:01:25 +0100 Subject: [PATCH] Makefile: fix asm-offset generation Use explicit path for the to-be-generated header files, so make can make a timestamp comparison and not regenerate the headers every time. Signed-off-by: Pawel Wieczorkiewicz --- Makefile | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index d7eff244..e1d00089 100644 --- a/Makefile +++ b/Makefile @@ -150,8 +150,6 @@ ACPICA_INSTALL := $(shell [ -d $(ACPICA_DEST_DIR)/source ] || endif ASM_OFFSETS_C := asm-offsets.c -ASM_OFFSETS_S := asm-offsets.s -ASM_OFFSETS_H := asm-offsets.h ASM_OFFSETS_SH := $(KTF_ROOT)/tools/asm-offsets/asm-offsets.sh SOURCES := $(shell find . -name \*.c -and -not -name $(ASM_OFFSETS_C)) @@ -160,6 +158,9 @@ ASM_SOURCES := $(shell find . -name \*.S) ASM_OFFSETS := $(shell find . -name $(ASM_OFFSETS_C)) LINK_SCRIPT := $(shell find . -name \*.ld) +ASM_OFFSETS_H := $(shell for f in $(ASM_OFFSETS); do echo include/$${f%.c}.h; done) +ASM_OFFSETS_S := $(shell for f in $(ASM_OFFSETS); do echo $${f%.c}.s; done) + SYMBOLS_NAME := symbols SYMBOLS_TOOL := symbols.py SYMBOLS_DIR := tools/symbols @@ -217,10 +218,12 @@ $(PFMLIB_ARCHIVE): $(PFMLIB_TARBALL) @echo "CC " $@ $(VERBOSE) $(CC) -c -o $@ $(CFLAGS) $< -$(ASM_OFFSETS_H): $(ASM_OFFSETS) - @echo "GEN" include/$(shell dirname $<)/$(ASM_OFFSETS_H) - $(VERBOSE) $(CC) $(CFLAGS) -S -g0 -o $(KTF_ROOT)/$(shell dirname $<)/$(ASM_OFFSETS_S) $< - $(VERBOSE) $(ASM_OFFSETS_SH) $(KTF_ROOT)/$(shell dirname $<)/$(ASM_OFFSETS_S) $(KTF_ROOT)/include/$(shell dirname $<)/$(ASM_OFFSETS_H) +$(ASM_OFFSETS_S): $(ASM_OFFSETS) + $(VERBOSE) $(CC) $(CFLAGS) -S -g0 -o $@ $< + +$(ASM_OFFSETS_H): $(ASM_OFFSETS_S) + @echo "GEN" $@ + $(VERBOSE) $(ASM_OFFSETS_SH) $< $@ DEPFILES := $(OBJS:.o=.d) -include $(wildcard $(DEPFILES)) @@ -236,9 +239,8 @@ clean: $(VERBOSE) find $(KTF_ROOT) -name \*.xz -delete $(VERBOSE) find $(KTF_ROOT) -name cscope.\* -delete $(VERBOSE) find $(KTF_ROOT) -maxdepth 1 \( -name tags -or -name TAGS \) -delete - $(VERBOSE) find $(KTF_ROOT) -name $(ASM_OFFSETS_S) -delete - $(VERBOSE) find $(KTF_ROOT) -name $(ASM_OFFSETS_H) -delete $(VERBOSE) find $(PFMLIB_DIR) -mindepth 1 ! -name $(PFMLIB_NAME)-$(PFMLIB_VER).tar.gz -delete + $(VERBOSE) $(RM) -f $(ASM_OFFSETS_H) $(ASM_OFFSETS_S) $(VERBOSE) $(RM) -rf $(ACPICA_DEST_DIR)/source $(VERBOSE) $(RM) -f $(TARGET_DEBUG) $(VERBOSE) $(RM) -rf $(GRUB_DIR)