2 # Copyright 2006 Rob Landley <rob@landley.net>
4 CFLAGS = -Wall -Wundef -Os -s
5 CC = $(CROSS_COMPILE)gcc $(CFLAGS) -funsigned-char
6 HOST_CC = gcc $(CFLAGS) -funsigned-char
12 include kconfig/Makefile
14 .config: Config.in toys/Config.in
16 # The long and roundabout sed is to make old versions of sed happy. New ones
17 # have '\n' so can replace one line with two without all the branches and
18 # mucking about with hold space.
20 sed -n -e 's/^# CONFIG_\(.*\) is not set.*/\1/' \
21 -e 't notset' -e 'b tryisset' -e ':notset' \
22 -e 'h' -e 's/.*/#define CFG_& 0/p' \
23 -e 'g' -e 's/.*/#define USE_&(...)/p' -e 'd' -e ':tryisset' \
24 -e 's/^CONFIG_\(.*\)=y.*/\1/' -e 't isset' -e 'd' -e ':isset' \
25 -e 'h' -e 's/.*/#define CFG_& 1/p' \
26 -e 'g' -e 's/.*/#define USE_&(...) __VA_ARGS__/p' $< > $@
30 toyfiles = main.c toys/*.c lib/*.c
31 toybox: gen_config.h $(toyfiles) toys/toylist.h lib/lib.h toys.h
32 $(CC) $(CFLAGS) -I . $(toyfiles) -o toybox \
33 -ffunction-sections -fdata-sections -Wl,--gc-sections
36 rm -f toybox gen_config.h