[PATCH] build: de-duplicate _DIRS before calling mkdir

Felix Fietkau nbd at nbd.name
Thu Apr 4 06:03:27 PDT 2024


If the build path is long, the contents of the _DIRS variable can be very long,
since it repeats the same directories very often.
In some cases, this has triggered an "Argument list too long" build error.

Reported-by: Robert Marko <robimarko at gmail.com>
Suggested-by: Eneas U de Queiroz <cotequeiroz at gmail.com>
Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 src/build.rules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/build.rules b/src/build.rules
index acda8847284d..c756ccb84e8c 100644
--- a/src/build.rules
+++ b/src/build.rules
@@ -80,7 +80,7 @@ endif
 _DIRS := $(BUILDDIR)/$(PROJ)
 .PHONY: _make_dirs
 _make_dirs:
-	@mkdir -p $(_DIRS)
+	@mkdir -p $(sort $(_DIRS))
 
 $(BUILDDIR)/$(PROJ)/src/%.o: $(ROOTDIR)src/%.c $(CONFIG_FILE) | _make_dirs
 	$(Q)$(CC) -c -o $@ $(CFLAGS) $<
-- 
2.43.0




More information about the Hostap mailing list