ash,hush: make it possible to build them individually
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 23 Mar 2010 00:08:26 +0000 (01:08 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 23 Mar 2010 00:08:26 +0000 (01:08 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
applets/applet_tables.c
shell/ash.c
shell/hush.c

index e67f017e7bd71b79adaee9e49bebf4224fe7f71d..e48be46821e7ffe3a07cd33dcc4ca50a44371652 100644 (file)
@@ -79,6 +79,7 @@ int main(int argc, char **argv)
        }
        printf("\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);
@@ -120,9 +121,10 @@ int main(int argc, char **argv)
                printf("0x%02x,\n", v);
                i++;
        }
-       printf("};\n\n");
+       printf("};\n");
 #endif
-
+       printf("#endif /* SKIP_definitions */\n");
+       printf("\n");
        printf("#define MAX_APPLET_NAME_LEN %u\n", MAX_APPLET_NAME_LEN);
 
        return 0;
index ce82a965c226b393bcd4f20fb10f37398206c3eb..e2851305bab50b3015772d80f795286dd32e1b36 100644 (file)
@@ -43,8 +43,6 @@
 #endif
 
 #include "busybox.h" /* for applet_names */
-//TODO: pull in some .h and find out do we have SINGLE_APPLET_MAIN?
-//#include "applet_tables.h" doesn't work
 #include <paths.h>
 #include <setjmp.h>
 #include <fnmatch.h>
 # define CLEAR_RANDOM_T(rnd) ((void)0)
 #endif
 
-#if defined SINGLE_APPLET_MAIN
+#define SKIP_definitions 1
+#include "applet_tables.h"
+#undef SKIP_definitions
+#if NUM_APPLETS == 1
 /* STANDALONE does not make sense, and won't compile */
 # undef CONFIG_FEATURE_SH_STANDALONE
 # undef ENABLE_FEATURE_SH_STANDALONE
 # undef IF_FEATURE_SH_STANDALONE
-# undef IF_NOT_FEATURE_SH_STANDALONE(...)
+# undef IF_NOT_FEATURE_SH_STANDALONE
 # define ENABLE_FEATURE_SH_STANDALONE 0
 # define IF_FEATURE_SH_STANDALONE(...)
 # define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__
index 6f391b8819204b098528259bf5f7c23601a23c87..048085b3edb7e451f7b3f6ff3cefd0b638cb28ba 100644 (file)
 # define USE_FOR_MMU(...)
 #endif
 
-#if defined SINGLE_APPLET_MAIN
+#define SKIP_definitions 1
+#include "applet_tables.h"
+#undef SKIP_definitions
+#if NUM_APPLETS == 1
 /* STANDALONE does not make sense, and won't compile */
 # undef CONFIG_FEATURE_SH_STANDALONE
 # undef ENABLE_FEATURE_SH_STANDALONE
 # undef IF_FEATURE_SH_STANDALONE
+# undef IF_NOT_FEATURE_SH_STANDALONE
+# define ENABLE_FEATURE_SH_STANDALONE 0
 # define IF_FEATURE_SH_STANDALONE(...)
 # define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__
-# define ENABLE_FEATURE_SH_STANDALONE 0
 #endif
 
 #if !ENABLE_HUSH_INTERACTIVE