Fix makefile to defconfig properly, and leak in a bit of the new test

infrastructure so I don't have to revert it to check this in. :)
This commit is contained in:
Rob Landley 2007-06-18 01:09:00 -04:00
parent 132922a878
commit e35f2b8312
3 changed files with 24 additions and 11 deletions

View File

@ -17,8 +17,8 @@ all: toybox
include kconfig/Makefile include kconfig/Makefile
# defconfig is the "maximum sane config"; allyesconfig minus debugging and such. # defconfig is the "maximum sane config"; allyesconfig minus debugging and such.
defconfig: allyesconfig #defconfig: allyesconfig
@sed -i -r -e "s/^(CONFIG_TOYBOX_(DEBUG|FREE))=.*/# \1 is not set/" .config # @sed -i -r -e "s/^(CONFIG_TOYBOX_(DEBUG|FREE))=.*/# \1 is not set/" .config
.config: Config.in toys/Config.in .config: Config.in toys/Config.in
@ -41,13 +41,10 @@ baseline: toybox_unstripped
bloatcheck: toybox_old toybox_unstripped bloatcheck: toybox_old toybox_unstripped
@scripts/bloat-o-meter toybox_old toybox_unstripped @scripts/bloat-o-meter toybox_old toybox_unstripped
# Get list of toys/*.c files from .config # Get list of .c files to compile, including toys/*.c files from .config
toyfiles = main.c lib/*.c \
$(shell scripts/cfg2files.sh < .config | sed 's@\(.*\)@toys/\1.c@')
toysfiles = $(shell sed -nre 's/^CONFIG_(.*)=y/\1/;t skip;b;:skip;s/_.*//;p' .config | sort -u | tr A-Z a-z | grep -v '^toybox$$' | sed 's@\(.*\)@toys/\1.c@')
# Compile toybox from source
toyfiles = main.c lib/*.c $(toysfiles)
toybox_unstripped: gen_config.h $(toyfiles) toys/toylist.h lib/*.h toys.h toybox_unstripped: gen_config.h $(toyfiles) toys/toylist.h lib/*.h toys.h
$(CC) $(CCFLAGS) -I . $(toyfiles) -o toybox_unstripped \ $(CC) $(CCFLAGS) -I . $(toyfiles) -o toybox_unstripped \
-ffunction-sections -fdata-sections -Wl,--gc-sections -ffunction-sections -fdata-sections -Wl,--gc-sections
@ -69,6 +66,11 @@ clean::
distclean: clean distclean: clean
rm -f .config* rm -f .config*
test: tests
tests:
scripts/testall.sh
help:: help::
@echo ' baseline - Create busybox_old for use by bloatcheck.' @echo ' baseline - Create busybox_old for use by bloatcheck.'
@echo ' bloatcheck - Report size differences between old and current versions' @echo ' bloatcheck - Report size differences between old and current versions'

View File

@ -6,7 +6,7 @@ KCONFIG_TOP = Config.in
KCONFIG_PROJECT = ToyBox KCONFIG_PROJECT = ToyBox
obj = ./kconfig obj = ./kconfig
PHONY += clean help oldconfig menuconfig config silentoldconfig \ PHONY += clean help oldconfig menuconfig config silentoldconfig \
randconfig allyesconfig allnoconfig allmodconfig #defconfig randconfig allyesconfig allnoconfig allmodconfig defconfig
menuconfig: $(obj)/mconf menuconfig: $(obj)/mconf
$< $(KCONFIG_TOP) $< $(KCONFIG_TOP)
@ -29,8 +29,8 @@ allyesconfig: $(obj)/conf
allnoconfig: $(obj)/conf allnoconfig: $(obj)/conf
$< -n $(KCONFIG_TOP) $< -n $(KCONFIG_TOP)
#defconfig: $(obj)/conf defconfig: $(obj)/conf
# $< -d $(KCONFIG_TOP) $< -D /dev/null $(KCONFIG_TOP)
# Help text used by make help # Help text used by make help
help:: help::

11
scripts/cfg2files.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
# cat .config into this to get a list of .c files.
# Grab the XXX part of all CONFIG_XXX entries, removing everything after the
# second underline. Sort the list, keep only one of each entry, convert
# to lower case, remove toybox itself from the list (as that indicates
# global symbols).
sed -nre 's/^CONFIG_(.*)=y/\1/;t skip;b;:skip;s/_.*//;p' \
| sort -u | tr A-Z a-z | grep -v '^toybox$'