[PATCH] merge some from Rusty's trivial patches
[linux-3.10.git] / Kbuild
diff --git a/Kbuild b/Kbuild
index 197ece85034ba8ad983af531597b6b40610aa2c6..1880e6f760aab05f139d74400d2477e7c47681da 100644 (file)
--- a/Kbuild
+++ b/Kbuild
@@ -13,6 +13,13 @@ always  := $(offsets-file)
 targets := $(offsets-file)
 targets += arch/$(ARCH)/kernel/asm-offsets.s
 
+# Default sed regexp - multiline due to syntax constraints
+define sed-y
+       "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"
+endef
+# Override default regexp for specific architectures
+sed-$(CONFIG_MIPS) := "/^@@@/s///p"
+
 quiet_cmd_offsets = GEN     $@
 define cmd_offsets
        cat $< | \
@@ -26,7 +33,7 @@ define cmd_offsets
         echo " *"; \
         echo " */"; \
         echo ""; \
-        sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
+        sed -ne $(sed-y); \
         echo ""; \
         echo "#endif" ) > $@
 endef