From fd1c5ba0cbbd31c4713d9283c4fa5c3265ad2296 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 3 Feb 2007 14:10:00 -0500 Subject: Teach build to build only the toys/*.c selected in .config, and teach CFG_TOYSH_DEBUG to shut up the spurious "gcc can't tell that this is never actually used uninitialized because gcc is stupid" warnings. --- Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 011a5624..97482ae1 100644 --- a/Makefile +++ b/Makefile @@ -37,13 +37,16 @@ baseline: toybox_unstripped bloatcheck: toybox_old toybox_unstripped @scripts/bloat-o-meter toybox_old toybox_unstripped -# Actual build +# Get list of toys/*.c files from .config -toyfiles = main.c toys/*.c lib/*.c -toybox_unstripped: gen_config.h $(toyfiles) toys/toylist.h lib/lib.h toys.h +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 -r '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 $(CC) $(CFLAGS) -I . $(toyfiles) -o toybox_unstripped \ - -ffunction-sections -fdata-sections -Wl,--gc-sections #\ - #2>&1 | sed -n -e '/may be used uninitialized/{s/.*/\n/;h;b};1{x;b};: print;=;p;x;/\n/b thing;p;: thing;${x;p}' >&2 + -ffunction-sections -fdata-sections -Wl,--gc-sections toybox: toybox_unstripped $(STRIP) toybox_unstripped -o toybox -- cgit v1.2.3