aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-02-03 14:10:00 -0500
committerRob Landley <rob@landley.net>2007-02-03 14:10:00 -0500
commitfd1c5ba0cbbd31c4713d9283c4fa5c3265ad2296 (patch)
tree48f65558e2c9d76fa397e066c14a5642accee992 /Makefile
parent5a60e26fe8de2648689ff8c5659085b99f5891a0 (diff)
downloadtoybox-fd1c5ba0cbbd31c4713d9283c4fa5c3265ad2296.tar.gz
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.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 8 insertions, 5 deletions
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