diff mbox series

[RFC,XEN,08/23] xen, Kbuild: Change filechk_offsets

Message ID 20191023164837.2700240-9-anthony.perard@citrix.com (mailing list archive)
State New, archived
Headers show
Series Kconfig update + WIP of using Kbuild | expand

Commit Message

Anthony PERARD Oct. 23, 2019, 4:48 p.m. UTC
This functions will be use later to generate asm-offsets.h.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/scripts/Makefile.lib | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/xen/scripts/Makefile.lib b/xen/scripts/Makefile.lib
index e022f053494e..19641e836dc3 100644
--- a/xen/scripts/Makefile.lib
+++ b/xen/scripts/Makefile.lib
@@ -413,29 +413,26 @@  quiet_cmd_xzmisc = XZMISC  $@
 # ASM offsets
 # ---------------------------------------------------------------------------
 
-# Default sed regexp - multiline due to syntax constraints
+# Default sed regexp
 #
-# Use [:space:] because LLVM's integrated assembler inserts <tab> around
-# the .ascii directive whereas GCC keeps the <space> as-is.
 define sed-offsets
-	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; \
-	/^->/{s:->#\(.*\):/* \1 */:; \
-	s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
-	s:->::; p;}'
+	'/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}'
 endef
 
 # Use filechk to avoid rebuilds when a header changes, but the resulting file
 # does not
 define filechk_offsets
-	 echo "#ifndef $2"; \
-	 echo "#define $2"; \
 	 echo "/*"; \
 	 echo " * DO NOT MODIFY."; \
 	 echo " *"; \
-	 echo " * This file was generated by Kbuild"; \
+	 echo " * This file was auto-generated from $<"; \
+	 echo " *"; \
 	 echo " */"; \
 	 echo ""; \
-	 sed -ne $(sed-offsets) < $<; \
+	 echo "#ifndef $2"; \
+	 echo "#define $2"; \
+	 echo ""; \
+	 sed -rne $(sed-offsets) < $<; \
 	 echo ""; \
 	 echo "#endif"
 endef