From bcfad872188d993efc8d1da4b79058b69e43f019 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 31 Jan 2007 14:18:05 -0500 Subject: Add make install_flat. --- Makefile | 11 ++++++++++- scripts/install.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 scripts/install.c diff --git a/Makefile b/Makefile index 3a405c5b..c366b13c 100644 --- a/Makefile +++ b/Makefile @@ -43,8 +43,17 @@ toybox_unstripped: gen_config.h $(toyfiles) toys/toylist.h lib/lib.h toys.h toybox: toybox_unstripped $(STRIP) toybox_unstripped -o toybox + +instlist: toybox + $(HOST_CC) -I . scripts/install.c -o instlist + +install_flat: instlist + @mkdir -p $(PREFIX)/ + @cp toybox $(PREFIX)/ + @for i in `./instlist`; do ln -s toybox "$(PREFIX)/$$i"; done + clean:: - rm -f toybox toybox_old toybox_unstripped gen_config.h + rm -f toybox toybox_old toybox_unstripped gen_config.h instlist distclean: clean rm -f .config* diff --git a/scripts/install.c b/scripts/install.c new file mode 100644 index 00000000..b5744868 --- /dev/null +++ b/scripts/install.c @@ -0,0 +1,40 @@ +/* vi: set ts=4 :*/ +/* Wrapper to make installation easier with cross-compiling. + * + * Copyright 2006 Rob Landley + */ + +#include "toys.h" + +#undef NEWTOY +#undef OLDTOY +#define NEWTOY(name, opts, flags) {#name, 0, opts, flags}, +#define OLDTOY(name, oldname, opts, flags) {#name, 0, opts, flags} + +// Populate toy_list[]. + +struct toy_list toy_list[] = { +#include "toys/toylist.h" +}; + +#define TOY_LIST_LEN (sizeof(toy_list)/sizeof(struct toy_list)) + +int main(int argc, char *argv[]) +{ + static char *toy_paths[]={"usr/","bin/","sbin/",0}; + int i, len = 0; + + // Output list of applets. + for (i=1; i1) { + int j; + for (j=0; toy_paths[j]; j++) + if (fl & (1<