Mercurial > hg > toybox
annotate Makefile @ 139:fb0745eec453
Add "help" command. (Building help/help.h requires python, but I'll ship
that file with release versions.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 29 Aug 2007 08:10:01 -0500 |
parents | a459c6b39645 |
children | 478d3c77068b |
rev | line source |
---|---|
14
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
1 # Makefile for toybox. |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
2 # Copyright 2006 Rob Landley <rob@landley.net> |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
3 |
123
81a324ef9167
More cross compiling infrastructure.
Rob Landley <rob@landley.net>
parents:
119
diff
changeset
|
4 CFLAGS := $(CFLAGS) -Wall -Wundef -Wno-char-subscripts -Os |
119
8b5ae5f607af
Make it easier to specify which compiler to use.
Rob Landley <rob@landley.net>
parents:
109
diff
changeset
|
5 CCFLAGS = $(CFLAGS) -funsigned-char |
8b5ae5f607af
Make it easier to specify which compiler to use.
Rob Landley <rob@landley.net>
parents:
109
diff
changeset
|
6 CC = $(CROSS_COMPILE)gcc |
41
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
7 STRIP = $(CROSS_COMPILE)strip |
119
8b5ae5f607af
Make it easier to specify which compiler to use.
Rob Landley <rob@landley.net>
parents:
109
diff
changeset
|
8 HOSTCC = gcc |
14
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
9 |
123
81a324ef9167
More cross compiling infrastructure.
Rob Landley <rob@landley.net>
parents:
119
diff
changeset
|
10 # A synonym. |
81a324ef9167
More cross compiling infrastructure.
Rob Landley <rob@landley.net>
parents:
119
diff
changeset
|
11 CROSS_COMPILE = $(CROSS) |
81a324ef9167
More cross compiling infrastructure.
Rob Landley <rob@landley.net>
parents:
119
diff
changeset
|
12 |
14
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
13 all: toybox |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
14 |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
15 .PHONY: clean |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
16 |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
17 include kconfig/Makefile |
1
59d58fab67c6
Next snapshot. Tries to grab something out of lib in order to build, I have
landley@driftwood
parents:
diff
changeset
|
18 |
90
7c77c6ec17ee
Add "make defconfig". Modify global options to start with CONFIG_TOYBOX_.
Rob Landley <rob@landley.net>
parents:
89
diff
changeset
|
19 # defconfig is the "maximum sane config"; allyesconfig minus debugging and such. |
133
a459c6b39645
Fix makefile to defconfig properly, and leak in a bit of the new test
Rob Landley <rob@landley.net>
parents:
123
diff
changeset
|
20 #defconfig: allyesconfig |
a459c6b39645
Fix makefile to defconfig properly, and leak in a bit of the new test
Rob Landley <rob@landley.net>
parents:
123
diff
changeset
|
21 # @sed -i -r -e "s/^(CONFIG_TOYBOX_(DEBUG|FREE))=.*/# \1 is not set/" .config |
90
7c77c6ec17ee
Add "make defconfig". Modify global options to start with CONFIG_TOYBOX_.
Rob Landley <rob@landley.net>
parents:
89
diff
changeset
|
22 |
19
414625f97667
Better dependencies, and feed the linker --gc-sections. (Which is not an
Rob Landley <rob@landley.net>
parents:
14
diff
changeset
|
23 .config: Config.in toys/Config.in |
414625f97667
Better dependencies, and feed the linker --gc-sections. (Which is not an
Rob Landley <rob@landley.net>
parents:
14
diff
changeset
|
24 |
14
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
25 # The long and roundabout sed is to make old versions of sed happy. New ones |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
26 # have '\n' so can replace one line with two without all the branches and |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
27 # mucking about with hold space. |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
28 gen_config.h: .config |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
29 sed -n -e 's/^# CONFIG_\(.*\) is not set.*/\1/' \ |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
30 -e 't notset' -e 'b tryisset' -e ':notset' \ |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
31 -e 'h' -e 's/.*/#define CFG_& 0/p' \ |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
32 -e 'g' -e 's/.*/#define USE_&(...)/p' -e 'd' -e ':tryisset' \ |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
33 -e 's/^CONFIG_\(.*\)=y.*/\1/' -e 't isset' -e 'd' -e ':isset' \ |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
34 -e 'h' -e 's/.*/#define CFG_& 1/p' \ |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
35 -e 'g' -e 's/.*/#define USE_&(...) __VA_ARGS__/p' $< > $@ |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
36 |
41
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
37 # Development targets |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
38 baseline: toybox_unstripped |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
39 @cp toybox_unstripped toybox_old |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
40 |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
41 bloatcheck: toybox_old toybox_unstripped |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
42 @scripts/bloat-o-meter toybox_old toybox_unstripped |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
43 |
133
a459c6b39645
Fix makefile to defconfig properly, and leak in a bit of the new test
Rob Landley <rob@landley.net>
parents:
123
diff
changeset
|
44 # Get list of .c files to compile, including toys/*.c files from .config |
a459c6b39645
Fix makefile to defconfig properly, and leak in a bit of the new test
Rob Landley <rob@landley.net>
parents:
123
diff
changeset
|
45 toyfiles = main.c lib/*.c \ |
a459c6b39645
Fix makefile to defconfig properly, and leak in a bit of the new test
Rob Landley <rob@landley.net>
parents:
123
diff
changeset
|
46 $(shell scripts/cfg2files.sh < .config | sed 's@\(.*\)@toys/\1.c@') |
14
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
47 |
94
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
91
diff
changeset
|
48 toybox_unstripped: gen_config.h $(toyfiles) toys/toylist.h lib/*.h toys.h |
119
8b5ae5f607af
Make it easier to specify which compiler to use.
Rob Landley <rob@landley.net>
parents:
109
diff
changeset
|
49 $(CC) $(CCFLAGS) -I . $(toyfiles) -o toybox_unstripped \ |
94
884c03c29f21
Teach build to build only the toys/*.c selected in .config, and teach
Rob Landley <rob@landley.net>
parents:
91
diff
changeset
|
50 -ffunction-sections -fdata-sections -Wl,--gc-sections |
14
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
51 |
41
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
52 toybox: toybox_unstripped |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
53 $(STRIP) toybox_unstripped -o toybox |
89 | 54 |
139
fb0745eec453
Add "help" command. (Building help/help.h requires python, but I'll ship
Rob Landley <rob@landley.net>
parents:
133
diff
changeset
|
55 toys/help.c: toys/help.h |
fb0745eec453
Add "help" command. (Building help/help.h requires python, but I'll ship
Rob Landley <rob@landley.net>
parents:
133
diff
changeset
|
56 |
fb0745eec453
Add "help" command. (Building help/help.h requires python, but I'll ship
Rob Landley <rob@landley.net>
parents:
133
diff
changeset
|
57 toys/help.h: Config.in toys/Config.in scripts/config2help.py |
fb0745eec453
Add "help" command. (Building help/help.h requires python, but I'll ship
Rob Landley <rob@landley.net>
parents:
133
diff
changeset
|
58 scripts/config2help.py Config.in > toys/help.h |
fb0745eec453
Add "help" command. (Building help/help.h requires python, but I'll ship
Rob Landley <rob@landley.net>
parents:
133
diff
changeset
|
59 |
89 | 60 instlist: toybox |
119
8b5ae5f607af
Make it easier to specify which compiler to use.
Rob Landley <rob@landley.net>
parents:
109
diff
changeset
|
61 $(HOSTCC) $(CCFLAGS) -I . scripts/install.c -o instlist |
89 | 62 |
63 install_flat: instlist | |
64 @mkdir -p $(PREFIX)/ | |
65 @cp toybox $(PREFIX)/ | |
66 @for i in `./instlist`; do ln -s toybox "$(PREFIX)/$$i"; done | |
67 | |
14
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
68 clean:: |
89 | 69 rm -f toybox toybox_old toybox_unstripped gen_config.h instlist |
14
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
70 |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
71 distclean: clean |
42
72ff42c01d92
Teach clean and distclean to zap more files.
Rob Landley <rob@landley.net>
parents:
41
diff
changeset
|
72 rm -f .config* |
41
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
73 |
133
a459c6b39645
Fix makefile to defconfig properly, and leak in a bit of the new test
Rob Landley <rob@landley.net>
parents:
123
diff
changeset
|
74 test: tests |
a459c6b39645
Fix makefile to defconfig properly, and leak in a bit of the new test
Rob Landley <rob@landley.net>
parents:
123
diff
changeset
|
75 |
a459c6b39645
Fix makefile to defconfig properly, and leak in a bit of the new test
Rob Landley <rob@landley.net>
parents:
123
diff
changeset
|
76 tests: |
a459c6b39645
Fix makefile to defconfig properly, and leak in a bit of the new test
Rob Landley <rob@landley.net>
parents:
123
diff
changeset
|
77 scripts/testall.sh |
a459c6b39645
Fix makefile to defconfig properly, and leak in a bit of the new test
Rob Landley <rob@landley.net>
parents:
123
diff
changeset
|
78 |
41
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
79 help:: |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
80 @echo ' baseline - Create busybox_old for use by bloatcheck.' |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
81 @echo ' bloatcheck - Report size differences between old and current versions' |