2 # Copyright 2006 Rob Landley <rob@landley.net>
4 CFLAGS = -Wall -Wundef -Os
5 CC = $(CROSS_COMPILE)gcc $(CFLAGS) -funsigned-char
6 STRIP = $(CROSS_COMPILE)strip
7 HOST_CC = gcc $(CFLAGS) -funsigned-char
13 include kconfig/Makefile
15 .config: Config.in toys/Config.in
17 # The long and roundabout sed is to make old versions of sed happy. New ones
18 # have '\n' so can replace one line with two without all the branches and
19 # mucking about with hold space.
21 sed -n -e 's/^# CONFIG_\(.*\) is not set.*/\1/' \
22 -e 't notset' -e 'b tryisset' -e ':notset' \
23 -e 'h' -e 's/.*/#define CFG_& 0/p' \
24 -e 'g' -e 's/.*/#define USE_&(...)/p' -e 'd' -e ':tryisset' \
25 -e 's/^CONFIG_\(.*\)=y.*/\1/' -e 't isset' -e 'd' -e ':isset' \
26 -e 'h' -e 's/.*/#define CFG_& 1/p' \
27 -e 'g' -e 's/.*/#define USE_&(...) __VA_ARGS__/p' $< > $@
30 baseline: toybox_unstripped
31 @cp toybox_unstripped toybox_old
33 bloatcheck: toybox_old toybox_unstripped
34 @scripts/bloat-o-meter toybox_old toybox_unstripped
38 toyfiles = main.c toys/*.c lib/*.c
39 toybox_unstripped: gen_config.h $(toyfiles) toys/toylist.h lib/lib.h toys.h
40 $(CC) $(CFLAGS) -I . $(toyfiles) -o toybox_unstripped \
41 -ffunction-sections -fdata-sections -Wl,--gc-sections
43 toybox: toybox_unstripped
44 $(STRIP) toybox_unstripped -o toybox
46 rm -f toybox gen_config.h
52 @echo ' baseline - Create busybox_old for use by bloatcheck.'
53 @echo ' bloatcheck - Report size differences between old and current versions'