[git commit master] ash, hush: make it possible to build them individually

Denys Vlasenko vda.linux at googlemail.com
Tue Mar 23 01:17:52 UTC 2010


commit: http://git.busybox.net/busybox/commit/?id=1497484839efd4c57d63c07e2b92413193a3977f
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 applets/applet_tables.c |    6 ++++--
 shell/ash.c             |    9 +++++----
 shell/hush.c            |    8 ++++++--
 3 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/applets/applet_tables.c b/applets/applet_tables.c
index e67f017..e48be46 100644
--- a/applets/applet_tables.c
+++ b/applets/applet_tables.c
@@ -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;
diff --git a/shell/ash.c b/shell/ash.c
index ce82a96..e285130 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -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>
@@ -59,12 +57,15 @@
 # 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__
diff --git a/shell/hush.c b/shell/hush.c
index 6f391b8..048085b 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -125,14 +125,18 @@
 # 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
-- 
1.6.3.3



More information about the busybox-cvs mailing list