annotate Makefile @ 47:6b933d9c54ac

Blah. The sed filter's not right, I'll try again later.
author Rob Landley <rob@landley.net>
date Thu, 04 Jan 2007 17:26:30 -0500
parents e60d48d30ef0
children 4f5cdc6552da
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
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 \
47
6b933d9c54ac Blah. The sed filter's not right, I'll try again later.
Rob Landley <rob@landley.net>
parents: 45
diff changeset
41 -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
42 #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
43
41
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
44 toybox: toybox_unstripped
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
45 $(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
46 clean::
42
72ff42c01d92 Teach clean and distclean to zap more files.
Rob Landley <rob@landley.net>
parents: 41
diff changeset
47 rm -f toybox toybox_old toybox_unstripped gen_config.h
14
f8e628f61f16 Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents: 7
diff changeset
48
f8e628f61f16 Make the config generate gen_config.h with CFG_ and USE() macros.
Rob Landley <rob@landley.net>
parents: 7
diff changeset
49 distclean: clean
42
72ff42c01d92 Teach clean and distclean to zap more files.
Rob Landley <rob@landley.net>
parents: 41
diff changeset
50 rm -f .config*
41
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
51
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
52 help::
a43bdc6f53af Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents: 38
diff changeset
53 @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
54 @echo ' bloatcheck - Report size differences between old and current versions'