Skip to contentSkip to conversation

include: sort $(wildcard ...) results

PATCH In review Jan Beulich 2 participants 2 messages Apr 9, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 include: sort $(wildcard ...) results

The order of items is stored in .*.chk.cmd, and hence variations between how items are ordered would result in re-invocation of the checking rule during "make install-xen" despite that already having successfully run earlier on. The difference can become noticable when building (as non- root) and installing (as root) use different GNU make versions: In 3.82 the sorting was deliberately undone, just for it to be restored in 4.3.

---
While this was an issue already before, it became noticable with the toolchain baseline bump: The custom-built compilers I use, run directly from their build areas, wouldn't find the C++ header files when run as root. Hence the C++ checking rule would fail during "make install-xen", when needlessly re-run there.

xen/include/Makefile +3 -3
@@ -41,8 +41,8 @@ cppflags-$(CONFIG_X86)    += -m32
 
 endif
 
-public-$(CONFIG_X86) := $(wildcard $(srcdir)/public/arch-x86/*.h $(srcdir)/public/arch-x86/*/*.h)
-public-$(CONFIG_ARM) := $(wildcard $(srcdir)/public/arch-arm/*.h $(srcdir)/public/arch-arm/*/*.h)
+public-$(CONFIG_X86) := $(sort $(wildcard $(srcdir)/public/arch-x86/*.h $(srcdir)/public/arch-x86/*/*.h))
+public-$(CONFIG_ARM) := $(sort $(wildcard $(srcdir)/public/arch-arm/*.h $(srcdir)/public/arch-arm/*/*.h))
 
 .PHONY: all
 all: $(addprefix $(obj)/,$(headers-y) $(headers-n))
@@ -130,7 +130,7 @@ all: $(obj)/headers.chk $(obj)/headers99
 
 public-hdrs-path := $(srcdir)/public
 
-public-list-headers = $(wildcard $1/*.h $1/*/*.h)
+public-list-headers = $(sort $(wildcard $1/*.h $1/*/*.h))
 public-filter-headers = $(filter-out $(addprefix $(public-hdrs-path)/, $($1-filter)), $($1))
 
 public-headers := $(call public-list-headers, $(public-hdrs-path)) $(public-y)
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jan Beulich

The order of items is stored in .*.chk.cmd, and hence variations between how items are ordered would result in re-invocation of the checking rule during "make install-xen" despite that already having successfully run earlier on. The difference can become noticable when building (as non- root) and installing (as root) use different GNU make versions: In 3.82 the sorting was deliberately undone, just for it to be restored in 4.3.