cb8171551d0e53acdae5fd159b4daaf7825a2812
[openwrt/staging/wigyori.git] /
1 From beeef79701082a82b2581a674e702ea60a358ce7 Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robimarko@gmail.com>
3 Date: Sun, 24 Mar 2024 20:47:06 +0100
4 Subject: [PATCH] build: make _make_dirs robust against too long argument error
5
6 _make_dirs currently can fail as _DIRS can be really long and thus go over
7 the MAX_ARG_STRLEN limit so it will fail with:
8 /bin/sh: Argument list too long
9
10 Lets avoid this by stripping the $(BUILDDIR) prefix and then restoring it.
11
12 Signed-off-by: Robert Marko <robimarko@gmail.com>
13 ---
14 src/build.rules | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17 --- a/src/build.rules
18 +++ b/src/build.rules
19 @@ -80,7 +80,7 @@ endif
20 _DIRS := $(BUILDDIR)/$(PROJ)
21 .PHONY: _make_dirs
22 _make_dirs:
23 - @mkdir -p $(_DIRS)
24 + @printf '$(BUILDDIR)/%s ' $(patsubst $(BUILDDIR)/%,%,$(_DIRS)) | xargs mkdir -p
25
26 $(BUILDDIR)/$(PROJ)/src/%.o: $(ROOTDIR)src/%.c $(CONFIG_FILE) | _make_dirs
27 $(Q)$(CC) -c -o $@ $(CFLAGS) $<