210-build-de-duplicate-_DIRS-before-calling-mkdir.patch 742 B

1234567891011121314151617181920212223
  1. From: Felix Fietkau <[email protected]>
  2. Date: Thu, 4 Apr 2024 12:59:41 +0200
  3. Subject: [PATCH] build: de-duplicate _DIRS before calling mkdir
  4. If the build path is long, the contents of the _DIRS variable can be very long,
  5. since it repeats the same directories very often.
  6. In some cases, this has triggered an "Argument list too long" build error.
  7. Suggested-by: Eneas U de Queiroz <[email protected]>
  8. Signed-off-by: Felix Fietkau <[email protected]>
  9. ---
  10. --- a/src/build.rules
  11. +++ b/src/build.rules
  12. @@ -80,7 +80,7 @@ endif
  13. _DIRS := $(BUILDDIR)/$(PROJ)
  14. .PHONY: _make_dirs
  15. _make_dirs:
  16. - @mkdir -p $(_DIRS)
  17. + @mkdir -p $(sort $(_DIRS))
  18. $(BUILDDIR)/$(PROJ)/src/%.o: $(ROOTDIR)src/%.c $(CONFIG_FILE) | _make_dirs
  19. $(Q)$(CC) -c -o $@ $(CFLAGS) $<