aboutsummaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
Diffstat (limited to 'applets')
-rw-r--r--applets/Kbuild.src18
-rw-r--r--applets/applet_tables.c25
2 files changed, 28 insertions, 15 deletions
diff --git a/applets/Kbuild.src b/applets/Kbuild.src
index b61239948..3aedbbffe 100644
--- a/applets/Kbuild.src
+++ b/applets/Kbuild.src
@@ -29,7 +29,7 @@ applets/applets.o: include/usage_compressed.h include/applet_tables.h
29 29
30applets/applet_tables: .config include/applets.h 30applets/applet_tables: .config include/applets.h
31applets/usage: .config include/applets.h 31applets/usage: .config include/applets.h
32applets/usage_pod: .config include/applet_tables.h include/applets.h 32applets/usage_pod: .config include/applets.h include/applet_tables.h
33 33
34quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h 34quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h
35 cmd_gen_usage_compressed = $(srctree_slash)applets/usage_compressed include/usage_compressed.h applets 35 cmd_gen_usage_compressed = $(srctree_slash)applets/usage_compressed include/usage_compressed.h applets
@@ -37,11 +37,21 @@ quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h
37include/usage_compressed.h: applets/usage $(srctree_slash)applets/usage_compressed 37include/usage_compressed.h: applets/usage $(srctree_slash)applets/usage_compressed
38 $(call cmd,gen_usage_compressed) 38 $(call cmd,gen_usage_compressed)
39 39
40quiet_cmd_gen_applet_tables = GEN include/applet_tables.h 40quiet_cmd_gen_applet_tables = GEN include/applet_tables.h include/NUM_APPLETS.h
41 cmd_gen_applet_tables = applets/applet_tables include/applet_tables.h include/NUM_APPLETS.h 41 cmd_gen_applet_tables = applets/applet_tables include/applet_tables.h include/NUM_APPLETS.h
42 42
43include/applet_tables.h: applets/applet_tables 43include/NUM_APPLETS.h: applets/applet_tables
44 $(call cmd,gen_applet_tables) 44 $(call cmd,gen_applet_tables)
45 45
46include/NUM_APPLETS.h: applets/applet_tables 46# In fact, include/applet_tables.h depends only on applets/applet_tables,
47# and is generated by it. But specifying only it can run
48# applets/applet_tables twice, possibly in parallel.
49# We say that it also needs NUM_APPLETS.h
50#
51# Unfortunately, we need to list the same command,
52# and it can be executed twice (sequentially).
53# The alternative is to not list any command,
54# and then if include/applet_tables.h is deleted, it won't be rebuilt.
55#
56include/applet_tables.h: include/NUM_APPLETS.h applets/applet_tables
47 $(call cmd,gen_applet_tables) 57 $(call cmd,gen_applet_tables)
diff --git a/applets/applet_tables.c b/applets/applet_tables.c
index 7894b2c33..9a2aa5329 100644
--- a/applets/applet_tables.c
+++ b/applets/applet_tables.c
@@ -143,7 +143,9 @@ int main(int argc, char **argv)
143 printf("};\n"); 143 printf("};\n");
144 printf("#endif\n\n"); 144 printf("#endif\n\n");
145 145
146#if ENABLE_FEATURE_PREFER_APPLETS 146#if ENABLE_FEATURE_PREFER_APPLETS \
147 || ENABLE_FEATURE_SH_STANDALONE \
148 || ENABLE_FEATURE_SH_NOFORK
147 printf("const uint8_t applet_flags[] ALIGN1 = {\n"); 149 printf("const uint8_t applet_flags[] ALIGN1 = {\n");
148 i = 0; 150 i = 0;
149 while (i < NUM_APPLETS) { 151 while (i < NUM_APPLETS) {
@@ -190,27 +192,28 @@ int main(int argc, char **argv)
190 printf("};\n"); 192 printf("};\n");
191#endif 193#endif
192 //printf("#endif /* SKIP_definitions */\n"); 194 //printf("#endif /* SKIP_definitions */\n");
195
193// printf("\n"); 196// printf("\n");
194// printf("#define MAX_APPLET_NAME_LEN %u\n", MAX_APPLET_NAME_LEN); 197// printf("#define MAX_APPLET_NAME_LEN %u\n", MAX_APPLET_NAME_LEN);
195 198
196 if (argv[2]) { 199 if (argv[2]) {
197 char line_old[80];
198 char line_new[80];
199 FILE *fp; 200 FILE *fp;
201 char line_new[80];
202// char line_old[80];
200 203
201 line_old[0] = 0;
202 fp = fopen(argv[2], "r");
203 if (fp) {
204 fgets(line_old, sizeof(line_old), fp);
205 fclose(fp);
206 }
207 sprintf(line_new, "#define NUM_APPLETS %u\n", NUM_APPLETS); 204 sprintf(line_new, "#define NUM_APPLETS %u\n", NUM_APPLETS);
208 if (strcmp(line_old, line_new) != 0) { 205// line_old[0] = 0;
206// fp = fopen(argv[2], "r");
207// if (fp) {
208// fgets(line_old, sizeof(line_old), fp);
209// fclose(fp);
210// }
211// if (strcmp(line_old, line_new) != 0) {
209 fp = fopen(argv[2], "w"); 212 fp = fopen(argv[2], "w");
210 if (!fp) 213 if (!fp)
211 return 1; 214 return 1;
212 fputs(line_new, fp); 215 fputs(line_new, fp);
213 } 216// }
214 } 217 }
215 218
216 return 0; 219 return 0;