annotate Makefile @ 90:7c77c6ec17ee

Add "make defconfig". Modify global options to start with CONFIG_TOYBOX_.
author Rob Landley <rob@landley.net>
date Wed, 31 Jan 2007 14:37:01 -0500
parents 4f5cdc6552da
children b596b9b3b2af
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
45
e60d48d30ef0 Make some of gcc 4.1's dumber warnings go away.
Rob Landley <rob@landley.net>
parents: 42
diff changeset
4 CFLAGS = -Wall -Wundef -Wno-char-subscripts -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
90
7c77c6ec17ee Add "make defconfig". Modify global options to start with CONFIG_TOYBOX_.
Rob Landley <rob@landley.net>
parents: 89
diff changeset
15 # defconfig is the "maximum sane config"; allyesconfig minus debugging and such.
7c77c6ec17ee Add "make defconfig". Modify global options to start with CONFIG_TOYBOX_.
Rob Landley <rob@landley.net>
parents: 89
diff changeset
16 defconfig: allyesconfig
7c77c6ec17ee Add "make defconfig". Modify global options to start with CONFIG_TOYBOX_.
Rob Landley <rob@landley.net>
parents: 89
diff changeset
17 @sed -i -r -e "s/^(CONFIG_(TOYBOX_DEBUG|TOYBOX_FREE))=.*/# \1 is not set/" .config
7c77c6ec17ee Add "make defconfig". Modify global options to start with CONFIG_TOYBOX_.
Rob Landley <rob@landley.net>
parents: 89
diff changeset
18
19
414625f97667 Better dependencies, and feed the linker --gc-sections. (Which is not an
Rob Landley <rob@landley.net>
parents: 14
diff changeset
19 .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
20
14
f8e628f61f16 Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents: 7
diff changeset
21 # 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
22 # 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
23 # 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
24 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
25 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
26 -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
27 -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
28 -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
29 -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
30 -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
31 -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
32
41
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
33 # Development targets
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
34 baseline: toybox_unstripped
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
35 @cp toybox_unstripped toybox_old
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
36
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
37 bloatcheck: toybox_old toybox_unstripped
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
38 @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
39
14
f8e628f61f16 Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents: 7
diff changeset
40 # Actual build
f8e628f61f16 Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents: 7
diff changeset
41
f8e628f61f16 Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents: 7
diff changeset
42 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
43 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
44 $(CC) $(CFLAGS) -I . $(toyfiles) -o toybox_unstripped \
47
6b933d9c54ac Blah. The sed filter's not right, I'll try again later.
Rob Landley <rob@landley.net>
parents: 45
diff changeset
45 -ffunction-sections -fdata-sections -Wl,--gc-sections #\
6b933d9c54ac Blah. The sed filter's not right, I'll try again later.
Rob Landley <rob@landley.net>
parents: 45
diff changeset
46 #2>&1 | sed -n -e '/may be used uninitialized/{s/.*/\n/;h;b};1{x;b};: print;=;p;x;/\n/b thing;p;: thing;${x;p}' >&2
14
f8e628f61f16 Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents: 7
diff changeset
47
41
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
48 toybox: toybox_unstripped
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
49 $(STRIP) toybox_unstripped -o toybox
89
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
50
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
51 instlist: toybox
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
52 $(HOST_CC) -I . scripts/install.c -o instlist
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
53
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
54 install_flat: instlist
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
55 @mkdir -p $(PREFIX)/
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
56 @cp toybox $(PREFIX)/
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
57 @for i in `./instlist`; do ln -s toybox "$(PREFIX)/$$i"; done
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
58
14
f8e628f61f16 Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents: 7
diff changeset
59 clean::
89
4f5cdc6552da Add make install_flat.
Rob Landley <rob@landley.net>
parents: 47
diff changeset
60 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
61
f8e628f61f16 Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents: 7
diff changeset
62 distclean: clean
42
72ff42c01d92 Teach clean and distclean to zap more files.
Rob Landley <rob@landley.net>
parents: 41
diff changeset
63 rm -f .config*
41
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
64
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
65 help::
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
66 @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
67 @echo ' bloatcheck - Report size differences between old and current versions'