From 23ef31e6e9a2b625fd27a1dd54b23ae097d03efc Mon Sep 17 00:00:00 2001
From: Rob Landley
Toybox is configured using the Kconfig language pioneered by the Linux -kernel, and adopted by many other projects (uClibc, OpenEmbedded, etc). +
Toybox is configured using the +Kconfig language pioneered by the Linux +kernel, and adopted by many other projects (buildroot, OpenEmbedded, etc). This generates a ".config" file containing the selected options, which controls which features are included when compiling toybox.
@@ -189,8 +190,8 @@ toys/posix/cat.c only gets included if you have "CAT=y" in ".config". year.Give a URL to the relevant standards document, where applicable. -(Sample links to SUSv4 and LSB are provided, feel free to link to other -documentation or standards as appropriate.)
Update the USE_YOURCOMMAND(NEWTOY(yourcommand,"blah",0)) line. The NEWTOY macro fills out this command's toy_list @@ -263,11 +264,13 @@ back off.
Commands generally don't have their own headers. If it's common code -it can live in lib/, if it isn't put it in the command's .c file. (The line -between implementing multiple commands in a C file via OLDTOY() to share -infrastructure and moving that shared infrastructure to lib/ is a judgement -call. Try to figure out which is simplest.)
+Commands are implemented as self-contained .c files, and generally don't +have their own .h files. If it's common code put it in lib/, and if it's +something like a local structure definition just put it in the command's .c +file. If it would only ever be #included from one place, inline it. +(The line between implementing multiple commands in a C file via OLDTOY() +to share infrastructure and moving that shared infrastructure to lib/ is a +judgement call. Try to figure out which is simplest.)
The top level toys.h should #include all the standard (posix) headers that any command uses. (Partly this is friendly to ccache and partly this @@ -281,7 +284,7 @@ or operating systems) should be confined to lib/portability.h and lib/portability.c. (There's even some minimal compile-time environment probing that writes data to generated/portability.h, see scripts/genconfig.sh.)
-Only include linux/*.h headers from individual commands (not from other +
Only include <linux/*.h> headers from individual commands (not from other headers), and only if you really need to. Data that varies per architecture is a good reason to include a header. If you just need a couple constants that haven't changed since the 1990's, it's ok to #define them yourself or @@ -1370,7 +1373,8 @@ Makefile.
Menuconfig infrastructure copied from the Linux kernel. See the +
Menuconfig infrastructure copied from the Linux kernel a long time ago +(version 2.6.16). See the Linux kernel's Documentation/kbuild/kconfig-language.txt