aboutsummaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
Diffstat (limited to 'applets')
-rw-r--r--applets/Kbuild9
-rw-r--r--applets/usage.c17
-rwxr-xr-xapplets/usage_compressed19
3 files changed, 42 insertions, 3 deletions
diff --git a/applets/Kbuild b/applets/Kbuild
index 9bb4b6292..c95c09d97 100644
--- a/applets/Kbuild
+++ b/applets/Kbuild
@@ -12,7 +12,10 @@ obj-y += busybox.o
applets/applets.o: include/usage_compressed.h
-include/usage_compressed.h: $(srctree)/include/usage.h
- @$(MAKE) $(build)=scripts
+hostprogs-y += usage
+always := $(hostprogs-y)
+HOSTCFLAGS_usage.o = -I$(srctree)/include
+
+include/usage_compressed.h: $(srctree)/include/usage.h applets/usage
@echo ' GEN include/usage_compressed.h'
- @$(srctree)/scripts/usage_compressed include/usage_compressed.h scripts
+ @$(srctree)/applets/usage_compressed include/usage_compressed.h applets
diff --git a/applets/usage.c b/applets/usage.c
new file mode 100644
index 000000000..d888fa93d
--- /dev/null
+++ b/applets/usage.c
@@ -0,0 +1,17 @@
+/* vi: set sw=4 ts=4: */
+#include <unistd.h>
+
+#include "../include/autoconf.h"
+#include "../include/busybox.h"
+
+static const char usage_messages[] =
+#define MAKE_USAGE
+#include "usage.h"
+#include "applets.h"
+;
+
+int main(void)
+{
+ write(1, usage_messages, sizeof(usage_messages));
+ return 0;
+}
diff --git a/applets/usage_compressed b/applets/usage_compressed
new file mode 100755
index 000000000..ab164aa12
--- /dev/null
+++ b/applets/usage_compressed
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+target="$1"
+loc="$2"
+
+test "$target" || exit 1
+test "$loc" || loc=.
+test -x "$loc/usage" || exit 1
+test "$SED" || SED=sed
+
+sz=`"$loc/usage" | wc -c` || exit 1
+
+exec >"$target"
+
+echo 'static const char packed_usage[] = '
+"$loc/usage" | bzip2 -1 | od -v -t x1 \
+| $SED -e 's/^[^ ]*//' -e 's/ \(..\)/\\x\1/g' -e 's/^\(.*\)$/"\1"/'
+echo ';'
+echo '#define SIZEOF_usage_messages' `expr 0 + $sz`