Switch flag generation from shell to C.
[platform/upstream/toybox.git] / Makefile
1 # Makefile for toybox.
2 # Copyright 2006 Rob Landley <rob@landley.net>
3
4 all: toybox
5
6 KCONFIG_CONFIG ?= .config
7 toybox toybox_unstripped: $(KCONFIG_CONFIG) *.[ch] lib/*.[ch] toys/*.h toys/*/*.c scripts/*.sh
8         scripts/make.sh
9
10 .PHONY: clean distclean baseline bloatcheck install install_flat \
11         uinstall uninstall_flat test tests help scripts/test
12
13 include kconfig/Makefile
14
15 $(KCONFIG_TOP): generated/Config.in
16 generated/Config.in: toys/*/*.c scripts/genconfig.sh
17         scripts/genconfig.sh
18
19 HOSTCC?=cc
20
21 # Development targets
22 baseline: toybox_unstripped
23         @cp toybox_unstripped toybox_old
24
25 bloatcheck: toybox_old toybox_unstripped
26         @scripts/bloatcheck toybox_old toybox_unstripped
27
28 generated/instlist: toybox
29         $(HOSTCC) -I . scripts/install.c -o generated/instlist
30
31 install_flat: generated/instlist
32         scripts/install.sh --symlink --force
33
34 install:
35         scripts/install.sh --long --symlink --force
36
37 uninstall_flat: generated/instlist
38         scripts/install.sh --uninstall
39
40 uninstall:
41         scripts/install.sh --long --uninstall
42
43 clean::
44         rm -rf toybox toybox_unstripped generated/config.h generated/Config.in \
45                 generated/newtoys.h generated/globals.h testdir \
46                 generated/Config.probed generated/oldtoys.h generated/flags.h \
47                 generated/portability.h .singleconfig generated/instlist \
48                 generated/mkflags
49
50 distclean: clean
51         rm -f toybox_old .config* generated/help.h
52
53 test: tests
54
55 tests:
56         scripts/test.sh
57
58 help::
59         @echo  '  toybox          - Build toybox.'
60         @echo  '  baseline        - Create busybox_old for use by bloatcheck.'
61         @echo  '  bloatcheck      - Report size differences between old and current versions'
62         @echo  '  test            - Run test suite against compiled commands.'
63         @echo  '  clean           - Delete temporary files.'
64         @echo  "  distclean       - Delete everything that isn't shipped."
65         @echo  '  install_flat    - Install toybox into $$PREFIX directory.'
66         @echo  '  install         - Install toybox into subdirectories of $$PREFIX.'
67         @echo  '  uninstall_flat  - Remove toybox from $$PREFIX directory.'
68         @echo  '  uninstall       - Remove toybox from subdirectories of $$PREFIX.'
69         @echo  ''
70         @echo  'example: CFLAGS="--static" CROSS_COMPILE=armv5l- make defconfig toybox install'
71         @echo  ''