ash,hush: make it possible to build them individually

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2010-03-23 01:08:26 +01:00
parent 85dbf190c6
commit 1497484839
3 changed files with 15 additions and 8 deletions

View File

@ -79,6 +79,7 @@ int main(int argc, char **argv)
} }
printf("\n"); printf("\n");
printf("#ifndef SKIP_definitions\n");
printf("const char applet_names[] ALIGN1 = \"\"\n"); printf("const char applet_names[] ALIGN1 = \"\"\n");
for (i = 0; i < NUM_APPLETS; i++) { for (i = 0; i < NUM_APPLETS; i++) {
printf("\"%s\" \"\\0\"\n", applets[i].name); printf("\"%s\" \"\\0\"\n", applets[i].name);
@ -120,9 +121,10 @@ int main(int argc, char **argv)
printf("0x%02x,\n", v); printf("0x%02x,\n", v);
i++; i++;
} }
printf("};\n\n"); printf("};\n");
#endif #endif
printf("#endif /* SKIP_definitions */\n");
printf("\n");
printf("#define MAX_APPLET_NAME_LEN %u\n", MAX_APPLET_NAME_LEN); printf("#define MAX_APPLET_NAME_LEN %u\n", MAX_APPLET_NAME_LEN);
return 0; return 0;

View File

@ -43,8 +43,6 @@
#endif #endif
#include "busybox.h" /* for applet_names */ #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 <paths.h>
#include <setjmp.h> #include <setjmp.h>
#include <fnmatch.h> #include <fnmatch.h>
@ -59,12 +57,15 @@
# define CLEAR_RANDOM_T(rnd) ((void)0) # define CLEAR_RANDOM_T(rnd) ((void)0)
#endif #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 */ /* STANDALONE does not make sense, and won't compile */
# undef CONFIG_FEATURE_SH_STANDALONE # undef CONFIG_FEATURE_SH_STANDALONE
# undef ENABLE_FEATURE_SH_STANDALONE # undef ENABLE_FEATURE_SH_STANDALONE
# undef IF_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 ENABLE_FEATURE_SH_STANDALONE 0
# define IF_FEATURE_SH_STANDALONE(...) # define IF_FEATURE_SH_STANDALONE(...)
# define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__ # define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__

View File

@ -125,14 +125,18 @@
# define USE_FOR_MMU(...) # define USE_FOR_MMU(...)
#endif #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 */ /* STANDALONE does not make sense, and won't compile */
# undef CONFIG_FEATURE_SH_STANDALONE # undef CONFIG_FEATURE_SH_STANDALONE
# undef ENABLE_FEATURE_SH_STANDALONE # undef ENABLE_FEATURE_SH_STANDALONE
# undef IF_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_FEATURE_SH_STANDALONE(...)
# define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__ # define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__
# define ENABLE_FEATURE_SH_STANDALONE 0
#endif #endif
#if !ENABLE_HUSH_INTERACTIVE #if !ENABLE_HUSH_INTERACTIVE