From d6d28acee05db669c55b53095044c6a791127c14 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 24 Dec 2014 13:23:27 +0900 Subject: kbuild: move asm-offsets.h rule to ./Kbuild Currently, MIPS is the only architecture that needs include/generated/asm-offsets.h, but we have got ./Kbuild file now. It is a good reason to move asm-offsets.h rule from arch/mips/Makefile to ./Kbuild and add dummy asm-offsets.c for the other architectures. asm-offsets.h would be useful for all the architectures. This commit does not implement include/generated/bounds.h, but if necessary, it is easy to implement it. Signed-off-by: Masahiro Yamada Signed-off-by: Sascha Hauer --- Kbuild | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'Kbuild') diff --git a/Kbuild b/Kbuild index 0c3f408958..329609604f 100644 --- a/Kbuild +++ b/Kbuild @@ -1,2 +1,43 @@ -# This does nothing, but some (dummy) comments here. -# If this file gets empty, it is removed by "make distclean". +##### +# 1) Generate asm-offsets.h +# + +offsets-file := include/generated/asm-offsets.h + +always += $(offsets-file) +targets += $(offsets-file) +targets += arch/$(SRCARCH)/lib/asm-offsets.s + + +# Default sed regexp - multiline due to syntax constraints +define sed-y + "/^->/{s:->#\(.*\):/* \1 */:; \ + s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ + s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ + s:->::; p;}" +endef + +quiet_cmd_offsets = GEN $@ +define cmd_offsets + (set -e; \ + echo "#ifndef __ASM_OFFSETS_H__"; \ + echo "#define __ASM_OFFSETS_H__"; \ + echo "/*"; \ + echo " * DO NOT MODIFY."; \ + echo " *"; \ + echo " * This file was generated by Kbuild"; \ + echo " *"; \ + echo " */"; \ + echo ""; \ + sed -ne $(sed-y) $<; \ + echo ""; \ + echo "#endif" ) > $@ +endef + +# We use internal kbuild rules to avoid the "is up to date" message from make +arch/$(SRCARCH)/lib/asm-offsets.s: arch/$(SRCARCH)/lib/asm-offsets.c FORCE + $(Q)mkdir -p $(dir $@) + $(call if_changed_dep,cc_s_c) + +$(obj)/$(offsets-file): arch/$(SRCARCH)/lib/asm-offsets.s Kbuild + $(call cmd,offsets) -- cgit v1.2.3