From 1fcbff2fac490f5665fc1ed13ddad766a8879f3b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 26 Jun 2010 02:40:08 +0200 Subject: build system: do not rebuild ash and hush on any change to any .c file Signed-off-by: Denys Vlasenko --- applets/applet_tables.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'applets/applet_tables.c') diff --git a/applets/applet_tables.c b/applets/applet_tables.c index e48be46..338dc20 100644 --- a/applets/applet_tables.c +++ b/applets/applet_tables.c @@ -79,7 +79,7 @@ int main(int argc, char **argv) } printf("\n"); - printf("#ifndef SKIP_definitions\n"); + //printf("#ifndef SKIP_definitions\n"); printf("const char applet_names[] ALIGN1 = \"\"\n"); for (i = 0; i < NUM_APPLETS; i++) { printf("\"%s\" \"\\0\"\n", applets[i].name); @@ -123,9 +123,29 @@ int main(int argc, char **argv) } printf("};\n"); #endif - printf("#endif /* SKIP_definitions */\n"); + //printf("#endif /* SKIP_definitions */\n"); printf("\n"); printf("#define MAX_APPLET_NAME_LEN %u\n", MAX_APPLET_NAME_LEN); + if (argv[2]) { + char line_old[80]; + char line_new[80]; + FILE *fp; + + line_old[0] = 0; + fp = fopen(argv[2], "r"); + if (fp) { + fgets(line_old, sizeof(line_old), fp); + fclose(fp); + } + sprintf(line_new, "#define NUM_APPLETS %u\n", NUM_APPLETS); + if (strcmp(line_old, line_new) != 0) { + fp = fopen(argv[2], "w"); + if (!fp) + return 1; + fputs(line_new, fp); + } + } + return 0; } -- cgit v1.1