Mercurial > hg > toybox
annotate Makefile @ 41:a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 26 Nov 2006 18:47:14 -0500 |
parents | b707dfcd403c |
children | 72ff42c01d92 |
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 |
41
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
4 CFLAGS = -Wall -Wundef -Os |
38
b707dfcd403c
Reduce flag duplication and make kconfig use HOST_CC.
Rob Landley <rob@landley.net>
parents:
31
diff
changeset
|
5 CC = $(CROSS_COMPILE)gcc $(CFLAGS) -funsigned-char |
41
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
6 STRIP = $(CROSS_COMPILE)strip |
38
b707dfcd403c
Reduce flag duplication and make kconfig use HOST_CC.
Rob Landley <rob@landley.net>
parents:
31
diff
changeset
|
7 HOST_CC = gcc $(CFLAGS) -funsigned-char |
14
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
8 |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
9 all: toybox |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
10 |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
11 .PHONY: clean |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
12 |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
13 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
|
14 |
19
414625f97667
Better dependencies, and feed the linker --gc-sections. (Which is not an
Rob Landley <rob@landley.net>
parents:
14
diff
changeset
|
15 .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
|
16 |
14
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
17 # 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
|
18 # 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
|
19 # 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
|
20 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
|
21 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
|
22 -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
|
23 -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
|
24 -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
|
25 -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
|
26 -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
|
27 -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
|
28 |
41
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
29 # Development targets |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
30 baseline: toybox_unstripped |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
31 @cp toybox_unstripped toybox_old |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
32 |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
33 bloatcheck: toybox_old toybox_unstripped |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
34 @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
|
35 |
14
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
36 # Actual build |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
37 |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
38 toyfiles = main.c toys/*.c lib/*.c |
41
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
39 toybox_unstripped: gen_config.h $(toyfiles) toys/toylist.h lib/lib.h toys.h |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
40 $(CC) $(CFLAGS) -I . $(toyfiles) -o toybox_unstripped \ |
38
b707dfcd403c
Reduce flag duplication and make kconfig use HOST_CC.
Rob Landley <rob@landley.net>
parents:
31
diff
changeset
|
41 -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
|
42 |
41
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
43 toybox: toybox_unstripped |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
44 $(STRIP) toybox_unstripped -o toybox |
14
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
45 clean:: |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
46 rm -f toybox gen_config.h |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
47 |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
48 distclean: clean |
f8e628f61f16
Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents:
7
diff
changeset
|
49 rm -f .config |
41
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
50 |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
51 help:: |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
38
diff
changeset
|
52 @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
|
53 @echo ' bloatcheck - Report size differences between old and current versions' |