]>
Commit | Line | Data |
---|---|---|
6a44d806 MY |
1 | # |
2 | # Kbuild for top-level directory of U-Boot | |
3 | # This file takes care of the following: | |
4 | # 1) Generate generic-asm-offsets.h | |
5 | # 2) Generate asm-offsets.h | |
6 | ||
490cf5f0 MY |
7 | # Default sed regexp - multiline due to syntax constraints |
8 | define sed-y | |
9 | "s:[[:space:]]*\.ascii[[:space:]]*\"\(.*\)\":\1:; \ | |
10 | /^->/{s:->#\(.*\):/* \1 */:; \ | |
11 | s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \ | |
12 | s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \ | |
13 | s:->::; p;}" | |
14 | endef | |
6a44d806 | 15 | |
3a4f6b60 MM |
16 | # Use filechk to avoid rebuilds when a header changes, but the resulting file |
17 | # does not | |
18 | define filechk_offsets | |
6a44d806 | 19 | (set -e; \ |
490cf5f0 MY |
20 | echo "#ifndef $2"; \ |
21 | echo "#define $2"; \ | |
6a44d806 MY |
22 | echo "/*"; \ |
23 | echo " * DO NOT MODIFY."; \ | |
24 | echo " *"; \ | |
25 | echo " * This file was generated by Kbuild"; \ | |
6a44d806 MY |
26 | echo " */"; \ |
27 | echo ""; \ | |
3a4f6b60 | 28 | sed -ne $(sed-y); \ |
6a44d806 | 29 | echo ""; \ |
3a4f6b60 | 30 | echo "#endif" ) |
6a44d806 MY |
31 | endef |
32 | ||
490cf5f0 MY |
33 | ##### |
34 | # 1) Generate generic-asm-offsets.h | |
35 | ||
36 | generic-offsets-file := include/generated/generic-asm-offsets.h | |
37 | ||
38 | always := $(generic-offsets-file) | |
ba84de9f | 39 | targets := lib/asm-offsets.s |
490cf5f0 | 40 | |
6a44d806 MY |
41 | # We use internal kbuild rules to avoid the "is up to date" message from make |
42 | lib/asm-offsets.s: lib/asm-offsets.c FORCE | |
43 | $(Q)mkdir -p $(dir $@) | |
44 | $(call if_changed_dep,cc_s_c) | |
45 | ||
3a4f6b60 MM |
46 | $(obj)/$(generic-offsets-file): lib/asm-offsets.s FORCE |
47 | $(call filechk,offsets,__GENERIC_ASM_OFFSETS_H__) | |
6a44d806 MY |
48 | |
49 | ##### | |
50 | # 2) Generate asm-offsets.h | |
51 | # | |
52 | ||
254d68b6 | 53 | ifneq ($(wildcard $(srctree)/arch/$(ARCH)/lib/asm-offsets.c),) |
6a44d806 MY |
54 | offsets-file := include/generated/asm-offsets.h |
55 | endif | |
56 | ||
57 | always += $(offsets-file) | |
254d68b6 | 58 | targets += arch/$(ARCH)/lib/asm-offsets.s |
6a44d806 | 59 | |
6a44d806 MY |
60 | CFLAGS_asm-offsets.o := -DDO_DEPS_ONLY |
61 | ||
6a44d806 | 62 | # We use internal kbuild rules to avoid the "is up to date" message from make |
254d68b6 | 63 | arch/$(ARCH)/lib/asm-offsets.s: arch/$(ARCH)/lib/asm-offsets.c FORCE |
6a44d806 MY |
64 | $(Q)mkdir -p $(dir $@) |
65 | $(call if_changed_dep,cc_s_c) | |
66 | ||
3a4f6b60 MM |
67 | $(obj)/$(offsets-file): arch/$(ARCH)/lib/asm-offsets.s FORCE |
68 | $(call filechk,offsets,__ASM_OFFSETS_H__) |