diff options
Diffstat (limited to 'scripts/gen_build_files.sh')
-rwxr-xr-x | scripts/gen_build_files.sh | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh index f79fa2f83..92de681ac 100755 --- a/scripts/gen_build_files.sh +++ b/scripts/gen_build_files.sh | |||
@@ -17,12 +17,26 @@ status() { printf ' %-8s%s\n' "$1" "$2"; } | |||
17 | gen() { status "GEN" "$@"; } | 17 | gen() { status "GEN" "$@"; } |
18 | chk() { status "CHK" "$@"; } | 18 | chk() { status "CHK" "$@"; } |
19 | 19 | ||
20 | # scripts in the 'embed' directory are treated as fake applets | ||
21 | custom_scripts() | ||
22 | { | ||
23 | custom_loc="$1" | ||
24 | if [ -d "$custom_loc" ] | ||
25 | then | ||
26 | for i in $(cd "$custom_loc"; ls * 2>/dev/null) | ||
27 | do | ||
28 | printf "IF_FEATURE_SH_EMBEDDED_SCRIPTS(APPLET_SCRIPTED(%s, scripted, BB_DIR_USR_BIN, BB_SUID_DROP, scripted))\n" $i; | ||
29 | done | ||
30 | fi | ||
31 | } | ||
32 | |||
20 | generate() | 33 | generate() |
21 | { | 34 | { |
22 | # NB: data to be inserted at INSERT line is coming on stdin | 35 | # NB: data to be inserted at INSERT line is coming on stdin |
23 | src="$1" | 36 | src="$1" |
24 | dst="$2" | 37 | dst="$2" |
25 | header="$3" | 38 | header="$3" |
39 | loc="$4" | ||
26 | #chk "${dst}" | 40 | #chk "${dst}" |
27 | { | 41 | { |
28 | # Need to use printf: different shells have inconsistent | 42 | # Need to use printf: different shells have inconsistent |
@@ -32,6 +46,10 @@ generate() | |||
32 | sed -n '/^INSERT$/ q; p' "${src}" | 46 | sed -n '/^INSERT$/ q; p' "${src}" |
33 | # copy stdin to stdout | 47 | # copy stdin to stdout |
34 | cat | 48 | cat |
49 | if [ -n "$loc" ] | ||
50 | then | ||
51 | custom_scripts "$loc" | ||
52 | fi | ||
35 | # print everything after INSERT line | 53 | # print everything after INSERT line |
36 | sed -n '/^INSERT$/ { | 54 | sed -n '/^INSERT$/ { |
37 | :l | 55 | :l |
@@ -53,7 +71,8 @@ sed -n 's@^//applet:@@p' "$srctree"/*/*.c "$srctree"/*/*/*.c \ | |||
53 | | generate \ | 71 | | generate \ |
54 | "$srctree/include/applets.src.h" \ | 72 | "$srctree/include/applets.src.h" \ |
55 | "include/applets.h" \ | 73 | "include/applets.h" \ |
56 | "/* DO NOT EDIT. This file is generated from applets.src.h */" | 74 | "/* DO NOT EDIT. This file is generated from applets.src.h */" \ |
75 | "$srctree/embed" | ||
57 | 76 | ||
58 | # (Re)generate include/usage.h | 77 | # (Re)generate include/usage.h |
59 | # We add line continuation backslash after each line, | 78 | # We add line continuation backslash after each line, |