summaryrefslogtreecommitdiff
path: root/scripts/Makefile.lib
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@quicinc.com>2017-10-26 07:35:30 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-10-26 07:35:30 -0700
commit2db878d52eef51fcc49af58f35db373ba6d09335 (patch)
tree7f8d2eba76747a5de20551d2a4ad2bd47486cced /scripts/Makefile.lib
parentdd2d19cd96f1d1bf2baa539c9178c169400bb707 (diff)
parentf9719b203c2d9b1a37de146fa6f19942f98fe69d (diff)
Merge "Merge android-4.4@d6fbbe5 (v4.4.93) into msm-4.4"
Diffstat (limited to 'scripts/Makefile.lib')
-rw-r--r--scripts/Makefile.lib31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 17c55e512de6..8567760b01e3 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -418,3 +418,34 @@ quiet_cmd_xzmisc = XZMISC $@
cmd_xzmisc = (cat $(filter-out FORCE,$^) | \
xz --check=crc32 --lzma2=dict=1MiB) > $@ || \
(rm -f $@ ; false)
+
+# ASM offsets
+# ---------------------------------------------------------------------------
+
+# Default sed regexp - multiline due to syntax constraints
+#
+# 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;}'
+endef
+
+# Use filechk to avoid rebuilds when a header changes, but the resulting file
+# does not
+define filechk_offsets
+ (set -e; \
+ echo "#ifndef $2"; \
+ echo "#define $2"; \
+ echo "/*"; \
+ echo " * DO NOT MODIFY."; \
+ echo " *"; \
+ echo " * This file was generated by Kbuild"; \
+ echo " */"; \
+ echo ""; \
+ sed -ne $(sed-offsets); \
+ echo ""; \
+ echo "#endif" )
+endef