diff mbox series

Makefile: fix generating environment file

Message ID 20210420135717.86185-1-oleksandr.suvorov@toradex.com
State Superseded
Delegated to: Tom Rini
Headers show
Series Makefile: fix generating environment file | expand

Commit Message

Oleksandr Suvorov April 20, 2021, 1:57 p.m. UTC
If the CONFIG_USE_DEFAULT_ENV_FILE=y and CONFIG_DEFAULT_ENV_FILE
points to the empty environment file, the auto-generated file has
wrong syntax so it leads to the compilation failure:

In file included from include/env_default.h:115,
                 from env/common.c:29:
include/generated/defaultenv_autogenerated.h:1:1: error: expected expression before ‘,’ token
    1 | , 0x00
      | ^
make[1]: *** [scripts/Makefile.build:266: env/common.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1744: env] Error 2

Fix this issue conditionally adding the delimiter ", ".

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
---

 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index e423f6de746..d42168661b3 100644
--- a/Makefile
+++ b/Makefile
@@ -1853,7 +1853,9 @@  define filechk_defaultenv.h
 	 grep -v '^$$' | \
 	 tr '\n' '\0' | \
 	 sed -e 's/\\\x0\s*//g' | \
-	 xxd -i ; echo ", 0x00" ; )
+	 xxd -i | \
+	 sed -r 's/([0-9])$$/\1, /'; \
+	 echo "0x00" ; )
 endef
 
 define filechk_dt.h