partially migrate coreutils to Config.src and Kbuild.src

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/coreutils/Config.in b/coreutils/Config.src
similarity index 86%
rename from coreutils/Config.in
rename to coreutils/Config.src
index 37e885c..99384e3 100644
--- a/coreutils/Config.in
+++ b/coreutils/Config.src
@@ -5,13 +5,7 @@
 
 menu "Coreutils"
 
-config BASENAME
-	bool "basename"
-	default n
-	help
-	  basename is used to strip the directory and suffix from filenames,
-	  leaving just the filename itself. Enable this option if you wish
-	  to enable the 'basename' utility.
+INSERT
 
 config CAL
 	bool "cal"
@@ -19,13 +13,6 @@
 	help
 	  cal is used to display a monthly calender.
 
-config CAT
-	bool "cat"
-	default n
-	help
-	  cat is used to concatenate files and print them to the standard
-	  output. Enable this option if you wish to enable the 'cat' utility.
-
 config CATV
 	bool "catv"
 	default n
@@ -100,44 +87,6 @@
 	  cut is used to print selected parts of lines from
 	  each file to stdout.
 
-config DATE
-	bool "date"
-	default n
-	help
-	  date is used to set the system date or display the
-	  current time in the given format.
-
-config FEATURE_DATE_ISOFMT
-	bool "Enable ISO date format output (-I)"
-	default y
-	depends on DATE
-	help
-	  Enable option (-I) to output an ISO-8601 compliant
-	  date/time string.
-
-config FEATURE_DATE_NANO
-	bool "Support %[num]N nanosecond format specifier"
-	default y
-	depends on DATE
-	help
-	  Support %[num]N format specifier. Adds ~250 bytes of code.
-
-config FEATURE_DATE_COMPAT
-	bool "Support weird 'date MMDDhhmm[[YY]YY][.ss]' format"
-	default y
-	depends on DATE
-	help
-	  System time can be set by 'date -s DATE' and simply 'date DATE',
-	  but formats of DATE string are different. 'date DATE' accepts
-	  a rather weird MMDDhhmm[[YY]YY][.ss] format with completely
-	  unnatural placement of year between minutes and seconds.
-	  date -s (and other commands like touch -d) use more sensible
-	  formats (for one, ISO format YYYY-MM-DD hh:mm:ss.ssssss).
-
-	  With this option off, 'date DATE' is 'date -s DATE' support
-	  the same format. With it on, 'date DATE' additionally supports
-	  MMDDhhmm[[YY]YY][.ss] format.
-
 config DD
 	bool "dd"
 	default n
@@ -711,21 +660,6 @@
 	help
 	  Enable this option for a faster tee, at expense of size.
 
-config TEST
-	bool "test"
-	default n
-	help
-	  test is used to check file types and compare values,
-	  returning an appropriate exit code. The bash shell
-	  has test built in, ash can build it in optionally.
-
-config FEATURE_TEST_64
-	bool "Extend test to 64 bit"
-	default n
-	depends on TEST || ASH_BUILTIN_TEST || HUSH
-	help
-	  Enable 64-bit support in test.
-
 config TOUCH
 	bool "touch"
 	default n
@@ -733,32 +667,6 @@
 	  touch is used to create or change the access and/or
 	  modification timestamp of specified files.
 
-config TR
-	bool "tr"
-	default n
-	help
-	  tr is used to squeeze, and/or delete characters from standard
-	  input, writing to standard output.
-
-config FEATURE_TR_CLASSES
-	bool "Enable character classes (such as [:upper:])"
-	default n
-	depends on TR
-	help
-	  Enable character classes, enabling commands such as:
-	  tr [:upper:] [:lower:] to convert input into lowercase.
-
-config FEATURE_TR_EQUIV
-	bool "Enable equivalence classes"
-	default n
-	depends on TR
-	help
-	  Enable equivalence classes, which essentially add the enclosed
-	  character to the current set. For instance, tr [=a=] xyz would
-	  replace all instances of 'a' with 'xyz'. This option is mainly
-	  useful for cases when no other way of expressing a character
-	  is possible.
-
 config TRUE
 	bool "true"
 	default n
diff --git a/coreutils/Kbuild b/coreutils/Kbuild.src
similarity index 84%
rename from coreutils/Kbuild
rename to coreutils/Kbuild.src
index ee22a3f..57ea7d6 100644
--- a/coreutils/Kbuild
+++ b/coreutils/Kbuild.src
@@ -7,12 +7,8 @@
 libs-y			+= libcoreutils/
 
 lib-y:=
-lib-$(CONFIG_BASENAME)  += basename.o
+INSERT
 lib-$(CONFIG_CAL)       += cal.o
-lib-$(CONFIG_CAT)       += cat.o
-lib-$(CONFIG_MORE)      += cat.o # more uses it if stdout isn't a tty
-lib-$(CONFIG_LESS)      += cat.o # less too
-lib-$(CONFIG_CRONTAB)   += cat.o # crontab -l
 lib-$(CONFIG_CATV)      += catv.o
 lib-$(CONFIG_CHGRP)     += chgrp.o chown.o
 lib-$(CONFIG_CHMOD)     += chmod.o
@@ -24,7 +20,6 @@
 lib-$(CONFIG_COMM)      += comm.o
 lib-$(CONFIG_CP)        += cp.o
 lib-$(CONFIG_CUT)       += cut.o
-lib-$(CONFIG_DATE)      += date.o
 lib-$(CONFIG_DD)        += dd.o
 lib-$(CONFIG_DF)        += df.o
 lib-$(CONFIG_DIRNAME)   += dirname.o
@@ -78,12 +73,7 @@
 lib-$(CONFIG_TAC)       += tac.o
 lib-$(CONFIG_TAIL)      += tail.o
 lib-$(CONFIG_TEE)       += tee.o
-lib-$(CONFIG_TEST)      += test.o test_ptr_hack.o
-lib-$(CONFIG_ASH)       += test.o test_ptr_hack.o # used by ash
-lib-$(CONFIG_HUSH)      += test.o test_ptr_hack.o # used by hush
-lib-$(CONFIG_MSH)       += test.o test_ptr_hack.o # used by msh
 lib-$(CONFIG_TOUCH)     += touch.o
-lib-$(CONFIG_TR)        += tr.o
 lib-$(CONFIG_TRUE)      += true.o
 lib-$(CONFIG_TTY)       += tty.o
 lib-$(CONFIG_UNAME)     += uname.o
diff --git a/coreutils/basename.c b/coreutils/basename.c
index 8a5597e..f35bdf0 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -20,6 +20,16 @@
  * 3) Save some space by using strcmp().  Calling strncmp() here was silly.
  */
 
+//kbuild:lib-$(CONFIG_BASENAME) += basename.o
+
+//config:config BASENAME
+//config:	bool "basename"
+//config:	default n
+//config:	help
+//config:	  basename is used to strip the directory and suffix from filenames,
+//config:	  leaving just the filename itself. Enable this option if you wish
+//config:	  to enable the 'basename' utility.
+
 #include "libbb.h"
 
 /* This is a NOFORK applet. Be very careful! */
diff --git a/coreutils/cat.c b/coreutils/cat.c
index 0024eb8..dbb6246 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -10,6 +10,18 @@
 /* BB_AUDIT SUSv3 compliant */
 /* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */
 
+//kbuild:lib-$(CONFIG_CAT)     += cat.o
+//kbuild:lib-$(CONFIG_MORE)    += cat.o # more uses it if stdout isn't a tty
+//kbuild:lib-$(CONFIG_LESS)    += cat.o # less too
+//kbuild:lib-$(CONFIG_CRONTAB) += cat.o # crontab -l
+
+//config:config CAT
+//config:	bool "cat"
+//config:	default n
+//config:	help
+//config:	  cat is used to concatenate files and print them to the standard
+//config:	  output. Enable this option if you wish to enable the 'cat' utility.
+
 #include "libbb.h"
 
 /* This is a NOFORK applet. Be very careful! */
diff --git a/coreutils/date.c b/coreutils/date.c
index c1390be..2720a35 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -51,6 +51,47 @@
  *    and does not support -Ins
  * -D FMT is a bbox extension for _input_ conversion of -d DATE
  */
+
+//kbuild:lib-$(CONFIG_DATE) += date.o
+
+//config:config DATE
+//config:	bool "date"
+//config:	default n
+//config:	help
+//config:	  date is used to set the system date or display the
+//config:	  current time in the given format.
+//config:
+//config:config FEATURE_DATE_ISOFMT
+//config:	bool "Enable ISO date format output (-I)"
+//config:	default y
+//config:	depends on DATE
+//config:	help
+//config:	  Enable option (-I) to output an ISO-8601 compliant
+//config:	  date/time string.
+//config:
+//config:config FEATURE_DATE_NANO
+//config:	bool "Support %[num]N nanosecond format specifier"
+//config:	default y
+//config:	depends on DATE
+//config:	help
+//config:	  Support %[num]N format specifier. Adds ~250 bytes of code.
+//config:
+//config:config FEATURE_DATE_COMPAT
+//config:	bool "Support weird 'date MMDDhhmm[[YY]YY][.ss]' format"
+//config:	default y
+//config:	depends on DATE
+//config:	help
+//config:	  System time can be set by 'date -s DATE' and simply 'date DATE',
+//config:	  but formats of DATE string are different. 'date DATE' accepts
+//config:	  a rather weird MMDDhhmm[[YY]YY][.ss] format with completely
+//config:	  unnatural placement of year between minutes and seconds.
+//config:	  date -s (and other commands like touch -d) use more sensible
+//config:	  formats (for one, ISO format YYYY-MM-DD hh:mm:ss.ssssss).
+//config:
+//config:	  With this option off, 'date DATE' is 'date -s DATE' support
+//config:	  the same format. With it on, 'date DATE' additionally supports
+//config:	  MMDDhhmm[[YY]YY][.ss] format.
+
 #include "libbb.h"
 
 enum {
diff --git a/coreutils/test.c b/coreutils/test.c
index a1d1645..cc4a132 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -19,6 +19,26 @@
  * Original copyright notice states:
  *     "This program is in the Public Domain."
  */
+
+//kbuild:lib-$(CONFIG_TEST)      += test.o test_ptr_hack.o
+//kbuild:lib-$(CONFIG_ASH)       += test.o test_ptr_hack.o
+//kbuild:lib-$(CONFIG_HUSH)      += test.o test_ptr_hack.o
+
+//config:config TEST
+//config:	bool "test"
+//config:	default n
+//config:	help
+//config:	  test is used to check file types and compare values,
+//config:	  returning an appropriate exit code. The bash shell
+//config:	  has test built in, ash can build it in optionally.
+//config:
+//config:config FEATURE_TEST_64
+//config:	bool "Extend test to 64 bit"
+//config:	default n
+//config:	depends on TEST || ASH_BUILTIN_TEST || HUSH
+//config:	help
+//config:	  Enable 64-bit support in test.
+
 #include "libbb.h"
 #include <setjmp.h>
 
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 6d4cb4a..12d0715 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -18,6 +18,35 @@
 /* http://www.opengroup.org/onlinepubs/009695399/utilities/tr.html
  * TODO: graph, print
  */
+
+//kbuild:lib-$(CONFIG_TR) += tr.o
+
+//config:config TR
+//config:	bool "tr"
+//config:	default n
+//config:	help
+//config:	  tr is used to squeeze, and/or delete characters from standard
+//config:	  input, writing to standard output.
+
+config FEATURE_TR_CLASSES
+	bool "Enable character classes (such as [:upper:])"
+	default n
+	depends on TR
+	help
+	  Enable character classes, enabling commands such as:
+	  tr [:upper:] [:lower:] to convert input into lowercase.
+
+config FEATURE_TR_EQUIV
+	bool "Enable equivalence classes"
+	default n
+	depends on TR
+	help
+	  Enable equivalence classes, which essentially add the enclosed
+	  character to the current set. For instance, tr [=a=] xyz would
+	  replace all instances of 'a' with 'xyz'. This option is mainly
+	  useful for cases when no other way of expressing a character
+	  is possible.
+
 #include "libbb.h"
 
 enum {