diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.IMA | 2 | ||||
-rwxr-xr-x | scripts/gen_build_files.sh | 26 |
2 files changed, 26 insertions, 2 deletions
diff --git a/scripts/Makefile.IMA b/scripts/Makefile.IMA index bddd70229..11ae39eae 100644 --- a/scripts/Makefile.IMA +++ b/scripts/Makefile.IMA | |||
@@ -200,7 +200,7 @@ applets/usage: include/autoconf.h | |||
200 | applets/applet_tables: include/autoconf.h | 200 | applets/applet_tables: include/autoconf.h |
201 | $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/applet_tables applets/applet_tables.c | 201 | $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/applet_tables applets/applet_tables.c |
202 | 202 | ||
203 | include/usage_compressed.h: $(srctree)/include/usage.h applets/usage | 203 | include/usage_compressed.h: include/usage.h applets/usage |
204 | $(srctree)/applets/usage_compressed include/usage_compressed.h applets | 204 | $(srctree)/applets/usage_compressed include/usage_compressed.h applets |
205 | 205 | ||
206 | include/applet_tables.h: include/applets.h | 206 | include/applet_tables.h: include/applets.h |
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh index 44e8c1744..647c7daf7 100755 --- a/scripts/gen_build_files.sh +++ b/scripts/gen_build_files.sh | |||
@@ -10,7 +10,7 @@ srctree="$1" | |||
10 | # (Re)generate include/applets.h | 10 | # (Re)generate include/applets.h |
11 | src="$srctree/include/applets.src.h" | 11 | src="$srctree/include/applets.src.h" |
12 | dst="include/applets.h" | 12 | dst="include/applets.h" |
13 | s=`sed -n 's@^//applet:@@p' -- */*.c */*/*.c` | 13 | s=`sed -n 's@^//applet:@@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c` |
14 | echo "/* DO NOT EDIT. This file is generated from applets.src.h */" >"$dst.$$.tmp" | 14 | echo "/* DO NOT EDIT. This file is generated from applets.src.h */" >"$dst.$$.tmp" |
15 | # Why "IFS='' read -r REPLY"?? | 15 | # Why "IFS='' read -r REPLY"?? |
16 | # This atrocity is needed to read lines without mangling. | 16 | # This atrocity is needed to read lines without mangling. |
@@ -27,6 +27,30 @@ else | |||
27 | mv -- "$dst.$$.tmp" "$dst" | 27 | mv -- "$dst.$$.tmp" "$dst" |
28 | fi | 28 | fi |
29 | 29 | ||
30 | # (Re)generate include/usage.h | ||
31 | src="$srctree/include/usage.src.h" | ||
32 | dst="include/usage.h" | ||
33 | # We add line continuation backslash after each line, | ||
34 | # and insert empty line before each line which doesn't start | ||
35 | # with space or tab | ||
36 | # (note: we need to use \\\\ because of ``) | ||
37 | s=`sed -n -e 's@^//usage:\([ \t].*\)$@\1 \\\\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\\\@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c` | ||
38 | echo "/* DO NOT EDIT. This file is generated from usage.src.h */" >"$dst.$$.tmp" | ||
39 | # Why "IFS='' read -r REPLY"?? | ||
40 | # This atrocity is needed to read lines without mangling. | ||
41 | # IFS='' prevents whitespace trimming, | ||
42 | # -r suppresses backslash handling. | ||
43 | while IFS='' read -r REPLY; do | ||
44 | test x"$REPLY" = x"INSERT" && REPLY="$s" | ||
45 | printf "%s\n" "$REPLY" | ||
46 | done <"$src" >>"$dst.$$.tmp" | ||
47 | if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then | ||
48 | rm -- "$dst.$$.tmp" | ||
49 | else | ||
50 | echo " GEN $dst" | ||
51 | mv -- "$dst.$$.tmp" "$dst" | ||
52 | fi | ||
53 | |||
30 | # (Re)generate */Kbuild and */Config.in | 54 | # (Re)generate */Kbuild and */Config.in |
31 | find -type d | while read -r d; do | 55 | find -type d | while read -r d; do |
32 | d="${d#./}" | 56 | d="${d#./}" |