2 # TODO: this should be src/Kconfig
3 Kconfig := src/target/Kconfig
9 all: configincludes tags bin/firmerware.bin
12 # Builder helping hand
17 @echo "*** Try 'make menuconfig' followed by 'make'"
18 @echo " Learn about object sizes at any stage with 'make size'"
20 @echo Platform-specific notes are part of the target help descriptions.
25 # Load configuration file and various Makefiles
29 include bin/kconfig/Makefile
31 include src/kernel/Makefile
32 include src/net/Makefile
33 include src/phone/Makefile
35 include src/target/Makefile
36 include src/function/Makefile
37 include src/driver/Makefile
39 BINPATH = $(CONFIG_PLATFORM_BIN_PATH):$(PATH)
42 # Dependencies for generated include files
43 # TODO: Solve cyclic dependencies on non-generated file
45 include/config.h: .config
46 ( cat $< ; for m in $(metavars-y) ; do echo $$m ; done ) | sed -e '/^#/d' -e 's/^\([A-Za-z0-9_]*\)=\(.*\)/#define \1 \2/' > $@
47 for i in $(includes-y) ; do echo "#include <$$i>" >> $@ ; done
49 .PHONY += configincludes
50 configincludes: include/config.h
53 # Include dependency files
55 -include $(objs-top-kernel-y:.o=.d)
56 -include $(objs-top-net-y:.o=.d)
57 -include $(objs-top-phone-y:.o=.d)
58 -include $(objs-top-bottom-y:.o=.d)
61 # The main building targets
63 # Building is done in two phases; first top.o and bottom.o
64 # each hold their respective halves of the process, then they
65 # are composed to form the target binary. This separation
66 # enables a thoroughness check on the API separation. The
67 # rule is that all API calls between the two halves must be
68 # documented in doc/top2bottom.*
71 bin/top-kernel.o: $(objs-top-kernel-y)
72 PATH=$(BINPATH) $(LD) $(LDFLAGS) -r -o $@ $(objs-top-kernel-y)
74 bin/top-net.o: $(objs-top-net-y)
75 PATH=$(BINPATH) $(LD) $(LDFLAGS) -r -o $@ $(objs-top-net-y)
77 bin/top-phone.o: $(objs-top-phone-y)
78 PATH=$(BINPATH) $(LD) $(LDFLAGS) -r -o $@ $(objs-top-phone-y)
80 # bin/top.o: bin/top-kernel.o bin/top-net.o bin/top-phone.o
81 # $(LD) $(LDFLAGS) -r -o $@ bin/top-kernel.o bin/top-net.o bin/top-phone.o
82 bin/top.o: $(objs-top-y)
83 PATH=$(BINPATH) $(LD) $(LDFLAGS) -r -o $@ $(objs-top-y)
85 bin/bottom.o: $(objs-bottom-y)
86 PATH=$(BINPATH) $(LD) $(LDFLAGS) -r -o $@ $(objs-bottom-y)
89 # Create a "tags" file for easy Vim navigation
92 ctags $(objs-top-kernel-y:.o=.c) $(objs-top-net-y:.o=.c) $(objs-top-phone-y:.o=.c) $(objs-bottom-y:.o=.c) include/0cpm/*.h include/config.h
96 rm -f $(objs-top-y) $(objs-top-n) $(objs-top-)
97 # rm -f $(objs-top-net-y)
98 # rm -f $(objs-top-phone-y)
99 rm -f $(objs-bottom-y)
100 rm -f $(objs-top-y:.o=.d) $(objs-top-n:.o=.d) $(objs-top-:.o=.d)
101 # rm -f $(objs-top-kernel-y:.o=.d)
102 # rm -f $(objs-top-net-y:.o=.d)
103 # rm -f $(objs-top-phone-y:.o=.d)
104 rm -f $(objs-bottom-y:.o=.d)
105 rm -f bin/top-kernel.o bin/top-net.o bin/top-phone.o
106 rm -f bin/top.o bin/bottom.o
107 rm -f include/config.h
108 rm -f tags src/net/6bed4.c
109 rm -f bin/firmerware.exe bin/firmerware.bin
114 @echo '*** Top half kernel sizes:'
116 @size $(objs-top-kernel-y) || true
118 @echo '*** Top half network sizes:'
120 @size $(objs-top-net-y) || true
122 @echo '*** Top half phone sizes:'
124 @size $(objs-top-phone-y) || true
126 @echo '*** Bottom half sizes:'
128 @size $(objs-bottom-y) || true
130 @echo '*** Major component sizes:'
132 @size bin/top-kernel.o bin/top-net.o bin/top-phone.o bin/bottom.o || true