[patch 02/03] kbuild, asm-values: successor of asm-offsets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	Some asm-offsets files define not only offsets, thus make it clear.
	Legacy files are supported, but may be freely changed to new scheme.

rfc-by: Oleg Verych
---
 If somebody agrees, of course.

 Kbuild |   68 ++++++++++++++++++++-------------------------------------------
 1 file changed, 24 insertions(+), 44 deletions(-)

Index: linux-2.6.22-rc4-mm2/Kbuild
===================================================================
--- linux-2.6.22-rc4-mm2.orig/Kbuild	2007-06-13 01:25:27.696264750 +0200
+++ linux-2.6.22-rc4-mm2/Kbuild	2007-06-13 01:28:10.306427250 +0200
@@ -1,60 +1,40 @@
 #
-# Kbuild for top-level directory of the kernel
-# This file takes care of the following:
-# 1) Generate asm-offsets.h
-# 2) Check for missing system calls
-
-#####
-# 1) Generate asm-offsets.h
+# Kbuild for top-level directory of the Linux
 #
+# 1) Generate (if needed) asm-values.h (former asm-offsets) for ARCH
+# 2) Check for missing system calls
 
-offsets-file := include/asm-$(ARCH)/asm-offsets.h
+####
+# 1)
 
-always  := $(offsets-file)
-targets := $(offsets-file)
-targets += arch/$(ARCH)/kernel/asm-offsets.s
-clean-files := $(addprefix $(objtree)/,$(targets))
-
-# 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/^@@@//; s/ \#.*\$$//; p;}"
-
-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
+# legacy asm-offsets support (FIXME: convert all archs and remove this)
+old = $(shell test -e $(srctree)/arch/$(ARCH)/kernel/asm-offsets.c && echo yes)
+ifeq ($(old),yes)
+    asm-values	=asm-offsets
+else
+    asm-values	=asm-values
+endif
+asm-values_c	:= $(src)/arch/$(ARCH)/kernel/$(asm-values).c
+asm-values_h	:= $(obj)/include/asm-$(ARCH)/$(asm-values).h
+asm-values	:= $(obj)/arch/$(ARCH)/kernel/$(asm-values).s
+include $(srctree)/scripts/Makefile.asm
 
-# We use internal kbuild rules to avoid the "is up to date" message from make
-arch/$(ARCH)/kernel/asm-offsets.s: arch/$(ARCH)/kernel/asm-offsets.c FORCE
+$(asm-values): $(asm-values_c) FORCE
 	$(Q)mkdir -p $(dir $@)
 	$(call if_changed_dep,cc_s_c)
 
-$(obj)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
+$(asm-values_h): $(asm-values) Kbuild
 	$(Q)mkdir -p $(dir $@)
-	$(call cmd,offsets)
+	$(call cmd,mkasm-values,$(ARCH))
 
-#####
-# 2) Check for missing system calls
-#
+####
+# 2)
 
 quiet_cmd_syscalls = CALL    $<
       cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags)
 
-PHONY += missing-syscalls
 missing-syscalls: scripts/checksyscalls.sh FORCE
 	$(call cmd,syscalls)
+
+PHONY += missing-syscalls
+.PHONY: $(PHONY)

--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux