Here's another oddity I ran into with the build system. Try run make twice. With arm64 and ppc64, the first time it removes some intermediate files and the second causes another rebuild of several files. After that it's fine. s390x seems to follow a similar pattern but does not suffer from the problem. Also, the .PRECIOUS directive is not preventing them from being deleted inthe first place. So... that probably means I haven't understood it properly and the fix may not be correct, but it does appear to DTRT... Anybody with some good Makefile knowledge might have a better idea. Thanks, Nick --- powerpc and arm64 remove .aux.o files because they are seen as intermediate, I think because they don't have an explicit target (for some reason not s390x, haven't tested arm or riscv). This causes them to be those files to be removed after the make runs. If make is run again the .aux.o and .elf targets are rebuild, but for some reason they are treated differently and not removed, leading to the 3rd make being a no-op. --- arm/Makefile.common | 3 ++- powerpc/Makefile.common | 2 +- riscv/Makefile | 2 +- s390x/Makefile | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arm/Makefile.common b/arm/Makefile.common index f828dbe01..3ebbcc13e 100644 --- a/arm/Makefile.common +++ b/arm/Makefile.common @@ -72,7 +72,7 @@ eabiobjs = lib/arm/eabi_compat.o FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libeabi) ifeq ($(CONFIG_EFI),y) -%.aux.o: $(SRCDIR)/lib/auxinfo.c +$(tests-all:.$(exe)=.aux.o): $(SRCDIR)/lib/auxinfo.c $(CC) $(CFLAGS) -c -o $@ $< \ -DPROGNAME=\"$(@:.aux.o=.efi)\" -DAUXFLAGS=$(AUXFLAGS) @@ -92,6 +92,7 @@ ifeq ($(CONFIG_EFI),y) -j .reloc \ -O binary $^ $@ else +$(tests-all:.$(exe)=.aux.o): $(SRCDIR)/lib/auxinfo.c %.aux.o: $(SRCDIR)/lib/auxinfo.c $(CC) $(CFLAGS) -c -o $@ $< \ -DPROGNAME=\"$(@:.aux.o=.flat)\" -DAUXFLAGS=$(AUXFLAGS) diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common index b98f71c2f..3b219eee0 100644 --- a/powerpc/Makefile.common +++ b/powerpc/Makefile.common @@ -52,7 +52,7 @@ cflatobjs += lib/powerpc/smp.o OBJDIRS += lib/powerpc -%.aux.o: $(SRCDIR)/lib/auxinfo.c +$(tests-all:.elf=.aux.o): $(SRCDIR)/lib/auxinfo.c $(CC) $(CFLAGS) -c -o $@ $< -DPROGNAME=\"$(@:.aux.o=.elf)\" FLATLIBS = $(libcflat) $(LIBFDT_archive) diff --git a/riscv/Makefile b/riscv/Makefile index 919a3ebb5..4610cb4d4 100644 --- a/riscv/Makefile +++ b/riscv/Makefile @@ -81,7 +81,7 @@ CFLAGS += -I $(SRCDIR)/lib -I $(SRCDIR)/lib/libfdt asm-offsets = lib/riscv/asm-offsets.h include $(SRCDIR)/scripts/asm-offsets.mak -%.aux.o: $(SRCDIR)/lib/auxinfo.c +$(tests:.$(exe)=.aux.o): $(SRCDIR)/lib/auxinfo.c $(CC) $(CFLAGS) -c -o $@ $< \ -DPROGNAME=\"$(notdir $(@:.aux.o=.$(exe)))\" -DAUXFLAGS=$(AUXFLAGS) diff --git a/s390x/Makefile b/s390x/Makefile index 23342bd64..4c0c8085c 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -178,7 +178,7 @@ lds-autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -MT $@ %.lds: %.lds.S $(asm-offsets) $(CPP) $(lds-autodepend-flags) $(CPPFLAGS) -P -C -o $@ $< -%.aux.o: $(SRCDIR)/lib/auxinfo.c +$(tests:.elf=.aux.o): $(SRCDIR)/lib/auxinfo.c $(CC) $(CFLAGS) -c -o $@ $< -DPROGNAME=\"$(@:.aux.o=.elf)\" .SECONDEXPANSION: -- 2.43.0